mooman_fl Posted September 13, 2006 Posted September 13, 2006 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. Quote "Programmers are tools for converting caffeine into code." Madcow Inventions -- Software for the Sanity Challenged.
*Experts* Nerseus Posted September 13, 2006 *Experts* Posted September 13, 2006 I don't 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 can't remember if it's GetParentHandle or GetParentWindow or what. -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
mooman_fl Posted September 13, 2006 Author Posted September 13, 2006 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 isn't 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. Quote "Programmers are tools for converting caffeine into code." Madcow Inventions -- Software for the Sanity Challenged.
Recommended Posts