WM_MOVE 窗体移动后的位置

这是一个C++示例,演示了如何处理WM_MOVE消息来获取窗口移动后的新位置。通过创建窗口类,注册窗口类并创建窗口,然后进入消息循环,当收到WM_MOVE消息时,从LPARAM中提取坐标并显示在窗口上。
摘要由CSDN通过智能技术生成

// DEMO3_10.CPP - WM_MOVE demo

// INCLUDES ///
#define WIN32_LEAN_AND_MEAN  // just say no to MFC

#include <windows.h>   // include all the windows headers
#include <windowsx.h>  // include useful macros
#include <mmsystem.h>  // very important and include WINMM.LIB too!
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

// DEFINES

// defines for windows
#define WINDOW_CLASS_NAME "WINCLASS1"

// GLOBALS
HWND      main_window_handle = NULL; // globally track main window
HINSTANCE hinstance_app      = NULL; // globally track hinstance

// FUNCTIONS //
LRESULT CALLBACK WindowProc(HWND hwnd,
          UINT msg,
                            WPARAM wparam,
                            LPARAM lparam)
{
// this is the main message handler of the system
PAINTSTRUCT  ps;  // used in WM_PAINT
HDC

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值