Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

"Programmers are tools for converting caffeine into code."

 

Madcow Inventions -- Software for the Sanity Challenged.

  • *Experts*
Posted

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

"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
Posted

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.

"Programmers are tools for converting caffeine into code."

 

Madcow Inventions -- Software for the Sanity Challenged.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...