Unhandled exception at..... Access violation
-
Hi, I have a Window app from which I am doing communication to a DOS app via named pipes My method of doing this is to signal a event after I have queued the messages to the DOS app The method from which I am signaling the event is inoked via SendWindow and has and thus has a prototype LRESULT (WPARAM, LPARAM) The problem is as soon as I SIGNAL the event control is transfered When control is returned to the method which signaled the event it executes the next statement which causes an access violation listed below is the code in question
LRESULT CprogDebug::receive_tcpip(WPARAM mywparam,LPARAM mylparam)
. . . . . myeventptr->send\_window = this; myeventptr->SetEvent(); // queue message return TRUE; // <==== access violation
Thanks in Advance
-
Hi, I have a Window app from which I am doing communication to a DOS app via named pipes My method of doing this is to signal a event after I have queued the messages to the DOS app The method from which I am signaling the event is inoked via SendWindow and has and thus has a prototype LRESULT (WPARAM, LPARAM) The problem is as soon as I SIGNAL the event control is transfered When control is returned to the method which signaled the event it executes the next statement which causes an access violation listed below is the code in question
LRESULT CprogDebug::receive_tcpip(WPARAM mywparam,LPARAM mylparam)
. . . . . myeventptr->send\_window = this; myeventptr->SetEvent(); // queue message return TRUE; // <==== access violation
Thanks in Advance
Any time I see this on return, I think stack corruption.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
-
Any time I see this on return, I think stack corruption.
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
-
Not necessarily, although that could be a reason. Does it declare the access violation when you reach the return statement or when you step through the return?
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
-
in my experience it often indicates a calling convention mismatch, e.g. a stdcall/cdecl mixup. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
Only if you need to, otherwise you'd just be masking the problem.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
Not necessarily, although that could be a reason. Does it declare the access violation when you reach the return statement or when you step through the return?
Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Try to strip down your function to an absolute minimum and see if it still happens.
Visit my project: Derivative Calculator
-
Only if you need to, otherwise you'd just be masking the problem.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
Okay I think Luc Patyn is right I use LPARAM myparam as char * the string points to string returned by TCP/IP from the server machine Thanks
thank you for all those who pointed me to the stack that is indeed were the problem was I had declared a CString as local/stack variable and and it was a long string I moved it outside of the function global and okay two question come to mind 1) how would I increase the stack if I needed it 2) using the new operator on the CString would seem to also alivate the problem as that would allocate the string on the heap thanks again