1. Funny mistake
- Posted by Ian Burleigh <igb at HOME.COM>
Jan 05, 1999
-
Last edited Jan 06, 1999
Initially the code was:
----------------------------------------------------------------------------
---
constant
iDestroyWindow = define_c_func(g_user32,"DestroyWindow",{C_POINTER},C_INT)
global function DestroyWindow(atom hwnd)
return c_func(iDestroyWindow,{hwnd})
end function
...
atom r
r = DestroyWindow(hFrameWnd)
...
----------------------------------------------------------------------------
---
Then I realised that I never check the value returned by DestroyWindow, so
I changed the function to a procedure to spare me the trouble with trashing
the retrun value:
----------------------------------------------------------------------------
---
constant
iDestroyWindow = define_c_proc(g_user32,"DestroyWindow",{C_POINTER})
global procedure DestroyWindow(atom hwnd)
return c_proc(iDestroyWindow,{hwnd})
end procedure
...
DestroyWindow(hFrameWnd)
...
----------------------------------------------------------------------------
---
The code still run but evidently worked not. It was not destroying the window.
Silly mistake.
Ian
2. Re: Funny mistake
Ian Burleigh writes:
> global procedure DestroyWindow(atom hwnd)
> return c_proc(iDestroyWindow,{hwnd})
> end procedure
> The code still run but evidently worked not.
> It was not destroying the window.
Your bug is very hard to see because of the way you indented
your code. Had you indented differently it would have been
clear what's going on:
global procedure DestroyWindow(atom hwnd)
return
c_proc(iDestroyWindow,{hwnd})
end procedure
In a function there must be an expression after "return",
but in a procedure there is no expression, just "return".
Regards,
Rob Craig
Rapid Deployment Software
http://members.aol.com/FilesEu/