如何设置窗口到屏幕的右下角(不包括任务栏)?我能用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
);
发布于 2019-10-11 03:28:10
这是一个将窗口放置到右下角的例子。(这里我设置窗口的宽度和高度都是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函数.
相同。
https://stackoverflow.com/questions/58317635
复制相似问题