Win32 C++ 将窗口位置设置为右下角
win32 c++ set window location to the right-down corner
如何将窗口设置为屏幕的右下角(不包括任务栏(?我可以使用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,但您不必这样做,因为:
创建具有扩展窗口的重叠窗口、弹出窗口或子窗口 风格;否则,此函数与创建窗口相同 功能。
相关文章:
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- 在C++/Linux中设置单调时钟的一些技巧
- 如何在选项卡视图Qt中设置一个新项目,并保存以前的项目
- 嵌套在类中时无法设置成员数据
- 需要帮助设置在C++中使用的Potrace
- 如何在自删除后将对象设置为nullptr
- 将指针设置为"nullptr"并不能防止双重删除?
- 如何在Ubuntu中使用cmake设置qt4
- ld:bind_at_load和-bitcode_bundle(Xcode设置ENABLE_bitcode=YES)不能
- 如何在boost beast http请求中设置http头
- 如何解决gcc编译器优化导致的centos双编译器设置中的分段错误
- 如何将这个C++哈希表转换为动态扩展和收缩,而不是使用硬设置的最大值
- 为什么文件名被设置为一个点,而不是在读取矢量中的文件名时
- 如何在24位SDL_Surface上设置像素的颜色
- std::设置自定义比较器
- 如何设置一个范围来提取我想要获得的信息
- Win32 C++ 将窗口位置设置为右下角
- 为什么我的角色在编码设置为 0 度时以 45 度角生成?
- 查找左上角和右下角点 (C++)
- 为 QRectF 设置左上角和右下角