|
Sounds like some other application had the file locked. I'd be tempted to go ahead and try replacing it manually, probably with a reboot beforehand. Good luck.
Software Zen: delete this;
|
|
|
|
|
Why can't I remove the window style WS_CLIPSIBLINGS? If I remove this style using ModifyStyle, it will be there again afterwards. Why?
|
|
|
|
|
According to the MSDN, WS_CLIPSIBLINGS can be specified when the window is created, but not modified.
Software Zen: delete this;
|
|
|
|
|
So, if I want to create a WS_CLIPSIBLINGS-less dialog, I must use CDialog::Create or something like that.
But Create is not called in the sourcecode generated by VC++, or is it?
|
|
|
|
|
You can specify WS_CLIPSIBLINGS in the resource for the dialog; it should be one of the options in the dialog's properties.
My point was that you can't turn WS_CLIPSIBLINGS on and off dynamically.
Software Zen: delete this;
|
|
|
|
|
The resource editor indicates that WS_CLIPSIBLINGS is NOT activated (Properties, Tab Styles, Check button "Clip Siblings" is not checked).
Then why does Spy++ (my code too) indicate that the dialog has WS_CLIPSIBLINGS?
The only way to set/reset that style is the resource editor, or I should create it using Create(...) with or without that style. Is that correct?
|
|
|
|
|
If I have an array of pointers to objects (class objects created using "new"), are the state of those objects preserved? IOW, if certain values existed in an object at the time it was placed in the array, will those values still exist when next the object is accessed from the array?
Several of those objects are created at various times and places in the program, and are subsequently accessed at various times and places as well.
Some of the items in the objects include STL container objects, pointers and other arrays with data in them.
In case someone might think that the array of objects to which I'm referring is an array of objects of the same type, that is not the case. I am referring to an array of pointers to objects (i.e. pointers to various objects of different types which inhabit the array). This, however, is besides the topic of my question which seeks to determine if object state persist.
Thanks for any insight in this matter.
William
Fortes in fide et opere!
|
|
|
|
|
WREY wrote:
If I have an array of pointers to objects (class objects created using "new"), are the state of those objects preserved?
So long as the array hasn't gone out of scope, then yes your objects have been preserved. If they have gone out of scope you have a memory leak, and the memory you are writing / reading to or from may or may not contain your objects - you should assume it doesn't! Sometimes running in debug mode can hide things like that.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Scope shouldn't be an issue, because the objects were created using "new", which means you are responsible for deleting them in the end.
Memory leaks are more what I fear.
William
Fortes in fide et opere!
|
|
|
|
|
Since the individual objects pointed to by the array elements are allocated from the heap, they persist until they are deleted. If the array destructor doesn't delete the objects pointed to by its entries, then the objects will survive the array's destruction. (Sounds dramatic, doesn't it ).
Software Zen: delete this;
|
|
|
|
|
The question is not whether the objects themselves persist, it is whether the "state" of the objects persist.
I know it's my responsibility to call the destructor of each object in the end. So I know the objects are going to persist until I delete them individually. My real concerns are with the state of the objects with regards to the values they contain.
IOW, it is pointless to think every member variable of an object will be "const", or created on the heap, or of 'static' storage type. But when you're dealing with other aspects of C++ like STL, they have their own modus operandi.
William
Fortes in fide et opere!
|
|
|
|
|
WREY wrote:
class objects created using "new"
Because you've created the objects on the heap, they will continue to exist and be valid until destructed, regardless of the disposition of the array containing pointers to them.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Can anybody tell me how to create snapshot of MS ACCESS Database in VC++.
Thanks in Advance.
God Knows Better
|
|
|
|
|
Hi, i'm trying to write a winsock layered service provider that filters some UDP traffic and logs it to a file with the ip. The problem is i don't know how to get the ip from in there. I wrote this code but it always gives me 0.0.0.0 as the ip address:
struct sockaddr_in sin;
int err;
int inlen = sizeof(struct sockaddr_in);
if(WSPGetSockName(s, (SOCKADDR *)&sin, &inlen, &err)!=0)
MessageBox(NULL,"Error","lsp",MB_ICONERROR);
char* address;
address = inet_ntoa(sin.sin_addr);
It does not give me an error, it just logs it as 0.0.0.0
The definition of WSPRecvFrom is as follows:
INT
WSPAPI
WSPRecvFrom(
IN SOCKET s,
IN LPWSABUF lpBuffers,
IN DWORD dwBufferCount,
IN LPDWORD lpNumberOfBytesRecvd,
IN OUT LPDWORD lpFlags,
OUT struct sockaddr FAR * lpFrom,
IN LPINT lpFromlen,
IN LPWSAOVERLAPPED lpOverlapped,
IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
IN LPWSATHREADID lpThreadId,
OUT INT FAR *lpErrno
)
Any ideas?
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
I am trying to grab some data from my database file and display the infromation in my view window. I made a standard scrollview app and added CRecordSet (RecSet) with class wizard. Right now I have this code in my OnDraw fucntion. I am sure there is a better place to put it but I am just playing around at the moment.
long *A;
RecSet *MyRec; // the name of my class is RecSet
MyRec=new RecSet(&m_dbCust); // CDatabase *m_dbCust
MyRec ->GetDefaultConnect();
MyRec ->GetDefaultSQL();
A = &MyRec ->m_Score;
MyRec ->Close();
m_dbCust.Close();
char *B="Hi",Z[100];
pDC ->TextOut(200,200,B);
sprintf(Z,"%d",A);
pDC ->TextOut(400,200,Z);
I know the GetDefaultConnect is working and am assuming he GetdefaultSQL is as well. Do I also need the DoFieldExchange in there as well? Right now I am just trying to grab the data from any row in the Score column of my table and print it to my screen. I am using sprintf because my data is a long type and that is the only way I have got it to convert and print other long numbers to the screen in some testing. Right now it is just printing some random number as far as I can tell. Anybody willing to give me a hint as to what I am missing?
A simpleton trying to get a clue…
|
|
|
|
|
Hello, everyone!
I want to write a process monitor whose function is, when a process is terminated, I can get the process ID of the terminated process and also the application name related with this terminated process.
Are there some materials or sample codes that I can make a reference? Is it a very hard work?
Thanks in advance,
Geo
|
|
|
|
|
|
Thanks, Jörgen buddy!
I can not open the link you provide.
I have read some materials from MSDN on the topic OpenProcess and a sample program at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/perfmon/base/taking_a_snapshot_and_viewing_processes.asp
But I think it can not meet my demand quite perfectly, because the sample code only takes a snapshot of the processes of the current time. And my purpose is, I can be notified immediately when a process is being killed. Maybe I need some hook on OS?
Can you help?
Best regards,
Geo
|
|
|
|
|
George2 wrote:
I can not open the link you provide.
Sorry about that. I assumed you had the MSDN doc collection installed. :presumptious and embarrased:
George2 wrote:
And my purpose is, I can be notified immediately when a process is being killed. Maybe I need some hook on OS?
Since you get a HANDLE from OpenProcess you can use wait functions on the handle. They're listed under Platform SDK: DLLs, Processes, and Threads: Wait functions (A bit more neutral reference ).
If you wait for a process, you wait for it to die if I'm not mistaken. I have done this before, although quite a while ago. I do not know where I have the code (probably not still around since I was just playing). But I know this is the way to go.
--
They're out get me, I can't escape cos' they won't let me
They won't forget me, they'll get me in their grip and sweat me
They'll wait me out, and then move in under my skin
They'll make me doubt, they're out to make me let them in
|
|
|
|
|
Thanks, Jörgen buddy!
As you said, "I assumed you had the MSDN doc collection installed. :presumptious and embarrased", what topic or key words should I searched? Maybe I can find one MSDN doc collection from some others machine. Can I find them from Internet?
Can you help?
Best regards,
Geo
|
|
|
|
|
|
Thanks, Jörgen buddy!
Can I use Wait Functions to wait for a process (or being notified when a process is being kill immediately)? I have read this document from the link and I find it can only be used on thread (not process) context.
Best regards,
Geo
|
|
|
|
|
George2 wrote:
I have read this document from the link and I find it can only be used on thread (not process) context.
I'm not sure in what transitions of a process will trigger the wait functions. Threads within that process may trigger them, exceptional errors, etc. But, you can always check the process status using the process functions when the wait function is triggered. You can check if the process is alive or not.
As for thread context, it applies only to the calling thread I believe. Anything with a HANDLE can be monitored with a wait function - may it be a thread, process, file, or what have you.
--
They're out get me, I can't escape cos' they won't let me
They won't forget me, they'll get me in their grip and sweat me
They'll wait me out, and then move in under my skin
They'll make me doubt, they're out to make me let them in
|
|
|
|
|
Thanks, Jörgen buddy!
I will take some time looking the details of this topic. If you have got some sample codes which can meet my purpose, please share them to me.
regards,
Geo
|
|
|
|
|
Hi All
I want to write a program that can serve Dial-up Server
on win98 or winME.
can anyone show me a example or document about this.
thank you so much
|
|
|
|
|