Subclassing a form

mooman_fl

Well-known member
Joined
Nov 3, 2002
Messages
193
Location
Florida, USA
I am currently writing a DLL plugin for the Dark Basic programming language. Unfortunately there is no command in this language to get the size of the main window, but I CAN get the handle of one of the controls (eg: button) on the form. I need to be able to pass this handle to my plugin DLL and use Reflection to access the properties of the main Form.

Any suggestions on how I might accomplish this? Not had to use handles before so this is new territory for me.
 
I dont know the answer directly, but maybe something here will help.
A button actually is a window to Windows. I think you use the Win API function GetParent* or GetOwner* to get the real window handle. Using that handle you can use another API to get the window size.

I put GetParent* because I cant remember if its GetParentHandle or GetParentWindow or what.

-ner
 
Actually I have another problem now. It seems that the "handle" I get is just the integer for the handle... not an IntPtr. If it was then I could use Control.FromHandle to get it I think.

The IntPtr itself isnt necessarily a problem either since I have seen a method for getting an IntPtr from and integer (not sure how effective it is for what I am trying to do). The problem comes with the fact that I am using program called "dll_tool" from someone called "the_winch" to build a new standard DLL with a string table from the .NET DLL so that it can be used as a plugin. Instancing an IntPtr in a Public Shared function causes the build to fail.

This is most likely a bug in the dll_tool... but last update from the_winch on this tool was a year ago so chances of it getting fixed might be slim. Any ideas on a possible workaround to get a grab on the main window would be appreciated.
 
Back
Top