中年人学C语言Windows程序设计,34 进度条ProcessBar
直接上代码,
给进度条建立了一个单独的线程
#include <Windows.h>
#include <commctrl.h> //InitCommonControls
#pragma comment(lib, "comctl32") //InitCommonControls
//过程函数的返回值都是LRESULT,类型都是CALLBACK
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
BOOL procflag = TRUE;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{
HWND hwnd; //主窗口句柄,在CreateWindow中赋值
MSG msg; //消息变量,在GetMessage中使用
WNDCLASS wndclass; //窗口类
TCHAR* szAppName = TEXT("中年人学C语言Windows程序设计ProgressBar窗口实例"); //类名和窗口名
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); //窗口背景
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); //鼠标
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); //图标
wndclass.lpszClassName = szAppName; //类名
wndclass.cbClsExtra = 0