I'm using a proxy DLL to intercept calls to CreateWindowExA
/CreateWindowExW
. This works quit nicely, except that some applications (most notably some Visual Basic 6 applications) seem to be able to create windows without going through either of the two functions. Tools like Spy++ are able to show the Window, but my hooked functions didn't notice them.
My first suspicion was that maybe these (old) applications use CreateWindowA
/CreateWindowW
for creating windows, but at least with my compilers (MSVC6 up to MSVC10), CreateWindow
is just a #define; the remarks section of the documentation confirms this.
My second idea was that I could maybe install a CBT hook
using SetWindowsHookEx
to detect creations of windows. However, the result is the same: this hook notices the same windows as my hooked API functions, but it doesn't notice all the windows which are visible in Spy++.
So my question is: was there maybe a time when CreateWindowA
/CreateWindowW
was not a #define, but a real function? Is this function still exported by user32.dll
, maybe for compatibility reasons? How can I get a handle on this function to hook it?
Or is there maybe some other, possibly undocumented, function which can be used to create functions, much like e.g. NtCreateProcess
can be used instead of CreateProcess
?