Author Topic: Customized ProgressBar - Source Code embeded - RosAsm syntax  (Read 18120 times)

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Re: Customized ProgressBar - Source Code embeded - RosAsm syntax
« Reply #15 on: June 19, 2012, 03:22:07 PM »
New from progressbar

I´m on the way to succeed to make the progressbar existant in windows7 works on windowsxp and windows 2000 (and perhaps, also on win95). Once i finish, i would like to ask you guys that have windows7 to test this please.
One of the flags i understood how to enable is : PBST_PAUSED

One question only.

There is a internal function inside comctl32 from windows7 that is called Progress_SetAnimateTimer. Inside this function there is a call to SHWindowsPolicy (in shell32.dll) with the flag POLID_TurnOffSPIAnimations. This function is supposedlly needed to increase the animation time of the Progressbar by temporarilly disabling the other animations in windows (such as cursors etc) while the progressbar is running.

Unfortunatelly, SHWindowsPolicy exists only on vista and above. So i wonder if it is really necessary to disable other animations on windows to make the progressbar runs faster. There is a workaround on winxp that forces the registry to disable the animations (don´t know if a reboot is necessary)...but...on the current machines available in market (Mine for example is a I-7) is it really necessary to disable other animations ????

I´m not quite sure if disabling animation is really a must, because inside comctl32.dll (on win7) it seems to me that it is only a matter of bad coding style inside the dll that makes the progressbar runs slowly. Internally it have tons of "spaghetti" style and framed jmps/calls, and what seems to be some stack problems that probably once fixed makes it runs faster.


Also....is there a way to make a app works with visualstyles without embeding the xml in the resources section ? (i mean, i would like to enable visual styles using a xml file existent in the same directory of the main app. Specially a xml that enables the progressbar behaviour with visual styles. Without calling the comctl32.dll in winsxs directory, of course, because it must uses the routine i made that interceps the progressbar itself). For example, is there a function that can be called in uxtheme that loads a xml from a external file and not from the resources section ?
If there is, can someone please upload a example ?
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 9994
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Customized ProgressBar - Source Code embeded - RosAsm syntax
« Reply #16 on: June 19, 2012, 04:31:43 PM »
guga,

Looks good !  :icon14:
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Re: Customized ProgressBar - Source Code embeded - RosAsm syntax
« Reply #17 on: June 19, 2012, 07:19:39 PM »
HI steve...Tks :)

Btw: I found how to make visual styles externally. Just create a manifest file with the same name as the target app, and adding a extension ".manifest" on it. The contents should have this:
Code: [Select]
<?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="X86"

    name="CompanyName.ProductName.YourApp"

    type="win32"

/>

<description>Your application description here.</description>

<dependency>

<dependentAssembly>

        <assemblyIdentity

            type="win32"

            name="Microsoft.Windows.Common-Controls"

            version="6.0.0.0"

            processorArchitecture="X86"

            publicKeyToken="6595b64144ccf1df"

            language="*"

        />

    </dependentAssembly>

</dependency>

</assembly>

This can be created with notepad. In my case, i saved it as "CustProgressBar7c.EXE.manifest" and visual styles were enabled. (Also, the app must contains a call to initcommoncontrols).

Once i finished the tests on the new progressbar based on win7, i´ll see if the hook also works for the external manifest file directly.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Customized ProgressBar - Source Code embeded - RosAsm syntax
« Reply #18 on: June 19, 2012, 08:23:05 PM »
you can embed the manifest into the EXE resources
it is actually an XML file, so i usually name it "program.xml"
then, in the resource file:
Code: [Select]
#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 "program.xml"
of course, you can provide a relative path if you put resources in a seperate folder

you don't have to define the constants - i do that because i like to know what they mean   :P

Code: [Select]
1 24 "program.xml"will also work
it doesn't change the size of the EXE

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 9994
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Customized ProgressBar - Source Code embeded - RosAsm syntax
« Reply #19 on: June 19, 2012, 08:32:34 PM »
guga,

You are pretty safe using the external manifest file up to Win 7 64 bit, God know what will be the case with later versions but external manifests have worked since early Windows XP, Win2000 does not use them. You can embed a manifest into your resource section as Dave has mentioned so it depends what you want, a single exe or an external manifest that can be changed. Something I have done with a few older apps I own is to create a manifest file for them then they appear correctly in Win XP and Win 7 64 bit.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Re: Customized ProgressBar - Source Code embeded - RosAsm syntax
« Reply #20 on: June 20, 2012, 12:34:32 PM »
Hi steve

yeah...i´ll used them externally for now, since i didn´t finished the routine in rosasm that embed xml files in the resource section (I´ll do that later perhaps, once i restart the resource viewer app i was building a couple of years ago).

I´ll basically see if the technique i´m using in progressbar can also intercept a external manifest file. If it does, i´ll be able to test the internal coding that call the visual styles apis.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com