Guidance
指路人
g.yi.org
software / rapidq / examples / GUI / Icon / Embedded Icons / rqFakeMsgBox.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
' rq Fake Message Box Helper Utiltiy for wsh scripters, jw 08Sep00
' author: jwarrington*NoSteekinSpam*@att.net

' --- for rapidq neophites: ----------------------
' RapidQ is a ONE-PASS compiler.
'   This makes need for some unusual programming behavior.
'   Specifically: YOU MUST DEFINE EVERYTHING BEFORE YOU USE IT.
'   This may require a bit of ingenuity, but then
'   that's all part of the challenge...
' --- end of neophite comments -------------------

' --- Discussion ---------------------------------
' This program is intended to serve as a "Fake Message Box" Helper Utility.
'   It shows a normal rqForm, with the min/max/close buttons removed.
'   There is some limited customization.  The Message, (of course).
'   You may also (optionally) specify an icon, and the caption.
'   The parameters are specified via the command line.
'   (No "late-binding" going on here)...
'
' Calling Sequence:
'   path\rqFakeMsgBox.exe "message" icoNr "caption"
'
'   where message and caption need quotation marks if there are any blanks.
'   (and most likely there will be).  icoNr is a digit, either 1, 2, or 3.
'   1 => the info icon, 2 => the exclamation icon, and 3 => the fatal icon.
'
' You may be annoyed that there is no way to specify the button
'   configuration.  Sorry about that.  As the rq code is provided,
'   you could do it yourself, but without any "late-binding" (inc. the
'   capability of "raising events") you would have to use an "error code"
'   to pass the result (i.e., which button was clicked) back to the caller...
'   But, if you feel compelled to specify the button configuration,
'   you might be better off with the standard wsh message box.
' --- end of discussion --------------------------

     $INCLUDE "RAPIDQ.INC"
'  Note: the following resources are compiled into the program,
'   but, if you ever recompile, the compiler expects these icons to
'   be found in the "current path", i.e., in the same directory as
'   the compiler itself (and NOT the source)!!!
     $RESOURCE RES_ICOINFO AS "sysInfo.ico"
     $RESOURCE RES_ICOEXCL AS "sysExcl.ico"
     $RESOURCE RES_ICOFATAL AS "sysFatal.ico"
     $RESOURCE RES_ICONASK AS "sysAsk.ico"  ' doesn't make much sense here...
     $TYPECHECK ON

  ' create the form, and populate it,
  '   (with an Icon, label and a button)...
     CREATE frmFakeMB AS QFORM
      Width = 260 : Height = 130
      CAPTION = "< rq Fake MsgBox, w/No Close Button >"
    ' eliminate the min/max buttons...
      delBorderIcons(biMinimize) : delBorderIcons(biMaximize)
      delBorderIcons(biSystemMenu)  ' this gets rid of the close button...

      Center

      CREATE imgIco AS QIMAGE
       Left = 10 : Top = 10 : Width = 32 : Height = 32
       ICOHandle = RES_ICOINFO
       Visible = False  ' hide, for now
      END CREATE  ' image

      CREATE lblMsgBoxMessage AS QLABEL
       Left = 60 : Top = 20 : Width = 300 : Height = 15
       CAPTION = "Your message here"
      END CREATE  ' label

      CREATE cmdOK AS QBUTTON
       Left = 75 : Top = 65 : Width = 100 : Height = 25
       CAPTION = "OK"
      END CREATE  ' button

     END CREATE  ' frmFakeMB


     SUB cmdOK_ClickEvent
      Application.Terminate
     END SUB

' ================================================
' === MAIN PROGRAM ===============================
' ================================================
     DIM iIco AS LONG
     CONST bDebug = False  ' True
     CONST MB_OK = &H0  ' from win32api.txt

  ' some initializations that couldn't be made above,
  '   (due to ONE-PASS nature of rapidq)...
     cmdOK.OnClick = cmdOK_ClickEvent

  ' check for command line parameters...
     IF bDebug THEN MESSAGEBOX STR$(COMMANDCOUNT), "debug", MB_OK

     IF COMMANDCOUNT >= 1  THEN
    ' if there must be a first parameter, so put it in the "message"...
      lblMsgBoxMessage.CAPTION = COMMAND$(1)
    ' if there is a second parameter, put in an icon...
      IF COMMANDCOUNT >= 2  THEN
       iIco = VAL(COMMAND$(2))
       SELECT CASE iIco  ' select which icon to show...
       CASE 1
        imgIco.ICOHandle = RES_ICOINFO : imgIco.Visible = True
       CASE 2
        imgIco.ICOHandle = RES_ICOEXCL : imgIco.Visible = True
       CASE 3
        imgIco.ICOHandle = RES_ICOFATAL : imgIco.Visible = True
       END SELECT
      END IF  ' finished with second parameter
      IF COMMANDCOUNT >= 3  THEN  frmFakeMB.CAPTION = COMMAND$(3)
    ' if any more parameters, igonre them...
     END IF

     frmFakeMB.SHOWMODAL

     Application.Terminate

' --- end of rqFakeMsgBox program ----------------
掌柜推荐
 
 
¥1,800.00 ·
 
 
¥489.00 ·
 
 
¥288.00 ·
 
 
¥908.00 ·
 
 
¥748.00 ·
 
 
¥264.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:55:46