hWnd = gethwnd(hFig)
HWnd = GETHWND retrieves the current figure (gcf)'s underlying Windows handle, thus enabling integration of Matlab GUI in C/C++/C# programs.
HWnd = GETHWND(hFig) retrieves a specific figure's underlying Windows handle. hFig is a Matlab handle, or a list of handles (not necessarily figure handle(s) - the handles' containing figure is used).
Windows-only (duh!); Java must be enabled
This code heavily relies on undocumented and unsupported Matlab functionality. It works on Matlab 7+, but use at your own risk!
Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)
Is it possible to interact with a Window Handle (HWnd) directly from Matlab.
get(HWnd) does not return anything, as Matlab is not recognizing HWnd as an object.
This would be very useful in several cases like when trying to control an external application using the COM interfaces. A good case is controlling the Google Earth Window (see http://www.mathworks.com/matlabcentral/fileexchange/20031-google-earth-com-api-example)
Fix for R2011b
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.