Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #1897 > unrolled thread

PBM_SETMARQUEE in VB6

Started byDeanna Earley <dee.earley@icode.co.uk>
First post2013-12-09 17:32 +0000
Last post2013-12-10 07:44 -0500
Articles 8 on this page of 28 — 9 participants

Back to article view | Back to comp.lang.basic.visual.misc


Contents

  PBM_SETMARQUEE in VB6 Deanna Earley <dee.earley@icode.co.uk> - 2013-12-09 17:32 +0000
    Re: PBM_SETMARQUEE in VB6 "Farnsworth" <nospam@nospam.com> - 2013-12-09 14:37 -0500
      Re: PBM_SETMARQUEE in VB6 Deanna Earley <dee.earley@icode.co.uk> - 2013-12-10 08:54 +0000
        Re: PBM_SETMARQUEE in VB6 "MikeD" <nobody@nowhere.edu> - 2013-12-10 05:13 -0500
          Re: PBM_SETMARQUEE in VB6 Deanna Earley <dee.earley@icode.co.uk> - 2013-12-10 10:53 +0000
            Re: PBM_SETMARQUEE in VB6 "MikeD" <nobody@nowhere.edu> - 2013-12-10 06:05 -0500
    Re: PBM_SETMARQUEE in VB6 Deanna Earley <dee.earley@icode.co.uk> - 2013-12-10 09:22 +0000
      Re: PBM_SETMARQUEE in VB6 john@jeasonNoSpam.cix.co.uk (John K.Eason) - 2013-12-12 18:03 +0000
        Re: PBM_SETMARQUEE in VB6 Deanna Earley <dee.earley@icode.co.uk> - 2013-12-16 10:33 +0000
          Re: PBM_SETMARQUEE in VB6 john@jeasonNoSpam.cix.co.uk (John K.Eason) - 2013-12-16 18:59 +0000
            Re: PBM_SETMARQUEE in VB6 Deanna Earley <dee.earley@icode.co.uk> - 2013-12-17 09:04 +0000
              Re: PBM_SETMARQUEE in VB6 john@jeasonNoSpam.cix.co.uk (John K.Eason) - 2013-12-17 19:16 +0000
                Re: PBM_SETMARQUEE in VB6 "Auric__" <not.my.real@email.address> - 2013-12-18 05:52 +0000
                Re: PBM_SETMARQUEE in VB6 "Mayayana" <mayayana@invalid.nospam> - 2013-12-18 10:07 -0500
                  Re: PBM_SETMARQUEE in VB6 Deanna Earley <dee.earley@icode.co.uk> - 2013-12-18 16:22 +0000
                    Re: PBM_SETMARQUEE in VB6 "Mayayana" <mayayana@invalid.nospam> - 2013-12-18 13:52 -0500
                      Re: Windows version numbers (was: PBM_SETMARQUEE in VB6) Deanna Earley <dee.earley@icode.co.uk> - 2013-12-19 08:57 +0000
                        Re: Windows version numbers (was: PBM_SETMARQUEE in VB6) "Mayayana" <mayayana@invalid.nospam> - 2013-12-19 09:58 -0500
                  Re: PBM_SETMARQUEE in VB6 GS <gs@somewhere.net> - 2013-12-18 12:10 -0500
    Re: PBM_SETMARQUEE in VB6 Arne Saknussemm <motz001.20.wannabet@spamgourmet.com> - 2013-12-10 11:31 +0100
      Re: PBM_SETMARQUEE in VB6 Arne Saknussemm <motz001.20.wannabet@spamgourmet.com> - 2013-12-10 11:32 +0100
        Re: PBM_SETMARQUEE in VB6 Deanna Earley <dee.earley@icode.co.uk> - 2013-12-10 10:55 +0000
          Re: PBM_SETMARQUEE in VB6 Arne Saknussemm <motz001.20.wannabet@spamgourmet.com> - 2013-12-10 12:30 +0100
    Re: PBM_SETMARQUEE in VB6 "MikeD" <nobody@nowhere.edu> - 2013-12-10 06:00 -0500
      Re: PBM_SETMARQUEE in VB6 Deanna Earley <dee.earley@icode.co.uk> - 2013-12-10 11:37 +0000
        Re: PBM_SETMARQUEE in VB6 "David Youngblood" <dwy@flash.net> - 2013-12-10 06:02 -0600
          Re: PBM_SETMARQUEE in VB6 Deanna Earley <dee.earley@icode.co.uk> - 2013-12-10 12:28 +0000
        Re: PBM_SETMARQUEE in VB6 "MikeD" <nobody@nowhere.edu> - 2013-12-10 07:44 -0500

Page 2 of 2 — ← Prev page 1 [2]


#1904

FromArne Saknussemm <motz001.20.wannabet@spamgourmet.com>
Date2013-12-10 11:32 +0100
Message-ID<20131210113234.000013a9@eternal-september.org>
In reply to#1903
> > I've just tried setting up a scrolling marquee progress bar in one
> > of my applications, and while it seems to switch into marquee mode,
> > the automatic timer (set via PBM_SETMARQUEE) either fails or is
> > ignored.
 
> just picking it out of memory <g> ... doesn't VB need to send to
> controls some message (or call some API) to tell them that we want to
> use some kinda/sorta "enhanced style" ? Sorry to be obscure but I'm
> "out of home" and I'm just trying to squeeze infos out of my poor
> brain

I was referring to

http://www.vbaccelerator.com/home/VB/Code/Libraries/XP_Visual_Styles/Using_XP_Visual_Styles_in_VB/article.asp

 

[toc] | [prev] | [next] | [standalone]


#1906

FromDeanna Earley <dee.earley@icode.co.uk>
Date2013-12-10 10:55 +0000
Message-ID<l86rvb$594$2@speranza.aioe.org>
In reply to#1904
On 10/12/2013 10:32, Arne Saknussemm wrote:
>
>>> I've just tried setting up a scrolling marquee progress bar in one
>>> of my applications, and while it seems to switch into marquee mode,
>>> the automatic timer (set via PBM_SETMARQUEE) either fails or is
>>> ignored.
>
>> just picking it out of memory <g> ... doesn't VB need to send to
>> controls some message (or call some API) to tell them that we want to
>> use some kinda/sorta "enhanced style" ? Sorry to be obscure but I'm
>> "out of home" and I'm just trying to squeeze infos out of my poor
>> brain
>
> I was referring to
>
> http://www.vbaccelerator.com/home/VB/Code/Libraries/XP_Visual_Styles/Using_XP_Visual_Styles_in_VB/article.asp

Yes, the manifest is applied and InitCommonControls has been called. I 
can see that is is using the v6/themed common controls.

-- 
Deanna Earley (dee.earley@icode.co.uk)
iCatcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored. Please reply to the 
group.)

[toc] | [prev] | [next] | [standalone]


#1909

FromArne Saknussemm <motz001.20.wannabet@spamgourmet.com>
Date2013-12-10 12:30 +0100
Message-ID<20131210123056.00007a14@eternal-september.org>
In reply to#1906
> > I was referring to
> >
> > http://www.vbaccelerator.com/home/VB/Code/Libraries/XP_Visual_Styles/Using_XP_Visual_Styles_in_VB/article.asp
 
> Yes, the manifest is applied and InitCommonControls has been called.
> I can see that is is using the v6/themed common controls.

ok, sorry for the dumb note, I was just trying to help.

As for the setmarquee, the PBS_SMOOTH and PBS_MARQUEE styles can't
co-exist, so you'll need to remove the "smooth" (which should be
the default style) bits and add the "marquee" ones

http://msdn.microsoft.com/en-us/library/bb760820%28VS.85%29.aspx

also, checking the documentation

http://msdn.microsoft.com/en-us/library/windows/desktop/bb760842%28v=vs.85%29.aspx

it sounds like the default animation interval is 30 milliseconds; you
may try increasing the interval a bit (e.g. set it to 100) to see if it
has any effect

[toc] | [prev] | [next] | [standalone]


#1907

From"MikeD" <nobody@nowhere.edu>
Date2013-12-10 06:00 -0500
Message-ID<l86s8i$pb1$1@dont-email.me>
In reply to#1897

"Deanna Earley" <dee.earley@icode.co.uk> wrote in message 
news:l84urt$67g$1@speranza.aioe.org...
> Hi all.
>
> I've just tried setting up a scrolling marquee progress bar in one of my 
> applications, and while it seems to switch into marquee mode, the 
> automatic timer (set via PBM_SETMARQUEE) either fails or is ignored.
>
> I have an appropriate visual style manifest.
> I have called InitCommonControls in the form's Initialize event.
> I am using the v5 SP2 common controls.
> The project is compiled.
> I have set the PBS_MARQUEE style and confirmed it has applied.
> The PBM_SETMARQUEE message returns 1.
>
> If I minimise and restore the window it progresses.
> If I set .Value it progresses.
> If I send PBM_STEPIT it progresses.
> If I send PBM_SETMARQUEE it sits there doing nothing.
>
> This is the same issue discussed here:
> http://www.vbforums.com/showthread.php?462116-Marquee-Progressbar
>
> Does anyone have any deeper insight as to why the VB wrapper is dropping 
> the PBM_SETMARQUEE message or the associated timer events and why I need 
> to do it "manually"?


OK.  Did you actually *start* the timer? The below code worked fine for me, 
and this was within the IDE (with a VB6.exe.manifest file). Note that I 
explicitly declared constants As Long and passed 0& for lParam in the 
SendMessage calls (because I believe it's "best practice" to do so). To be 
fair, I DID test without the constants being declared As Long and passing 0 
for lParam, and it did still work. Only other thing I can think of is that 
perhaps the timer's interval needs to match the interval set with 
PBM_SETMARQUEE.  I didn't play around with other values to see if it'd make 
a difference. Also, per the docs on MSDN, the return value for 
PBM_SETMARQUEE is always True (i.e. 1) so that's useless. I DID try this 
same code as is but WITHOUT setting the style or sending PBM_SETMARQUEE. The 
progress bar still advanced from the PBM_STEPIT message, but in the normal 
fashion rather than the marquee.

What I can deduce from this is that PBM_SETMARQUEE merely sets the mode (and 
is what the docs say). It doesn't actually "advance" or animate the progress 
though.

-----------------------------------------------------------------
Option Explicit

Private Const GWL_STYLE As Long = (-16)
Private Const PBS_MARQUEE  As Long = &H8
Private Const WM_USER  As Long = &H400
Private Const PBM_STEPIT  As Long = WM_USER + 5
Private Const PBM_SETMARQUEE  As Long = WM_USER + 10

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" 
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" 
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" 
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As 
Any) As Long
Private Declare Sub InitCommonControls Lib "comctl32" ()

Private Sub Form_Initialize()

    InitCommonControls

End Sub

Private Sub Form_Load()

    Dim Style As Long
    Style = GetWindowLong(ProgressBar1.hWnd, GWL_STYLE)
    Style = Style Or PBS_MARQUEE
    SetWindowLong ProgressBar1.hWnd, GWL_STYLE, Style
    SendMessage ProgressBar1.hWnd, PBM_SETMARQUEE, 1, ByVal 0&

    Timer1.Interval = 30
    Timer1.Enabled = True

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

    Timer1.Enabled = False

End Sub

Private Sub Timer1_Timer()

    SendMessage ProgressBar1.hWnd, PBM_STEPIT, 0, ByVal 0&

End Sub
-----------------------------------------------------------------

Mike
 

[toc] | [prev] | [next] | [standalone]


#1910

FromDeanna Earley <dee.earley@icode.co.uk>
Date2013-12-10 11:37 +0000
Message-ID<l86ue8$bv1$1@speranza.aioe.org>
In reply to#1907
On 10/12/2013 11:00, MikeD wrote:
>> Does anyone have any deeper insight as to why the VB wrapper is
>> dropping the PBM_SETMARQUEE message or the associated timer events and
>> why I need to do it "manually"?
>
> OK.  Did you actually *start* the timer? The below code worked fine for
> me, and this was within the IDE (with a VB6.exe.manifest file).

You misunderstand, the timer method works. My problem was with the 
PBM_SETMARQUEE message that runs a timer internally in the progress bar 
window/control.

I am using the extra timer as a workaround for now.

> What I can deduce from this is that PBM_SETMARQUEE merely sets the mode
> (and is what the docs say). It doesn't actually "advance" or animate the
> progress though.

At least you're seeing the same as me.
MSDN says it should animate though:
> Send the PBM_SETMARQUEE message to start or stop the animation.

This is also confirmed by the Control Spy tool from Microsoft which 
animates as expected.
https://www.dropbox.com/s/tnxb607z7uhw2zj/Marquee.png

-- 
Deanna Earley (dee.earley@icode.co.uk)
iCatcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored. Please reply to the 
group.)

[toc] | [prev] | [next] | [standalone]


#1911

From"David Youngblood" <dwy@flash.net>
Date2013-12-10 06:02 -0600
Message-ID<l86vv7$cm3$1@dont-email.me>
In reply to#1910
"Deanna Earley" <dee.earley@icode.co.uk> wrote in message 
news:l86ue8$bv1$1@speranza.aioe.org...
> On 10/12/2013 11:00, MikeD wrote:
>>> Does anyone have any deeper insight as to why the VB wrapper is
>>> dropping the PBM_SETMARQUEE message or the associated timer events and
>>> why I need to do it "manually"?
>>
>> OK.  Did you actually *start* the timer? The below code worked fine for
>> me, and this was within the IDE (with a VB6.exe.manifest file).
>
> You misunderstand, the timer method works. My problem was with the 
> PBM_SETMARQUEE message that runs a timer internally in the progress bar 
> window/control.
>
> I am using the extra timer as a workaround for now.

I tested your code on XP (without the timer) and it works as documented. I 
can change the interval via the last parameter. Only when I move the 
compiled app to Win7 it fails to animate. Your workaround may be your only 
alternative, but you may want to restrict it the later OS's as including the 
timer on XP doubles the speed.

David 

[toc] | [prev] | [next] | [standalone]


#1912

FromDeanna Earley <dee.earley@icode.co.uk>
Date2013-12-10 12:28 +0000
Message-ID<l871dc$it5$1@speranza.aioe.org>
In reply to#1911
On 10/12/2013 12:02, David Youngblood wrote:
> "Deanna Earley" <dee.earley@icode.co.uk> wrote in message
> news:l86ue8$bv1$1@speranza.aioe.org...
>> On 10/12/2013 11:00, MikeD wrote:
>>>> Does anyone have any deeper insight as to why the VB wrapper is
>>>> dropping the PBM_SETMARQUEE message or the associated timer events and
>>>> why I need to do it "manually"?
>>>
>>> OK.  Did you actually *start* the timer? The below code worked fine for
>>> me, and this was within the IDE (with a VB6.exe.manifest file).
>>
>> You misunderstand, the timer method works. My problem was with the
>> PBM_SETMARQUEE message that runs a timer internally in the progress bar
>> window/control.
>>
>> I am using the extra timer as a workaround for now.
>
> I tested your code on XP (without the timer) and it works as documented. I
> can change the interval via the last parameter. Only when I move the
> compiled app to Win7 it fails to animate.

Interesting, thanks for that.

> Your workaround may be your only alternative, but you may want to
> restrict it the later OS's as including the timer on XP doubles the
> speed.

I've removed the call to PBM_SETMARQUEE in favour of an external timer 
for now so should run at "normal" speed.

-- 
Deanna Earley (dee.earley@icode.co.uk)
iCatcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored. Please reply to the 
group.)

[toc] | [prev] | [next] | [standalone]


#1913

From"MikeD" <nobody@nowhere.edu>
Date2013-12-10 07:44 -0500
Message-ID<l872ap$ohb$1@dont-email.me>
In reply to#1910

"Deanna Earley" <dee.earley@icode.co.uk> wrote in message 
news:l86ue8$bv1$1@speranza.aioe.org...
> MSDN says it should animate though:
>> Send the PBM_SETMARQUEE message to start or stop the animation.

They do appear to suggest this, but it doesn't seem to be the case.  In any 
case, the work-around is pretty simple.

Just for grins and giggles, perhaps try creating the PB purely from API 
(IOW, CreateWindowEx). That might at least confirm if it's the 
implementation of the PB within the Windows Common Controls OCX.

I played around with it just a little bit more, and noted these things.

1.  Simply setting the style and regularly sending PBM_STEPIT also works 
(i.e. not actually ever sending PBM_SETMARQUEE).
2.  MSDN says PBM_SETMARQUEE's lParam is a UINT (unsigned integer). Since 
VB6 doesn't actually have unsigned data types, maybe that's the problem. 
That's just a WAG.


Mike
 

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.basic.visual.misc


csiph-web