Is that what you use?
Any idea on why the style does not show for the progress bar?
Here is the cpp file also
Code:
#include <windows.h>
#include <commctrl.h>
#include "progress_bar.h"
#define length 100000
//---------------------------------------------------------------------------
HWND hWnd;
HINSTANCE hInst;
LRESULT CALLBACK DlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
HWND hwndpb;
//---------------------------------------------------------------------------
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
hInst = hInstance;
INITCOMMONCONTROLSEX InitCtrlEx;
InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitCtrlEx.dwICC = ICC_PROGRESS_CLASS;
InitCommonControlsEx(&InitCtrlEx);
DialogBox(hInst, MAKEINTRESOURCE(IDD_CONTROLS_DLG),
hWnd, reinterpret_cast<DLGPROC>(DlgProc));
return FALSE;
}
//---------------------------------------------------------------------------
LRESULT CALLBACK DlgProc(HWND hWndDlg, UINT Msg,
WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
case WM_INITDIALOG:
hwndpb = CreateWindowEx(0, PROGRESS_CLASS, NULL,
WS_CHILD | WS_VISIBLE | PBS_SMOOTH ,
20, 20, 260, 17,
hWndDlg, (HMENU)IDC_PROGBAR, hInst, NULL);
return TRUE;
case WM_COMMAND:
switch(wParam)
{
case IDLOAD:
{
int pb_pos;
SendMessage(hwndpb, PBM_SETRANGE, 0, MAKELPARAM(0, length ));
while(pb_pos <= length)
{
pb_pos = SendMessage(hwndpb, PBM_GETPOS, 0, 0);
pb_pos++;
SendMessage(hwndpb, PBM_SETPOS, pb_pos, 0);
}
return TRUE;
}
break;
case IDCANCEL:
{
DestroyWindow(hwndpb);
EndDialog(hWndDlg, 0);
return TRUE;
}
break;
}
}
return FALSE;
}