Jump to content

How to call user32.dll:GetWindowRect? (and why I need to)


Recommended Posts

Hello there,

I have a tricky problem I'm hoping somebody might be able to help me with...

I have a vi which runs as a child window within another vi window which I created using the SetParentWindow() method in user32.dll. This works great. The result is as in the image below where the excel document exists as a child window within Excel:

post-13935-0-01723300-1318446447.png

I then use a property node to check the child panel bounds. This works fine normally. However, if I move the parent window (and hence the child window within it) then the child's panel bounds are not updated, which they should as they reflect global screen coordinates. If I move the child window just a smidgen then the child panel bounds are correctly updated to reflect the actual global position of the child.

(I'm happy the property node doesn't update in my scenario, it's just I need a solution)

I thought a way round this would be to get the size of the child window by using a windows api call instead. So, I'd like to use the the user32 GetWindowRect() method. However, I am not sure how to set up the main part of the call, namely the RECT structure pointer - I've done basic dll calls before but I've not passed in a pointer and I don't know how to create a structure of the right type. I have the window handle ready to pass in.

If anybody can help me set this up it would be fantastic. I will keep trying myself and post back if I figure it out as well.

Below is a screenshot of the setup:

post-13935-0-29408200-1318446311.png

Thank you,

Martin

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...

Important Information

By using this site, you agree to our Terms of Use.