LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to get an example working, using User32:SendMessage

Hi, My ultimate goal is to get a (non-IMAQ) video-overlay working with avicap32.  I found a VB example that does it but that example is making calls to User32:SendMessage.  So I'm trying to get a simple example of calling SendMessage to work. 

 

I've attached an example VI which tries to use SendMessage to retrieve the window bounds of the example VI. The example allocates a pointer to 16 bytes (four "longs") needed for window "RECT" values.  By default, the diagram calls SendMessage which does appear to populate the destination array - but the values are not right.  I say they are not right because:

- they are typically way too big

- they don't change when the window bounds change

- they do change, occasionally, even though the window bounds haven't changed

To me they the values look like pointers, though that's just a guess.

 

Any help is appreciated!

 

(P.S. The prototypes for LabVIEW.dll function are found in extcode.h)

0 Kudos
Message 1 of 5
(3,297 Views)

I see the same behavior running your VI no matter where the window actually is. I can't say for sure that EM_GETRECT message isn't working correctly, but according to this:

 

https://msdn.microsoft.com/en-us/library/windows/desktop/bb761596(v=vs.85).aspx

 

EM_GETRECT seems to return the bounding rectangle of an edit control rather than the bounds of the window. Are you sure it should be returning the bounds of the entire window?

 

Can you post the VB example that you're working off of?

 

Message 2 of 5
(3,235 Views)

Try GetWindowRect

 

George Zou
0 Kudos
Message 3 of 5
(3,232 Views)

Thanks elcaverado,

You may be right about EM_GETRECT applying to "edit-controls" and not a Window.

If that's the case, I need to find another simple message. At this point, I only want to verify my ability to call SendMessage and get some expected results.  Eventually I'll use the message WM_CAP_DRIVER_GET_CAPS  to retrieve "CAPDRIVERCAPS" structure in order to check its "fHasOverlay" property.  The VB links are on my home-PC - will send them later. 

 

https://msdn.microsoft.com/en-us/library/windows/desktop/dd757677(v=vs.85).aspx

https://msdn.microsoft.com/en-us/library/windows/desktop/dd797949(v=vs.85).aspx 

 

Hi George,

Thanks, though, I'm not so much interested in this specific message as I am in demonstrating the ability to use SendMessage.

0 Kudos
Message 4 of 5
(3,224 Views)

Hi elcalverado,

here's the VB link:

http://www.ganshani.com/?s=avicap

Actually they are doing video capture, where I'm interested in doing an overlay.

Just came across this - which will help save time!

https://forums.ni.com/t5/Example-Program-Drafts/Video-for-Windows-avicap32-dll/ta-p/3491285

0 Kudos
Message 5 of 5
(3,216 Views)