Feature Request - Indeterminate StatusBar

Started by PaulSamuelson, December 07, 2017, 09:24:36 AM

Previous topic - Next topic

PaulSamuelson

I use aStatusBar regularly to keep users informed on the status of scripts. However for external process, I have no idea how long it will take..

I would like to see an Indeterminate StatusBar option for those cases.

Thanks,

Paul Samuelson


JTaylor

It will be made available at an indeterminate point in the future  ;)

In the meantime, you could do something with a COM control or maybe a Box.   Partly depends on if you going to popup a separate dialog or box from the script since if you are waiting for an external process to finish then the current script may be locked.  Obviously don't know what you are doing so limits suggestions.   Benefit of the COM Control, assuming you have a Dialog active, is that it could be doing something even if the script is locked.

Jim

td

I was about to post that someone with more time than good sense could fake an "intermediate" style status bar using a bastardized WIL dialog.   The Box function approach might even be better depending on  the context.  Quite a few years ago a user posted a box function based script for a binary encoded decimal clock that does something remotely similar.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

Also, in case it is helpful...here is my ComControl Extender.  It has a ProgressBar.  Not sure if it will do what you want but for what it is worth...

Jim

JTaylor

They have the Attachment limit set WAY too small...Here is a link...

    http://www.jtdata.com/anonymous/comctrl.zip

Jim

td

Quote from: JTaylor on December 07, 2017, 02:07:26 PM
They have the Attachment limit set WAY too small...Here is a link...

There are plenty of ways to share files on the Internet for free.  We only have so much bandwidth.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

PaulSamuelson

I like the simplicity of using the aStatusBar, but sometimes I have no way to get the status. In the current case, I use RunShell to launch some Java that processes PDF files. Depending on the size of the file it might take seconds, or minutes to complete. I do not have a dialog.


aStatusbar(0,applet,"Processing might take a while, or maybe not...":@lf:FileRoot(pdf),1,0)

RunShell(Environment("COMSPEC"),'/C java -jar "':Jar:'" PDFToImage -dpi 300 -outputPrefix "':outFile:'" "':pdf:'"',"",@hidden,@wait)

aStatusbar(1,applet,"Done",1,1)
Run("Explorer.exe",SubDir)
Delay(1)
aStatusbar(2,applet,"",1,1)


Jim, I was looking at your comctrl extender. You need to get a handle from a control, but what control that should be for a ProgressBar? There is no native ProgressBar control.

Thanks,

Paul

JTaylor

That is why you would use the pgCreateProgressBar() function.   I created the extender to have access to Controls that were not natively provided with WinBatch as well as extend functionality of some that are provided.    If you find the Help isn't Helpful let me know and I will update it to clarify any questions.


Jim

JTaylor

Here is an example.  Some limitations adding non-native controls to a dialog.  I nag the WinBatch folks on a regular basis to add more of these :)   

Jim

Code (winbatch) Select


WinHide("")
Home_Path = DirScript()
DirChange(Home_Path)
GoSub Load_Var
AddExtender("cmctrl44i.dll")

IntControl(49,3,0,0,0)

RVFormat=`WWWDLGED,6.2`

RVCaption=`Report View`
RVX=002
RVY=038
RVWidth=250
RVHeight=100
RVNumControls=001
RVProcedure=`RV_Sub`
RVFont=`DEFAULT`
RVTextColor=`DEFAULT`
RVBackground=`DEFAULT,128|128|128`
RVConfig=0

RV001=`210,003,024,012,PUSHBUTTON,"pb_RV_Exit",DEFAULT,"E&xit",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("RV")

Exit

:LOAD_VAR


#DefineSubRoutine PG_UnHide()

; DialogControlState(RV_Handle,"st_RV_datetime",dcstate_removestyle,dcstyle_invisible)

  ;#########################################################################################
  ;Create ProgressBar
  ;#########################################################################################
  pgControlHandle = pgCreateProgressBar(RV_Handle,50,50,250,30,0)
  itext           = pgSetColor(pgControlHandle,"225|250|30",0)
  itext           = pgSetColor(pgControlHandle,"25|250|30",1)
; itext           = pgSetPosition(pgControlHandle,50)
  itext           = pgSetStep(pgControlHandle,1)
 
  For x = 1 to 100
    itext           = pgStep(pgControlHandle)
    TimeDelay(.1)
  Next

#EndSubRoutine



#DefineSubRoutine RV_Sub(RV_Handle,DMsg,DCID,DEInfo,ChangeInfo)

Switch (DMsg)
    Case @deinit
    DialogProcOptions(RV_Handle, @detimer,500)
    DialogProcOptions(RV_Handle, @dePbPush,1)
    Break
  Case @deTimer
    PG_UnHide()   
    DialogProcOptions(RV_Handle, @detimer,0)
    Break
  Case @dePbPush
    Exit
EndSwitch
Return -2

#EndSubRoutine
   

Return




PaulSamuelson

Thanks, now I can create a ProgressBar on a dialog, but how do I make it indeterminate? You have functions to set color, range, step and position but it only produces a standard determinate ProgressBar.

I will certainly have uses for this when I have a dialog and don't want to pop-up another window for progress bar.

JTaylor

Not sure what officially makes it an "indeterminate" progress bar but you can simply keep looping and even shift colors.  I assume the goal is just to make it do something to reassure the user that something is happening.

Jim

PaulSamuelson

From https://msdn.microsoft.com/en-us/library/windows/desktop/bb760820(v=vs.85).aspx#PBS_MARQUEE

The following control styles are supported by Progress Bar controls:
PBS_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.

JTaylor

Let me see if I can find some time today to tweak the Extender, assuming my limited C skills are up to the task of making that change :)

Jim

JTaylor

Hmmmmmmmm...I think I have the code right but still can't make it work.  One thing that might be the issue is the manifest telling it to use Version 6 of the Common Controls.  One code sample said to use this

    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

but not sure where the best  place to put it.

Another said to create a manifest file and I did  that but not sure I defined the location correctly in VS 2017. 

Directions on which approach to take or how to make sure it is using the correct version?

Here is the Extender code in case anyone sees a problem with it.

Code (c) Select




    HWND ControlHandle   = LongToHandle(lpvvArg[0].x);
int marquee = lpvvArg[1].x;

    int pg_resp          = 0;

if (marquee == 1)
{
LONG_PTR style = GetWindowLongPtr(ControlHandle, GWL_STYLE);
SetWindowLongPtr(ControlHandle, GWL_STYLE, style | PBS_MARQUEE);
pg_resp = SendMessage(ControlHandle, PBM_SETMARQUEE, 1, 200);
}
else
{
    pg_resp = SendMessage(ControlHandle, PBM_STEPIT, 0, 0);
}
   

    RETLONG(pg_resp);




td

To quote MSFT, "If a DLL with the same module name is already loaded in memory, the system uses the loaded DLL, no matter which directory it is in. The system does not search for the DLL."
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

Does this apply to my post?  If so, could you clarify because I am not making the connection.

Jim

td


  • You stated that you wish to "use Version 6 of the Common Controls".
  • Each version of the common controls has its own dll but all common control dlls have the same name -  "comctl32.dll." 
  • To use the version 6 version of the common controls you must therefore load a dll named "comctl32.dll."
  • WinBatch loads a common control dll other that version 6 at startup that is also named "comctl32.dll."
  • Per MSFT, Windows does not load an additional dll into a process when a dll with that name is already loaded into that process.

Conclusion: you cannot load the version 6 comclt32.dll into a WinBatch process.

"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

Now that makes sense....Sorry Paul...not going to be able to help you with this one until WinBatch allows for visual styles on this front. 

You could just repeatedly run the progress bar.

Jim

PaulSamuelson

Jim,

Thanks for your attempt. Even though I did not get what I was looking for, I am using your extender to put progress bars (and maybe other controls later) on dialogs.

Thanks again,

Paul

JTaylor

You could also use a COM Control and find something on the HTML/Javascript front that would probably do what you want.


Glad you are finding the Extender helpful.

Jim