PBS_MARQUEE Progressbar WinApi

I am trying to get a progress bar of type PBS_MARQUEE. I can create a progress bar, but I just can't control it to keep it moving.

If you find this, but I do not understand what I should do:

"It turns out that since I had a progress bar as a resource instead of using CreateWindowEx (..), I had to use SetWindowLongPtr (..) to set the PBS_MARQUEE style for this control ..."

I create a progress bar as follows:

   hwndPB = CreateWindowEx(0, PROGRESS_CLASS,
                            (LPSTR)NULL, WS_CHILD | WS_VISIBLE | PBS_MARQUEE ,
                            rcClient.left,
                            rcClient.bottom - cyVScroll,
                            rcClient.right, cyVScroll,
                            hwnd, (HMENU) 0, NULL, NULL);

Then I try to make it work:

    SetWindowLongPtr(hwndPB,GWL_STYLE,PBS_MARQUEE);
    SendMessage(hwndPB,(UINT) PBM_SETMARQUEE,(WPARAM) 1,(LPARAM)NULL );

thanks and considering

+5
source share
1 answer

The problem is that you are erasing the window style. The error is the line:

SetWindowLongPtr(hwndPB,GWL_STYLE,PBS_MARQUEE);

PBS_MARQUEE, , , .

:

LONG_PTR style = GetWindowLongPtr(wndPB, GWL_STYLE);
SetWindowLongPtr(hwndPB, GWL_STYLE, style | PBS_MARQUEE);

++, , , , , !

, CreateWindowEx(), , .


, . v6? marquee v6 .

, , , stdafx.h:

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

, Win32 Visual Studio:

HWND hwndPB = CreateWindowEx(
    0, PROGRESS_CLASS, (LPCWSTR)NULL,
    WS_CHILD | WS_VISIBLE | PBS_MARQUEE,
    0, 0, 400, 100,
    hWnd, (HMENU) 0, hInst, NULL
);
SendMessage(hwndPB,(UINT) PBM_SETMARQUEE,(WPARAM) 1,(LPARAM)NULL);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);

, v6 comctl32, .

+5

All Articles