如何在屏幕的右下角设置一个窗口(不包括任务栏)?我可以用CreateWindowEx完成它吗?但是我只看到CW_USEDEFAULT,没有CW_可以将其设置在角落。
HWND hwnd = CreateWindowEx(
NULL,
DUCKPROC_CLASS_NAME,
DUCKPROC_WINDOW_TIP_NAME,
WS_BORDER| WS_VISIBLE,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
GetModuleHandle(NULL),
NULL
);
这是将窗口置于右下角的示例。(在这里,我将窗口的宽度和高度都设置为200。)
RECT desktopRect;
if (!GetWindowRect(GetDesktopWindow(), &desktopRect))
return FALSE;
int windowWidth = 200;
int windowHeight = 200;
int posX = desktopRect.right - windowWidth;
int posY = desktopRect.bottom - windowHeight;
HWND hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
posX, posY, windowWidth, windowHeight, nullptr, nullptr, hInstance, nullptr);
您可以使用CreateWindowEx,但不必这样做:
创建具有扩展窗口样式的重叠窗口,弹出窗口或子窗口;否则,此函数与CreateWindow函数相同。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句