In Windows 7, there was a remarkable thing - indication of progress on the taskbar button. To use this feature on VB6 (and any other language) you need to create an object TaskBarList, get ITaskBarList3 interface and use its methods - SetProgressState and SetProgressValue. In my module, I added the ability to set the state of the progress bar on the taskbar, and duplicated this indicator on the form itself + added ability to use animated icons in the form header (also supported by the usual icons). From this example, you can learn how to draw the non-client area of the window, make buttons that are highlighted when hovering. The example uses double buffering, so everything works smoothly and without flicker. This module can be connected to any project with any forms.
Functions: SetNCSkin - set new style window; RemoveNCSkin - remove style from window; SetIcon - set animated (or simple) icon to window; PlayAnimation - enable playing icon animation; StopAnimation - stop animation playing; SetProgressState - set state of taskbar button; GetProgressState - get state of taskbar button; SetProgressValue - set value of progressbar in the taskbar button (0..1); GetProgressValue - same, only get a value.
Thanks for the link to the working project - I'll definitely check that out too. Not only for the progress bar code but for the music generation portion. I'm a musician and have a side app I've been working with slowly over the years - I may be able to borrow some ideas from you in that area as well.
I'm scratching my head trying to understand this though... you frequently use GetMem4 ByVal GetWindowLong(hwnd, GWL_USERDATA) + 34, stat
This is used like it's referring to the ButtonState... but why is it seemingly taking 2 bytes of empty padding space and only the first two bytes of ButtonState?
Code:
Private Type AnimIcon
Sequence As Long '12
NumOfFrame As Long '16
CurFrame As Long '20
State As Long '24
Interval As Long '28
Looped As Boolean '32
(padding, 2 bytes) '34
End Type
Private Type WndExtInfo
lpOldWndProc As Long 'Ptr + 0
ProgressValue As Single '4
ProgressState As TaskbarLib.TBPFLAG '8
Icon As AnimIcon
ButtonsState As Long '36
End Type
And SetExtInfo is using CopyMemory ByVal pt, wi, Len(wi); when Len and LenB don't match; and
GetMem4 ByVal GetWindowLong(hwnd, GWL_USERDATA) + 34, stat
btnidx = GetBtnIndex(pos)
stat = stat Or (&H100& * (btnidx + 1))
GetMem4 stat, ByVal GetWindowLong(hwnd, GWL_USERDATA) + 34
Given your skills I'm extremely hesitant to assume this is a bug; so is there another reason why the 2 bytes padding + 2 bytes ButtonsState, instead of +36 and just ButtonsState? I suppose it doesn't strictly matter as long as its consistent, but who knows when someone else will get confused and go looking
I'm scratching my head trying to understand this though... you frequently use GetMem4 ByVal GetWindowLong(hwnd, GWL_USERDATA) + 34, stat
This is used like it's referring to the ButtonState... but why is it seemingly taking 2 bytes of empty padding space and only the first two bytes of ButtonState?
Code:
Private Type AnimIcon
Sequence As Long '12
NumOfFrame As Long '16
CurFrame As Long '20
State As Long '24
Interval As Long '28
Looped As Boolean '32
(padding, 2 bytes) '34
End Type
Private Type WndExtInfo
lpOldWndProc As Long 'Ptr + 0
ProgressValue As Single '4
ProgressState As TaskbarLib.TBPFLAG '8
Icon As AnimIcon
ButtonsState As Long '36
End Type
And SetExtInfo is using CopyMemory ByVal pt, wi, Len(wi); when Len and LenB don't match; and
GetMem4 ByVal GetWindowLong(hwnd, GWL_USERDATA) + 34, stat
btnidx = GetBtnIndex(pos)
stat = stat Or (&H100& * (btnidx + 1))
GetMem4 stat, ByVal GetWindowLong(hwnd, GWL_USERDATA) + 34
Given your skills I'm extremely hesitant to assume this is a bug; so is there another reason why the 2 bytes padding + 2 bytes ButtonsState, instead of +36 and just ButtonsState? I suppose it doesn't strictly matter as long as its consistent, but who knows when someone else will get confused and go looking
Yes this is the bug. Thank you for testing! When i used GetWindowLong(hwnd, GWL_USERDATA) + 34 i just read/write to the padding and part of ButtonsState member. Because of i don't access to ButtonsState directly using VB6 code so this bug doesn't affect to program behavior. Thank you for the test, you are very attentive