View Single Post
Old 06-19-2018, 12:59 PM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,270
Default SWS ReaScript: How to pass HWND from Lua to C++: Unknown type HWND

I am trying to convert some basic windows-related C++ functions to Lua API. In particular, GetClientRect, which takes a HWND as argument.

How do I pass a HWND from Lua to a C++ function?

If I declare the function as follows, everything builds OK and and the syntax in the auto-generated API help is also correct.
Code:
bool C_GetClientRect(HWND window, int* widthOut, int* heightOut);
And in ReaScript.cpp:
Code:
APIFUNC(C_GetClientRect), "bool", "HWND,int*,int*", "window,widthOut,heightOut", ...
However, when I try to call this function, I get an error in REAPER: "Unknown type HWND".

I checked whether any other SWS functions take a HWND as parameter, and found two: BR_MIDI_CCLaneRemove and BR_MIDI_CCLaneRemove. Surprisingly, these functions also give the same "unknown type" error.

DarkStar has noticed this error back in 2016: Q4: Lua MIDI functions.
juliansader is online now   Reply With Quote