逆向学习-windows编程通用控件
【摘要】 title: windows编程通用控件date: 2021-08-30 20:45:34tags: - Windows - C++categories: - Windowscomments: true进度条和滑块控件运行用滑块控制进度条#include<Windows.h>#include<CommCtrl.h>#include"resource.h"INT_PTR CALLBACK Dl...
title: windows编程通用控件
date: 2021-08-30 20:45:34
tags:
- Windows
- C++
categories:
- Windows
comments: true
运行
用滑块控制进度条
#include<Windows.h>
#include<CommCtrl.h>
#include"resource.h"
INT_PTR CALLBACK Dlgproc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
SendDlgItemMessageW(hwnd, IDC_PROGRESS1,PBM_SETRANGE,0,MAKELPARAM(0,100));
SendDlgItemMessageW(hwnd, IDC_SLIDER1, TBM_SETRANGE, TRUE, MAKELPARAM(0, 100));
SendDlgItemMessageW(hwnd, IDC_PROGRESS1, PBM_SETPOS, 50, 0);
SendDlgItemMessageW(hwnd, IDC_SLIDER1, TBM_SETPOS, TRUE, 80);
break;
}
case WM_CLOSE:
{
EndDialog(hwnd, 0);
}
case WM_HSCROLL:
{
if (GetDlgItem(hwnd, IDC_SLIDER1)==(HWND)lParam)
{
int pos = SendMessageW((HWND)lParam,TBM_GETPOS,0,0);
SendDlgItemMessageW(hwnd, IDC_PROGRESS1,PBM_SETPOS,pos,0);
}
break;
}
default:
return false;
break;
}
return TRUE;
}
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd
)
{
DialogBoxW(hInstance, MAKEINTRESOURCEW(IDD_DIALOG1),NULL, Dlgproc);
return 0;
}
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)