VC + + progress bar Process Bar Usage Example _c language

Source: Internet
Author: User
Tags set background

The example of this article tells the VC progress bar Usage example, shares for everybody reference. The specific implementation code is as follows:

Copy Code code as follows:
#include <Windows.h>
#include "resource.h"
#include <Commctrl.h>
dialog box functions
INT_PTR CALLBACK DialogProc (
__in HWND Hwnddlg,
__in UINT umsg,
__in WPARAM WPARAM,
__in LPARAM LPARAM
)
{
Switch (umsg)
{
Case WM_INITDIALOG:
{
Initializing progress bar controls
HWND hwndprocess =:: GetDlgItem (Hwnddlg, IDC_PROGRESS1);
Set Range (0, 100)
:: SendMessage (hwndprocess, Pbm_setrange, 0, Makelparam (0, 100));

Set Step size
:: SendMessage (Hwndprocess, Pbm_setstep, 2, 0);
Set Background color
:: SendMessage (hwndprocess, Pbm_setbkcolor, 0, RGB (0,0,0xff));
Set progress bar Color
:: SendMessage (hwndprocess, Pbm_setbarcolor, 0, RGB (0xff,0,0));

}
Break
Case WM_COMMAND:
{
Switch (LOWORD (wParam))
{
Case IDOK:
{
Increase the progress value and increase the value of the step that was set earlier
:: SendDlgItemMessage (Hwnddlg, Idc_progress1, pbm_stepit, 0, 0);
}
Break
Case IDCANCEL:
:: EndDialog (Hwnddlg, IDCANCEL);
return 0;
}
}
Break
}
return 0;
}

int WINAPI WinMain (
__in hinstance HInstance,
__in hinstance hPrevInstance,
__in LPSTR lpCmdLine,
__in int nCmdShow
)
{
::D Ialogboxparam (HINSTANCE, (LPCTSTR) idd_main, NULL, DIALOGPROC, NULL);

return 0;
}

I hope this article will help you with VC + + program design.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.