我是CLR的新手,我正在阅读setWindowPos的c ++/CLI文档,并且函数定义如此.
BOOL WINAPI SetWindowPos(
_In_ HWND hWnd,
_In_opt_ HWND hWndInsertAfter,
_In_ int X,
_In_ int Y,
_In_ int cx,
_In_ int cy,
_In_ UINT uFlags
);
Run Code Online (Sandbox Code Playgroud)
我有c ++的经验,所以我理解,例如,"HWND"是数据类型,"hWnd"是变量名.
但是什么是" _ in _"和"_in_opt_"?
我猜它们是"输入变量"或其他东西的缩写.
文档中提到hWndInsertAfter是可选的.这是否意味着我可以简单地省略/不打扰在我的函数调用中将变量传递给此参数,如果我不需要?
例如
SetWindowPos(this,0,0,GetSystemMetrics(SM_CXMAXIMIZED),GetSystemMetrics(SM_CYMAXIMIZED),SWP_NOZORDER);
//Note that we're one parameter short here (the second is missing)
Run Code Online (Sandbox Code Playgroud)
(这会让我感到困惑,因为我已经看到它在其他地方写的C++不支持可选参数.只有默认参数和重载)