Joerg Toellner
2009-05-07 10:09:09 UTC
wxMSW 2.9.0, MSVC 2005, WinXP SP3
Hi wxGroup,
I have the following problem which i can't solve myself after testing for
hours now, and even can't find a matching answer in the internet.
What i want to do:
I want to use a third party DLL in my own wxApp. That dll sends some windows
messages when certain events occur (WM_USER+x). I have got a sample project
for a gui from the original Author that uses that dll, but the dll itself is
closed source and i only have a compiled binary. So i have to use the dll AS
IS, right out of the box.
Crossplatform is irrelevant for me in my wx project! It's win-only!
I know how to load and use a dll in my wxApp and I also know how to receive
windows messages in wx when they are sent to my wxWindow (frame).
But i want to replace the original gui and use my own wx gui instead,
because i need to add some more whistles and bells.
The Problem is:
The exported functions of the dll have no "notifywindowhandle" parameter or
something else, where i can specify my frame handle to act as the receiver
for the dll sent messages.
I inspected the dll a bit and found out, that the dll sends the messages
with the following functionality (Pseudocode):
hdl = FindWindow(<classname of the original window>)
SendMessage(hdl, ...blah)
As you see, the classname of the original gui is fix coded in the dll. :-(
Patching the dll strings i found, that are used in the FindWindow API call,
to represent my wxApp classname looks not as an option for me.
So the only way i see is, to let my frame (or another, maybe hidden, window
that forwards the messages to my frame) mimic the windowclass of the
original gui, so that my wxFrame will be found by FindWindow in the dll.
For that i need to specify the classname of the original gui app when
creating my frame (or another window). But i can't get this to work. :-(
I saw, that the last parameter in the constructor of e.g. wxFrame is
described as "name with that the window could be referenced later", as the
documentation says. BUT, whatever i pass in this parameter i everytime get a
window of class "***@0BCDEFNR" (or something like that) when the window
appears on the screen and i inspect the properties of this window with
Spy++. :-(
Question:
Is it possible, and if so how, to create a wxWindow with a specific
classname that registers in the windows OS with that classname, so that a
WinAPI-call to FindWindow with the classname as the given parameter will
find and return the handle to it?
It would help me much, if someone could point me in the right direction.
Thank you in advance for your effort and a reply. Any hint or enlightenment
is appreciated.
Greetings
Joerg
Hi wxGroup,
I have the following problem which i can't solve myself after testing for
hours now, and even can't find a matching answer in the internet.
What i want to do:
I want to use a third party DLL in my own wxApp. That dll sends some windows
messages when certain events occur (WM_USER+x). I have got a sample project
for a gui from the original Author that uses that dll, but the dll itself is
closed source and i only have a compiled binary. So i have to use the dll AS
IS, right out of the box.
Crossplatform is irrelevant for me in my wx project! It's win-only!
I know how to load and use a dll in my wxApp and I also know how to receive
windows messages in wx when they are sent to my wxWindow (frame).
But i want to replace the original gui and use my own wx gui instead,
because i need to add some more whistles and bells.
The Problem is:
The exported functions of the dll have no "notifywindowhandle" parameter or
something else, where i can specify my frame handle to act as the receiver
for the dll sent messages.
I inspected the dll a bit and found out, that the dll sends the messages
with the following functionality (Pseudocode):
hdl = FindWindow(<classname of the original window>)
SendMessage(hdl, ...blah)
As you see, the classname of the original gui is fix coded in the dll. :-(
Patching the dll strings i found, that are used in the FindWindow API call,
to represent my wxApp classname looks not as an option for me.
So the only way i see is, to let my frame (or another, maybe hidden, window
that forwards the messages to my frame) mimic the windowclass of the
original gui, so that my wxFrame will be found by FindWindow in the dll.
For that i need to specify the classname of the original gui app when
creating my frame (or another window). But i can't get this to work. :-(
I saw, that the last parameter in the constructor of e.g. wxFrame is
described as "name with that the window could be referenced later", as the
documentation says. BUT, whatever i pass in this parameter i everytime get a
window of class "***@0BCDEFNR" (or something like that) when the window
appears on the screen and i inspect the properties of this window with
Spy++. :-(
Question:
Is it possible, and if so how, to create a wxWindow with a specific
classname that registers in the windows OS with that classname, so that a
WinAPI-call to FindWindow with the classname as the given parameter will
find and return the handle to it?
It would help me much, if someone could point me in the right direction.
Thank you in advance for your effort and a reply. Any hint or enlightenment
is appreciated.
Greetings
Joerg