Kbase 22053: How To Call The Windows Date/Time Properties From Progress
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/24/2002 |
|
SUMMARY:
This Knowledge Base Solution shows how to draw a status bar on a Progress window and place a call to the MS-Windows Date/Time Properties Screen from the Progress program. The user invokes the call with a double mouse click event on a certain region of the status bar. This emulates what occurs when a user double mouse clicks on the Windows clock in the Windows Task Bar.
SOLUTION:
To create a status bar for a Progress Window and to display messages in the status bar boxes, the code below places calls to the _status.p and _statdsp.p source files provided by Progress. These files are located under the $DLC\src\adecomm directory. It also calls the Windows WinExec function to execute the Windows Date/Time Properties Screen.
----------------------------------------------------------------------
DEFINE VARIABLE vwhWindow AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE vwhStatus AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE vwhStatRegion AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE viCount AS INTEGER NO-UNDO.
DEFINE VARIABLE viReturnCode AS INTEGER NO-UNDO.
CREATE WINDOW vwhWindow
ASSIGN STATUS-AREA = FALSE
MESSAGE-AREA = FALSE
RESIZE = FALSE
WIDTH = 100
HEIGHT = 2
BGCOLOR = 8
VISIBLE = YES
TITLE = "Sample program for calling the MS-" +
"Windows Calendar from the status bar":U.
RUN adecomm/_status.p
(INPUT vwhWindow, /* Parent Window's handle */
INPUT "70,10":U, /* Size of boxes to be created */
INPUT TRUE, /* Whether or not show top bar */
INPUT 3, /* Font number for status message text */
OUTPUT vwhStatus, /* The status frame's handle */
OUTPUT viCount). /* Number of boxes actually created */
vwhStatus:VISIBLE = yes.
/*******************************************************************/
/* RUN adecomm/_statdsp.p */
/* INPUT PARAMETERS: */
/* vwhStatus - The status frame created from _status.p. */
/* viPos - The status region to display the message in. */
/* vcMessage - The message text. */
/*******************************************************************/
RUN adecomm/_statdsp.p
(vwhStatus,
1,
"Double-click on the time displayed on the right...":U).
RUN adecomm/_statdsp.p
(vwhStatus,
2,
STRING(TIME,"HH:MM AM":U)).
vwhStatRegion = WIDGET-HANDLE(ENTRY(2,vwhStatus:PRIVATE-DATA)).
vwhStatRegion:SENSITIVE = TRUE.
ON MOUSE-SELECT-DBLCLICK OF vwhStatRegion
DO:
RUN WinExec('"rundll32" shell32.dll,Control_RunDLL timedate.cpl':U,
1,
OUTPUT viReturnCode).
END.
WAIT-FOR WINDOW-CLOSE OF vwhWindow.
PROCEDURE WinExec EXTERNAL "KERNEL32.DLL":U:
DEFINE INPUT PARAMETER pcProgramName AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER plVisualStyle AS LONG NO-UNDO.
DEFINE RETURN PARAMETER plStatusCode AS LONG NO-UNDO.
END PROCEDURE.
----------------------------------------------------------------------
NOTE: In order to refresh the time displayed on the right section of the Progress window's status bar, you would need to implement functionality such as that provided with the PSTimer OCX's tick event.
References to Written Documentation:
Progress Knowledge Base Solution 16925, "How To Call WinExec in Version 8.2A (and Error 3258)"