NO

Author Topic: using win32 resources  (Read 5531 times)

colddax

  • Guest
using win32 resources
« on: June 11, 2007, 03:35:35 PM »
Hello Everyone.

I am relatively new to gui programming with win32. I have a question about using resources with the pelles editor.

I know how to draw a progress bar using the following
Code: [Select]
hWndProgressBar = CreateWindowEx(
            0,
            PROGRESS_CLASS,
            (LPSTR)NULL,
            WS_VISIBLE | WS_CHILD| PBS_SMOOTH,
            36,     // x
            141,   // y
            100,   // width
            14,     // height
            g_Windowhandle,
            (HMENU)MainProgress,
            (HINSTANCE)GetWindowLongPtr(g_Windowhandle, GWL_HINSTANCE),
            NULL);

            if (!hWndProgressBar)
            MessageBox(NULL, "Progress Bar Failed.", "Error", MB_OK | MB_ICONERROR);


            SendMessage(hWndProgressBar, PBM_SETRANGE, 0, MAKELPARAM(0, 20));
            SendMessage(hWndProgressBar, PBM_SETSTEP, (WPARAM)5, 0);

If I were to just draw a progress bar using the pelles editor, how do I tap into it? The functions seem to want a HWND. If there some registration function I need to use?

Thanks.


lamer

  • Guest
Re: using win32 resources
« Reply #1 on: June 11, 2007, 10:08:40 PM »
Code: [Select]
//suppose elsewhere in h file
#define    DLG_MAIN           1001
#define    IDC_PROGRESS    1002

.........

//in code
hWndProgressBar =  GetDlgItem(DLG_MAIN, IDC_PROGRESS);
SendMessage(hWndProgressBar,........

//or

SendDlgItemMessage(DLG_MAIN, IDC_PROGRESS,........

colddax

  • Guest
Re: using win32 resources
« Reply #2 on: June 12, 2007, 05:18:13 AM »
Thank you very much Lamer!

That was way easier than I thought it was going to be.    ;D