|
Hi,
How can i develop a application which can execute once and the executive file would be removed from device. Like: After program show a message, this executive file is removed. I got a straight way that after the application executes, deleting this application file. But how? Running program couldn't delete itself. Any suggestion is welcome. Thanks!
Regards, ginee
|
|
|
|
|
Hi,
One solution is to create a .bat file with deleting instructions. You will call the bat file at the end (before return ). That work's generally.
I hope this helps...
Well... I am a beginner ...
|
|
|
|
|
While that program is running (before return or some other interrupt, this program doesn't be terminated), i think the executive file is locked. And it can be deleted or moved. However, i will try this way. Thanks you!
|
|
|
|
|
I think the reason why the .bat file method works is because you put it just before return and the program you want to delete exits faster than the bat file opens...
|
|
|
|
|
|
|
I Write a player to play *.wmv files using the Windows media player ActiveX Control .It use about 20MB Memory when playing a wmv File,But the Windows Media player provided by the system only use 8MB.I wonder how can I decrease the memory useage of my player,how can the Windows Media player provided by the system managed to do it ?
|
|
|
|
|
|
|
Hi
Could anyone please tell me how to hook a printer.
I want to collect all the data regarding the printer, pages printed, who printed it etc.
I believe, this is possible if we can hook the printer. Intercept any communication to the printer.
Thanks in advance
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Does anyone know how to declare an iterator to, say, a struct variable? Here's an eg of a struct I declared outside a function:
struct vStruct {
CString szString;
int nInt;
double dDouble;
} v;
Then, inside the function I have:
std::vector<vstruct> vStruct;
And the problem is when I do this:
std::vector<vstruct>::iterator iStruct;
Thx,
Ralf.
ralf.riedel@usm.edu
|
|
|
|
|
RalfPeter wrote:
And the problem is when I do this
What's the problem? What does the compiler say?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Well, I caught the problem. The data type and the name are the same. That's thouwing off the CP. Thx,
Ralf.
|
|
|
|
|
I think some of your < and > symbols have been stripped out by CP.
But what you need to do to declare the iterator is:
<br />
std::vector<vStruct>::iterator iStruct;<br />
Mike
|
|
|
|
|
Hi
I’m going to develop an application for university and I would really appreciate some advice. I’m creating a file managing system, like tar, that creates a ‘file’ which manages a collection of files. You can add files to the ‘file’, create directories (a directory would be a file with pointers to inodes), delete them, etc. It’s like creating a small file system. I have to develop it in Linux, in C++, it’ll be an Object Oriented Program. I was thinking of dividing the ‘file’ in three parts, the main or first section, the ‘inodes’ section and the files section. The inodes are small pieces of data that contains information of the files inside the ‘file’, its name, where it starts and the size in bytes among other things. I was thinking that all of them could have the same size, but that’s not good, as space will be wasted for file names. Then, for indexing the files inside the big ‘file’, I was thinking in giving them numbers, and searching sequentially, but I need something more efficient. I heard that the best solution to that are trees. Which is the easier solution to implement, one which is also fast? Any other ideas of how could I index files inside the big ‘files’? Any links or recommended books on the subject? I’m quite new in this area of programming and I didn’t find anything useful on the net.
Thank you very much for your time!
|
|
|
|
|
Hi all,
How can I get the information (Directories, Files, Drive used Memory Spaces and Unused Memory Spaces) from the other devices which is connected to the USB Ports(Thumb Drive, Flash Card) and even Harddisc, cddrive and Floppy Drive and so on.
Waiting for Result..........
Cheers
S.Darwin Paul Raj
DARWIN PAUL RAJ
|
|
|
|
|
Hello
I made a class for TCP-kommunicating using SOCKETS.
Only MFC, programmed with MS VS .NET C++
This class is to be used from 2 tolls, one client and one Server.
Everything works.
But when I build a tool containing Client and Server a very strange mistake happens.
The Server socket calls accept to wait for the client and stand still.
The client socket calls connect to get the Server and stand still.
Normally the Server goes on with the result of accept and then the client gies on with teh result fromn connect.
In ths speziel tool the server keeps on standing still and ist gets NO result of accept. But the Client gets immedialte the succes result.
But there is no server listeing to it.
Poor client. Nobody likes it.
It is exact the same procedure with all my three tools. And when I use the ClientServer tool with one of the other everything is ok.
Does anybody know how this can happen?
Im just very frustrated.
Thanks for any answer.
Gerhard from Germany
|
|
|
|
|
Hi Gerhard,
Have you looked at the MFC Sample CHATSRVR?
And the CSocket docs 8about MFC and sockets?
Do you start the server before the client?
The book UNIX network programming by Stevens
is a good book about sockets in general.
Regards,
Magnus
|
|
|
|
|
I am working on a project where I need to track information for each row in a listctrl.
I have create a class for the tracking.
Then when I load the listctrl I create a new class and store the pointer in the SetItemData of the row.
Example:
SetItemData( GetItemCount() - 1 , ( DWORD ) new CTrackingObject() );
This works great. The problem I have: "How do I delete the class when the ListCtrl is destroyed.
I have tried overloading the DeleteAllItems() but when I call the GetItemCount() method, I get an error.
Any ideas of how I can call the pointers from the listctrl and delete the classes?
|
|
|
|
|
Cedar Sith wrote:
SetItemData( GetItemCount() - 1 , ( DWORD ) new CTrackingObject() );
This is extremely unsafe code. The first parameter to SetItemData() should be the return value of InsertItem() .
Cedar Sith wrote:
Any ideas of how I can call the pointers from the listctrl and delete the classes?
Whenever the window that owns the list contol is being destroyed, that is the correct time to delete each data item in the control.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DavidCrow wrote:
Whenever the window that owns the list contol is being destroyed, that is the correct time to delete each data item in the control.
I assume you mean in the destructor of the listctrl.
I have this code but I still get errors.
for ( int i = 0 ; i < GetItemCount(); i++ ) {
delete ( CShippingObject* ) GetItemData( i );
}
GetItemCount throws an error.
Any new suggestions?
P.s. I have changed my code to be
int nNewId = InsertItem( ...);
SetItemData( nNewId , ( DWORD ) new CTrackingObject() );
|
|
|
|
|
Cedar Sith wrote:
I assume you mean in the destructor of the listctrl.
No, I mean the owner of the list control. That's usually a dialog or a form view.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DavidCrow wrote:
No, I mean the owner of the list control. That's usually a dialog or a form view.
I placed the following code in the form view destructor
for ( int i = 0 ; i < GetItemCount(); i++ ) {
delete ( CTrackingObject* ) GetItemData( i );
}
and received the same error.
It is almost as if once the parent window is closed the GetItemCount method no longer works.
Any new ideas? David, Thanks for the information so far.
|
|
|
|
|
Cedar Sith wrote:
placed the following code in the form view destructor
That won't work. You have to do it before the list view is destroyed.
Cedar Sith wrote:
It is almost as if once the parent window is closed the GetItemCount method no longer works.
Of course it doesn't. None of the methods will work; because the list view has already been destroyed. You'll have to put the code in OnDestroy() at the very latest, before you call the base class OnDestroy() handler.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
OnDestroy()
OnDestroy was the key. Thank you.
I was able to call my overloaded DeleteAllItems that deleted all of the pointers from an overloaded OnDestroy in my Overloades CmyListCtrl Class.
Here are my methods:
BOOL CmyListCtrl::DeleteAllItems( )
{
if ( m_lpszType == "ShippingQuotes" ) {
for ( int i = 0 ; i < GetItemCount(); i++ ) {
delete ( CShippingObject* ) GetItemData( i );
}
}
return CListCtrl::DeleteAllItems();
}
void CmyListCtrl::OnDestroy()
{
DeleteAllItems();
CListCtrl::OnDestroy();
}
Thank you for everyone that helped me out.
|
|
|
|