#include <windows.h>
#include <commctrl.h>
#include "resource.h"
#pragma comment( lib, "comctl32.lib" )
BOOL __stdcall DlgProc( HWND, UINT, WPARAM, LPARAM );
int __stdcall WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int )
{
::InitCommonControls();
::DialogBoxParam(
hInstance,
(LPCTSTR)IDD_DIALOG1,
NULL,
DlgProc,
NULL
);
return 0;
}
//http://www.pythonschool.com
BOOL __stdcall DlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
switch( message )
{
case WM_INITDIALOG:
{
HWND hWndProgress = ::GetDlgItem( hDlg, IDC_PROGRESS1 );
::SendMessage( hWndProgress, PBM_SETRANGE, 0, MAKELPARAM(0, 100) );
::SendMessage( hWndProgress, PBM_SETSTEP, 1, 0 );
::SendMessage( hWndProgress, PBM_SETBKCOLOR, 0, RGB(0, 0, 0xff) );
::SendMessage( hWndProgress, PBM_SETBARCOLOR, 0, RGB(0xff, 0, 0) );
}
break;
case WM_COMMAND:
{
switch( LOWORD( wParam ))
{
case IDOK:
{
UINT proPos;
do
{
proPos = ::SendMessage( ::GetDlgItem(hDlg, IDC_PROGRESS1), PBM_GETPOS, 0, 0 );
::SendMessage( ::GetDlgItem(hDlg, IDC_PROGRESS1), PBM_STEPIT, 0, 0 );
Sleep(100);
} while ( proPos < 99 );
proPos = 0;
}
break;
case IDCANCEL:
::EndDialog( hDlg, IDCANCEL );
break;
}
}
break;
}
return 0;
}
http://www.pythonschool.com/
进度条
最新推荐文章于 2021-05-24 08:27:40 发布