Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 24 NOV 2006 01:43:16PM W Shepard wrote:

When one call CreateEngine to connect to a remote engine and the engine is not available, CreateEngine creates a local engine and returns an error code of 3. However it does not populate the engine variable with the identity of the local engine. It would be nice if it did, because without it, it is impossible to use or get rid of the local engine that it created. Does anyone know a good way to locate the orphaned engine programmatically, get it's handle and destroy it? I'm sure it involves calling Windows DLLs.


At 27 NOV 2006 05:12AM [email protected] wrote:

You need to do a little playing about if you want to accomplish this, but just a little.

You want to set the text of the current engine that you have running to something other than "OpenEngine". Then, when you do the find window, you can differentiate them by passing in the title name.

pre.code {

background-color: #E5E5E5;
border: 1px solid #000000;
width: 640px;
padding: 5px;
font-family: courier, verdana, arial, serif;
margin: 0px 10px auto;

}

newTitle=This is not the engine you are looking for" : \00\
call winapi_setwindowtext( currentHandle, newTitle )
newOEhandle=winapi_findWindow( 'AREV':\00\, 'OpenEngine': \00\ )

You might need to modify your findWindow prototype. The one I had on my system used a VOID for the second parameter, so I added a new delcaration type in DLL_USER32

pre.code {

background-color: #E5E5E5;
border: 1px solid #000000;
width: 640px;
padding: 5px;
font-family: courier, verdana, arial, serif;
margin: 0px 10px auto;

}

HANDLE STDCALL FindWindowA(LPCHAR,LPChar) AS winAPI_findWindow

so I didn't set on the toes of existing routines.

[email protected]

The Sprezzatura Group Web Site

World Leaders in all things RevSoft


At 27 NOV 2006 11:19AM W Shepard wrote:

Good technique. And it's working fine, except for one thing. The DestroyWindow call is not destroying the window. It returns 0 and the call to GetLastError also returns 0.

In DLL_USER32, I prototyped DestroyWindow as

LONG STDCALL DestroyWindow(HANDLE)

In DLL_KERNEL32, I prototyped GetLastError as

LONG STDCALL GetLastError(VOID)

Is OpenEngine set to not respond to the destroy messages?

Wayne


At 28 NOV 2006 09:02AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

Wayne,

The DestroyWindow() API call will not let you destroy a window created by another thread.

You could try sending a WM_CLOSE message to the window to ask it to close, which should internally call DestroyWindow().

The Sprezzatura Group

World leaders in all things RevSoft

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/30d8c5af7f297414852572300066d6ac.txt
  • Last modified: 2024/01/04 20:57
  • by 127.0.0.1