Author Topic: Win32: Returning from a window procedure  (Read 18539 times)

nobody

  • Guest
Win32: Returning from a window procedure
« on: October 06, 2004, 08:52:27 PM »
Hello,
I have a problem returning from a window procedure. I have debugged the proc, and it comes all the way to the return.
I have tried ret, retn, retf and even iret, but none of them work, do any og you know why my application crashes there?
ps. I have tried using DefWindowProc. That worked fine, except i can't do anything then...

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Win32: Returning from a window procedure
« Reply #1 on: October 07, 2004, 06:42:12 PM »
We'll probably have to see the code...

"iret" and "retf" would be wrong, "ret" and retn" are aliases... if this is "stdcall" (the usual convention with Windows), you'd want "ret N", where N is the number of bytes of parameters on the stack - 4 times the number of parameters. An error here would cause a crash later, though - not right at the "ret". The most likely cause of that is not having the stack back to the condition it was in when the function was entered. If you've created a stack frame, you'll have to "unwind" it first - a matched "enter" and "leave" ought to do it.

...we'll probably have to see the code...

Best,
Frank