Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is the easiest way to get Window handle value?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00051377
Message ID:
00052089
Views:
62
>George,
>
>All I was trying to do originally was to get a handle (hWnd) to a
>form that I could feed to a DLL call to point to where the display
>output of my Video Capture card was shown in...
>
>After many tries to get just a regular handle to a form/window,
>it looks like MS is not supplying that information to us for VFP.
>
>It looks like I'm going to have to try using the FoxHWnd control
>as my capture window....That will probably work....
>
>As for the SetFocus() Win32 API call, I was just using it to test if
>I had the correct Window Value...Being that that didn't work, I had
>to Get the title to see which window handle it pointed to...
>I think MS doesn't want us to get to that low of a level and just
>make everyone do OOP...
>
>
>Apparently the only valid Window handles you can get for VFP are the
>Main Window and Form windows.....All the other controls are handled
>in a different manner in VFP.....(Some kind of a bitmap thing...I don't
>know the details..)
>
>As I said before, the only call that gets the correct handle for a
>Define Window is the GetWindow call...
>
>I wonder if VBasic and VC++ are destined to go this route or what...
>
>
>Jon
>(Thanks for all your work on this issue....)
>---------------------------------------------

Jon,

I know that VB forms have the hWnd property, at least it did through version 4.0. Visual C++ is another matter, but I sure that it has access to the window handle.

Just some information regarding the control. While I don't know how exactly the DLL works, I'm sure that the reason that it needs the window handle is to get a device context. If so, then, if you need to pass the coordinates of where the image is to be drawn, if my experience with the control applies, then pass 0, 0 to get the image in the upper left hand corner of the control, rather than where on the form you want the image drawn. This may be an advantage, in that you can visually position the location and size the image rather easily.

Other concerns: If my experience with it (and the API) is applies, then you might want to set the .Enabled property to .F. I've found that if it ever gets the focus, then the image goes bye-bye. Further, you might want to set the .Visible property to .F. also if you get a "flash" at the location where the control is positioned.

I'd like to thank Vlad for his input. He sent me looking into some other API calls that I hadn't looked at before.

Finally, you're welcome, but anytime someone has a question regarding the API, I consider the research a joy, not a chore. So it was my pleasure.

George
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform