The MASM Forum Archive 2004 to 2012

Specialised Projects => Custom Interface Components => Topic started by: guga on May 16, 2012, 12:31:32 AM

Title: ProgressBar
Post by: guga on May 16, 2012, 12:31:32 AM
Hi guys

I´m building a custom progressbar (for use also on winxp or below) that behaves similar to the one for win vista and win7 (comctl32 v6 or later), but i´m facing some problems. I`m trying to understanhd how PBM_SETMARQUEE works, but since i don´t have comctl32.dll v 6.0 (or above) i can´t analyse the function properly. (I´m running on Xp here)

Someone suceeded to make work the PBM_SETMARQUEE msg ? IF you do, can someone pls post comctl32.dll v6.0 or above so i can analyse it properly ?


I´ll try to use the original progressbar class but on a technique similar to the customized messagebox that uses HCBT_ACTIVATE. I remembr thatis possible to use the same technique on other classes, as long we change the address of WndProc of each class ot the ones we need to customize.

Best Regards,

guga
Title: Re: ProgressBar
Post by: dedndave on May 16, 2012, 01:16:59 AM
you probably have common controls 6   :bg
what you are missing is:
1) InitCommonControlsEx at the beginning of the program
2) a manifest file like this
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df"/>
    </dependentAssembly>
  </dependency>
</assembly>


there are a couple ways to use the manifest

if your program is named "Program.exe"
then you can name the manifest file "Program.exe.manifest" and place it in the same folder as the exe
that's kind of ugly - lol

it is easier to add it to the resource file - the manifest will be embedded into the exe, like other resources

#ifndef  CREATEPROCESS_MANIFEST_RESOURCE_ID
#define  CREATEPROCESS_MANIFEST_RESOURCE_ID  1
#endif

#ifndef  RT_MANIFEST
#define  RT_MANIFEST                         24
#endif

CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "MyManifestFile.xml"

the conditional defines may not be required if you are using a newer version of resource.h
or you can use the lazy way...
1 24 "MyManifestFile.xml"
when you execute InitCommonControlsEx, be sure to include ICC_PROGRESS_CLASS
you may or may not need ICC_BAR_CLASSES, as well - not sure about that one
Title: Re: ProgressBar
Post by: guga on May 16, 2012, 01:43:54 AM
Tks....but...i wanted to use it without manifest on it. (To also work on older Win versions). The manifest functions related to initcommoncontrols uses CreateActCtxW function.

Is there any way to directly load this kind of style without using manifest ?

I know that these kind of styles looks for it´s dll inside C:\WINDOWS\WinSxS directories...but...how to force a theme style to directly point to that dll to display a visual style control ?

If it is com, can´t the PBM_SETMARQUEE be associated with the specific icall ?

For example on the comctl32.dll v6.0 i found on mine winsxs directory there is a function called InitProgressClass that uses the opentheme, closetheme, OpenThemeData functions....Since the manifesty seems to be only a signature id, it may have a way to create a function that behaves like the marquee without using the xptheme. Specially because this code have a function called MarqueeSetTimer that maybe a clue to how to build this styles without using the theme.
Title: Re: ProgressBar
Post by: dedndave on May 16, 2012, 02:17:53 AM
well - i think you are trying to mount an outboard motor on a horse   :P
whether you load common controls v6 or not, you are going to be sending a message that wasn't supported under win95

as for the manifest...
i have written programs with a comctls v6 manifest - and they run under windows 95/98, as i recall
certainly, the advanced appearance and features would not be present
maybe we need to do a little testing to see how it works, as msdn does not document it well

as for creating a marquee on the progress bar...
if you want a marquee that works for older and newer versions, you may wind up painting it, yourself
which - isn't a bad solution - not all that difficult
Title: Re: ProgressBar
Post by: dedndave on May 16, 2012, 02:23:33 AM
what you might try is load common controls v6 with a manifest
then use GetDllVersion to see if it is present
be aware that older operating systems may not export GetDllVersion
you might have to use GetProcAddress on win95 or something

do you have older OS machines to test on ?
Title: Re: ProgressBar
Post by: dedndave on May 16, 2012, 02:27:38 AM
old win95 stuff...
http://hyper.sunjapan.com.cn/~hz/win32/commctl3.htm
Title: Re: ProgressBar
Post by: dedndave on May 16, 2012, 03:00:31 AM
oh - you mentioned something about loading common controls without a manifest
i have never tried it that way   :P
it doesn't sound very kosher
some version of common controls is loaded when you start the program
and - the functions in the IAT are filled in
i guess it could work - but only the functions that you use GetProcAddress with the loaded dll will be newer versions

at any rate - if you want to play with the advanced features, you can do so with a manifest
at least you can see how it works on newer OS's
Title: Re: ProgressBar
Post by: guga on May 20, 2012, 12:27:40 AM
OK....succeeded to make a custom progressbar control in replacement of msctls_progress32 using HCBT_CREATEWND
Many tks for drizz for the custom control functions.

I just finished analyzing the way progressbar works exactly inside comctls32.dll (finished v 5 and started analysis on v 6 that uses visual style stuff)...I´ll later update this custom control to work exactly as the ones existent inside comctls (But....adding more progressbar messages and styles). It will then use the windows messages and the ones that were customized.

Once this is finished it would be a good idea do the same for the other windows controls as well.

(http://www.freeimagehosting.net/t/jjvci.jpg) (http://www.freeimagehosting.net/jjvci)

Source code is embeded in the app. RosAsm source code.

This is just a beta test version. I´ll try to finish it as soon as possible.

The main function is CustomDlgProgressBar

Also created a  GetWindowPos (http://www.masm32.com/board/index.php?topic=18891.new)
Title: Re: ProgressBar
Post by: dedndave on May 20, 2012, 12:47:39 AM
pretty nice   :U

i don't recall if xxControls has something similar
Title: Re: ProgressBar
Post by: guga on May 20, 2012, 01:08:53 AM
Thanks

for the next versions...i´ll try to mix the existent code from comctls to use the original progressbar messages and styles (including the ones that are supposed to work only on vista/seven :)...but...i´ll try to force them to be used on winxp/2000/98/95, since i don´t have vista or seven installed )

Also,...i plan to add a custom message to enable the user to set a bitmap image on the back of the progressbar control.

Btw: This same technique can be used to customize any windows control as well.

This technique was based on http://www.codeguru.com/cpp/w-p/win32/messagebox/article.php/c14605/Fancy-Custom-MessageBox.htm