How to call the function GetWindowRect of Windows API in matlab
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, everyone! I want to get the screen position of a program outside the Matlab. I found the GetWindowRect function in windows API could help me finish that. The introduction of this function from msdn is shown below: https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getwindowrect.
In addition, I have got another very nice work which has accomplished some relevant function: https://uk.mathworks.com/matlabcentral/fileexchange/49149-matlab-loadlibrary-user32-dll-for-windows-functions-in-one-class?s_tid=prof_contriblnk
The problem is that I cannot convert the simple struct datatype in the matlab to the C struct LPRECT in GetWindowRect funtion parameters. I tried the following code using libstruct
RECT.left = int32(0);
RECT.top = int32(0);
RECT.right = int32(0);
RECT.bottom = int32(0);
RECT1 = libstruct('_RECTL',RECT);
calllib('WinUser32Lib', 'GetWindowRect', WHand, RECT1);
% Load System Library Procedure Starts above...
% BOOL GetWindowRect(hWnd, LPRECT);
fcns.name{4} = 'GetWindowRect';
fcns.calltype{4} = 'cdecl';
fcns.LHS{4} = 'voidPtr';
fcns.RHS{4} = {'voidPtr','voidPtr'};
% Initiating Function Call Parameter Mapping above...
It still doesn't work, and I really need for your help!
0 comentarios
Respuestas (1)
TIAN ZHU
el 26 de Feb. de 2022
Hi, I also encountered the same problem. How did you solve it?
0 comentarios
Ver también
Categorías
Más información sobre Package MATLAB Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!