Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / How do you programmatically close a non-dbpro window with dbpro?

Author
Message
DrT
15
Years of Service
User Offline
Joined: 10th May 2008
Location: 26.78 degrees North, -70.49 degrees West
Posted: 10th May 2008 19:54
I would like to programmatically close a non-dbpro window with dbpro.

I have tried each of the following:
call dll user32.dll DestroyWindow
call dll user32.dll SendMessage
BlueGUI's createGadgetFromWindow then deleteGadget

I have resorted to calling a separate executable which uses AutoIT's winKill function. Although functional, I would like to code it within dbpro.

Any suggestions would be greatly appreciated?
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 11th May 2008 01:20
When you used SendMessage, which message did you send? SendMessage waits until the window receiving the message returns from the message handler before returning to the caller. PostMessage just queues the message, and returns to the caller immediately. You might want to use PostMessage.

Anyway, WM_CLOSE is a graceful alternative to calling DestroyWindow directly like you are doing. I would try PostMessage...WM_CLOSE, which is equivalent to what a menu might do in the same situation, and allows the message to enter in the normal fashion at the appropriate place in the message handling scheme.

Hope that helps.
DrT
15
Years of Service
User Offline
Joined: 10th May 2008
Location: 26.78 degrees North, -70.49 degrees West
Posted: 11th May 2008 03:14
It sure did. Thanks for your help Jinzai.

Login to post a reply

Server time is: 2024-02-28 03:53:54
Your offset time is: 2024-02-28 03:53:54