[AccessD] Queries Progress Bar

Stuart McLachlan stuart at lexacorp.com.pg
Tue Apr 7 16:19:13 CDT 2009


As Gustav "suggested" - Powerbasic - specifically PB/Win 9.01

And here's the source:

<begin source>
#COMPILE EXE
#DIM ALL
#INCLUDE "Win32API.inc"
GLOBAL lMax AS LONG
'------------------------------------------------------------------------------
' Equates
'------------------------------------------------------------------------------
%WM_USER      = &H400
%ID_PROGRESS  = %WM_USER + 2048
'-----------------------------------------------------------------------------
' Progress dialog callback
' In %WM_INITDIALOG, we post a user defined message to the dialog's message
' queue via DIALOG POST. Posted messages are placed at bottom of the message
' queue, so this ensures dialog will be shown before the action starts.
'------------------------------------------------------------------------------
CALLBACK FUNCTION PBarDlgProc () AS LONG
    LOCAL i AS LONG
    SELECT CASE CB.MSG
    CASE %WM_INITDIALOG
       ' Post a user defined (private) message to self
       DIALOG POST CB.HNDL, %WM_USER + 999&, 0, 0

    CASE %WM_USER + 999&
        FOR i = 1 TO lmax
            PROGRESSBAR STEP CB.HNDL, %ID_PROGRESS
            DIALOG DOEVENTS 500' allow processor to breathe and wait 500 millisecs
        NEXT
        DIALOG END CB.HNDL, 0  'Done, so close dialog
    END SELECT
    END FUNCTION
'------------------------------------------------------------------------------
' Main entry point for the application
'------------------------------------------------------------------------------
FUNCTION PBMAIN () AS LONG
    LOCAL hdlg AS DWORD
'Get time to display: x 2  because we update every 1/2 second
    lMax  = VAL(COMMAND$) * 2
'create Dialog
    DIALOG NEW 0, "Processing - Please Wait",,, 200, 40,, 0 TO hDlg
    DIALOG SET COLOR hDlg, -1, RGB(192,192,222)
    CONTROL ADD PROGRESSBAR, hDlg, %ID_PROGRESS, "",  5, 12, 190, 12
 'Configure Prgress bar
    PROGRESSBAR SET RANGE hDlg, %ID_PROGRESS, 0, lMax
    PROGRESSBAR SET STEP  hDlg, %ID_PROGRESS, 1
'Lock window on top
    SETWINDOWPOS hDlg, %HWND_TOPMOST, 0, 0, 0, 0, %SWP_NOMOVE OR 
%SWP_NOSIZE
'show it
    DIALOG SHOW MODAL hDlg, CALL PBarDlgProc
 END FUNCTION
                 
<end source>


On 7 Apr 2009 at 15:01, William Hindman wrote:

> Stu
> 
> ...works perfectly Stu ...it even takes the progress meter out of the status 
> bar ...just "calculating" :)
> ...looks like this is a "plug-in" solution useful in a number of scenarios.
> ...of course I'd like to be able to match the gui with my own and perhaps 
> add a cancel option and a caption :)
> ...so, how was this done and is the source available? ...never hurts to ask 
> :)
> 
> ...gustav ...tks for your help as well in getting Stu going.
> 
> ...there simply is NO place on the web like AccessD :)
> 




More information about the AccessD mailing list