News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Adventures in programming: Treeviews, directory scanning, recursion

Started by NoCforMe, April 05, 2024, 10:36:19 AM

Previous topic - Next topic

NoCforMe

But it looks like you're using PBM_SETPOS, not PBM_SETMARQUEE. So how does that help me?
Assembly language programming should be fun. That's why I do it.

TimoVJL

Minimal example in C
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commctrl.h>
// https://stackoverflow.com/questions/30135497/pbm-setmarquee-is-not-working-for-vertical-processbars
#define DLG_MAIN 1001
#pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

LRESULT CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

INITCOMMONCONTROLSEX initCtrlEx = {sizeof(INITCOMMONCONTROLSEX), ICC_PROGRESS_CLASS};
HWND hProcessBar;

int __cdecl WinMainCRTStartup(void)
{
    HINSTANCE hInstance = GetModuleHandle(NULL);
    InitCommonControlsEx(&initCtrlEx);
    ExitProcess(DialogBoxParam(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)MainDlgProc, 0));
}

LRESULT CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_INITDIALOG:
            hProcessBar = GetDlgItem(hwndDlg, 4001);
            SendMessageA(hProcessBar, PBM_SETMARQUEE, TRUE, (LPARAM)30);//enable marquee mode
            return TRUE;
        case WM_CLOSE:
            EndDialog(hwndDlg, 0);
            return TRUE;
    }
    return FALSE;
}
May the source be with you

NoCforMe

1. That tells me nothing I don't already know or that isn't already in my code. Absolutely nothing.
2. Dang it, don't you ever post assembly-language code? Sheesh; this is an asm forum, you know?
Assembly language programming should be fun. That's why I do it.

six_L

Hi,NoCforMe
QuotePBS_MARQUEE
   Version 6.0 or later. The progress indicator does not grow in size but instead moves repeatedly along the length of the bar, indicating activity without specifying what proportion of the progress is complete.
Note: Comctl32.dll version 6 is not redistributable but it is included in Windows or later. To use Comctl32.dll version 6, specify it in a manifest. For more information on manifests, see Enabling Visual Styles.
+manifest.xml to rc
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="*"
    name="CompanyName.ProductName.YourApplication"
    type="win32"
/>
<description>Your application description here.</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="*"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>
.elseif eax == WM_TIMER
.if pFlag == TRUE
;off
invoke  SendDlgItemMessage, hMain, ID_PROGRESS,PBM_SETMARQUEE,FALSE,0
mov pFlag,FALSE
.else
;on
invoke  SendDlgItemMessage, hMain, ID_PROGRESS,PBM_SETMARQUEE,TRUE,0
mov pFlag,TRUE
.endif

regard

Say you, Say me, Say the codes together for ever.

NoCforMe

1. I already said somewhere up there that I already have a manifest included as a resource.
2. I'm curious about the code you posted: Why are you putting the calls to PBM_SETMARQUEE inside a WM_TIMER handler? Are you saying you have to set up a timer to run the progress bar? My understanding is that all you need to do is to send that message with wParam = TRUE and the control takes care of the animation all on its own. Or is that not correct?

This is from the Microsoft documentation for that message:
QuoteSets the progress bar to marquee mode. This causes the progress bar to move like a marquee.

Parameters:
wParam
Indicates whether to turn the marquee mode on or off.
lParam
Time, in milliseconds, between marquee animation updates. If this parameter is zero, the marquee animation is updated every 30 milliseconds.

Use this message when you do not know the amount of progress toward completion but wish to indicate that progress is being made.
Notice it doesn't say anything about having to constantly toggle the control to make it move; the PBM_SETMARQUEE(TRUE) message is supposed to be sufficient to animate it.
Assembly language programming should be fun. That's why I do it.

TimoVJL

Quote from: NoCforMe on April 20, 2024, 03:35:03 PM1. That tells me nothing I don't already know or that isn't already in my code. Absolutely nothing.
2. Dang it, don't you ever post assembly-language code? Sheesh; this is an asm forum, you know?
pFile    Data    Description    Value
00001F9C    0000360A    Hint/Name RVA    0005 CreateStatusWindowA
00001FA0    00003630    Hint/Name RVA    0031 ImageList_Create
00001FA4    00003620    Hint/Name RVA    002C ImageList_Add
00001FA8    00000000    End of Imports    comctl32.dll
May the source be with you

NoCforMe

OK, I'm curious: is that from my .exe? What's that supposed to tell me? I recognize those 3 functions that are in my program. Is that everything imported from comctl32.dll? Is something missing?
Assembly language programming should be fun. That's why I do it.

TimoVJL

May the source be with you

NoCforMe

Not needed.
That initialization is done by the dialog manager.
Just for laughs, I put it in just now and tried it. Made no damn difference. Progress bar still doesn't animate.
I stopped using that (InitCommonControlsEx) a long time ago.
Assembly language programming should be fun. That's why I do it.

sinsi

All of these theories, wouldn't it be good if we had some source code... :rolleyes:
🍺🍺🍺

jj2007

Quote from: NoCforMe on April 20, 2024, 01:02:34 PMBut it looks like you're using PBM_SETPOS, not PBM_SETMARQUEE

Oops, that's right - the timer handler with PBM_SETPOS is no longer necessary :thumbsup:

Quote from: NoCforMe on April 20, 2024, 03:52:03 PMWhy are you putting the calls to PBM_SETMARQUEE inside a WM_TIMER handler? Are you saying you have to set up a timer to run the progress bar? My understanding is that all you need to do is to send that message with wParam = TRUE and the control takes care of the animation all on its own

Your understanding is correct. Strangely enough, I can see the effect of PBM_SETMARQUEE in spite of the timer handler, but the latter can definitely go. It seems that I simulated the marquee effect with the timer...

NoCforMe

Here it is. Go to it, tear it apart. Complete package attached.
Assembly language programming should be fun. That's why I do it.

NoCforMe

Quote from: jj2007 on April 20, 2024, 05:56:38 PM
Quote from: NoCforMe on April 20, 2024, 01:02:34 PMBut it looks like you're using PBM_SETPOS, not PBM_SETMARQUEE
Oops, that's right - the timer handler with PBM_SETPOS is no longer necessary :thumbsup:
Which gets us back to what six_l posted above: is it necessary to put the PBM_SETMARQUEE message call in a timer handler like he did? Again, the Micro$oft docs say nothing at all about this.
Assembly language programming should be fun. That's why I do it.

sinsi

A couple of things, the open folder dialog shows a blank list and doesn't like being resized (see pic)
The second, a bit more serious
(37f4.461c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=6e020f93 ebx=6e020f93 ecx=0003ba50 edx=00000000 esi=00a21145 edi=001404a2
eip=00a235bb esp=006fedd0 ebp=006fedd8 iopl=0        nv up ei pl nz na pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b            efl=00210206
PicView!PruneFileList+0x5b:
00a235bb f7831401000010000000 test dword ptr [ebx+114h],10h ds:002b:6e0210a7=????????

; Prune back the chain until we find a folder w/pictures:
    MOV    EAX, [EBX].FILEINFO.parent
    TEST    EAX, EAX            ;Hit the root?
    JZ    next                ;  Yep, go to next prev. entry.
    ADD    EAX, FileHeap
    MOV    EBX, EAX
    TEST    [EBX].FILEINFO.flag, $keep ;<<<<<< crash <<<<<<



🍺🍺🍺

six_L

Hi,NoCforMe
QuoteWhy are you putting the calls to PBM_SETMARQUEE inside a WM_TIMER handler?
show you the effect of ProgressBar with PBS_MARQUEE style again and again.

1) toggle the control to make it move.
invoke  SendDlgItemMessage, hMain, ID_PROGRESS,PBM_SETMARQUEE,TRUE,0

2) toggle the control to make it stop.
invoke  SendDlgItemMessage, hMain, ID_PROGRESS,PBM_SETMARQUEE,FALSE,0
the attachment is the demo exe(x64).
regard.
Say you, Say me, Say the codes together for ever.