In short, what can you do about PostMessage returning ERROR_INVALID_WINDOW_HANDLE when the window handle used was the right one?

Code included, but the only thing wrong is windows returning failure.. the window is found properly.



__________
I've done a bunch of debugging, after learning how to use the debugger I fixed some logic errors in my code.

I found that everything is working now up untill postmessage. PostMessage returns with 0 indicating failure. I soon found out that I could use GetLastError to find out what went wrong. It returned with 578 (1400 decimal) which means:

1400 Invalid window handle. ERROR_INVALID_WINDOW_HANDLE

How could it be invalid? FindWindow returned with 2c05a8 with Findwindow using SciCalc & Calculator (class and title respectively). After using icz-lesson 24's mouse hook tool i found out that that is the right handle.

Debugging is actually kind of fun.. soon starts to suck when you dont know how to fix your problem ..

Thanks.
Posted on 2001-12-06 18:39:52 by matthew
:)

matthew, you prog's ok except this little error you made...



PostMessage addr hCalc,....


look in you api-ref and you'll see that SendMessage don't
need a pointer to a pointer that points to the Window :) , it
needs a clear value not a memory reference so cut that
addr...

good look further one...
Posted on 2001-12-06 20:06:49 by mob
Thank you SOOO much!! Works great now, I can close calculator without pressing :) But it was only a proof of concept type program :) That fact totally eluded me, even though i did notice
that it was passing the memory location instead of the actual handle... guess i didnt notice it wasnt a pointer.. live and learn...

:) ;) :>


Thank you!
Posted on 2001-12-06 21:24:41 by matthew