I have experienced with FindWindow() and PostMessage() without problems for a while until I decided to "find" and "quit" a Visual Basic made Window...

The problem was that I was unable to find the right "ClassName" for FindWindow() and so I got no valid handle value.

Briefly, I found the appropriate strings, and realized 3 prgms; the first destroy VB6 windows, the second VB.NET windows and the last is in VB6 itself.

It would be interesting to experiment further, for example, sending WM_NCDESTROY messages to every VB class window around...but remember that you should wait till the message has been received and processed by the target window before sending it to another....

I hope it can be useful for educational purposes.

Posted on 2003-05-28 11:36:51 by fooCoder
Hey fooCoder.
If you want to work with VB applications you should know:
All of them use the classname that starts with Thunder, since it was the code name for VB whten it was first being developed at Microsoft.

Depending on the version of VB you are using, ThundedRT5 or ThunderRT6 can be prepended to the class name. The letters in RT# denote the word "runtime", and the number denotes the version of VB. The number is not added for versions of VB earlier than 5. Also when running in the IDE, there is no RT#, just the word Thunder.
Subclassing & Hooking wti Visual Basic by Stepben Teilbet

The caption of your window should be to the left of ThunderRT6FormDC. ThunderRT6FormDC is the name of the class from which thish form was created. Any form that your application creates will be created from this class and will be considered a parent window. Any VB-intrinsic control class will be prepended with the word ThunderRT#. Hence, a command button would be called ThunderRT6CommandButton in version 6 of VB.

Sorry, I didn't work with VB.NET applications yet, so I'm not able to tell how their classes are called and why.
By the was the book, from which I used the quotes is pretty nice book if you want to learn about sublacssing and hooking, as well it explains how os messagins system works in details
Posted on 2003-05-28 22:08:13 by masnick[CCCP]
Thank you masnick!!!

I guessed the name of VB window classes by using Spy++ which is shipped with Visual Studio 6 and Visual Studio .NET.

Soon I will check the class name of C# windows....:)

Posted on 2003-05-29 09:59:06 by fooCoder
That is what I thought when you wrote that you found strigs for VB6 and VB.NET. It is the first program that is described in Subclassing and Hooking book.
Posted on 2003-05-29 17:23:51 by masnick[CCCP]