Guidance
指路人
g.yi.org
software / rapidq / Examples / Registry & INI / QFileAssociation / QFA_Demo.Bas

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

  
'
' =============================================================================
' QFileAssociation           April 2004                     by Jacques PHILIPPE
'
'             Association of an Executable to a File Extension
'                 with Possibility to restore the Old one
' Demo                                                       Version 0.0.1 beta
' =============================================================================
'        *****  WITH NO WARRANTY. USE AT YOUR OWN RISK. I USE IT  *****
' =============================================================================
'
' frmSetFileAssociation    Gui Application
'
     $INCLUDE "QFileAssociation.Inc"
'
     $ESCAPECHARS ON
     $TYPECHECK ON
     $INCLUDE "RAPIDQ.INC"
'
     $DEFINE JUMPOVER
'
     DECLARE SUB OnClose_frmSetFileAssociation
     DECLARE SUB OnClic_AnyMenu (Sender AS QMENUITEM)
'
     CREATE frmSetFileAssociation AS QFORM
      Center
      Width = 1000
      height = 1000
      CAPTION = "frmSetFileAssociation"
      AutoScroll = False
      OnClose = OnClose_frmSetFileAssociation
      CREATE rchWin AS QRICHEDIT  ' will disply the received datas
       Align = 5
       Font.Name = "courier new"
       Font.Size = 12
       Font.COLOR = &H800000
       ReadOnly = True
       WordWrap = False
       ScrollBars = ssBoth
       HideSelection = False
       PlainText = True
       Text = CHR$(10) & "   *** NOTHING DONE YET ! USE THE MENU ITEMS ***"
      END CREATE
      CREATE mnuMain AS QMAINMENU
       CREATE mnuSimpleSet AS QMENUITEM
        CAPTION = "&SIMPLE_SET  "
        OnClick = OnClic_AnyMenu
       END CREATE
       CREATE mnuSetWithRestore AS QMENUITEM
        CAPTION = "  &SET_WITH_RESTORE  "
        OnClick = OnClic_AnyMenu
       END CREATE
       CREATE mnuRestore AS QMENUITEM
        CAPTION = "  &RESTORE  "
        OnClick = OnClic_AnyMenu
       END CREATE
       CREATE mnuShowRelatedKeysAndValues AS QMENUITEM
        CAPTION = "  &SHOW_RELATED_KEYS_AND_VALUES  "
        OnClick = OnClic_AnyMenu
       END CREATE
       CREATE mnuClear AS QMENUITEM
        CAPTION = "  &CLEAR  "
        OnClick = OnClic_AnyMenu
       END CREATE
      END CREATE
     END CREATE
'
' *************************************
     frmSetFileAssociation.Show
' *************************************
     DIM myFA AS QFileAssociation
'
'
' *************************************
     frmSetFileAssociation.Visible = False
     frmSetFileAssociation.SHOWMODAL
' *************************************
'
     SUB OnClose_frmSetFileAssociation
      Application.Terminate
      END
     END SUB
'
     SUB GPrint (sText AS STRING)
      rchWin.Addstring (sText)
     END SUB
'
     SUB OnClic_AnyMenu (Sender)
      DEFINT iResult
      SELECT CASE Sender.Handle
      CASE mnuSimpleSet.Handle
       iResult = myFA.SetFileAssociation (".Bas", "C:\\Windows\\Notepad.Exe %1")
       Gprint (myFA.GetFileAssociationErrorAsString (iResult))
       GPrint ("\n      *** SIMPLE SET FINISHED ***\n")
      CASE mnuSetWithRestore.Handle
       myFA.NewDefaultDescriptorValue = "BAS_JFE"
       myFA.BU_Prefix = "YOUR_MARK"
       iResult = myFA.SetFileAssociationAndSaveOld (".bas", "C:\\Rapid-Q\\JFE\\JFE.EXE %1")
       Gprint (myFA.GetFileAssociationErrorAsString (iResult))
       GPrint ("\n      *** SET FINISHED ***\n")
      CASE mnuRestore.Handle
       myFA.BU_Prefix = "YOUR_MARK"
       iResult = myFA.RestoreOldFA (".Bas")
       Gprint (myFA.GetFileAssociationErrorAsString (iResult))
       GPrint ("\n      *** RESTORE FINISHED ***\n")
      CASE mnuShowRelatedKeysAndValues.Handle
       GPrint (myFA.ShowRelatedKeysAndValues (".Bas"))
       GPrint ("\n      *** SHOW FINISHED ***\n")
      CASE mnuClear.Handle
       rchWin.Clear
      END SELECT
     END SUB
'
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2023-2-2  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2004-04-28 21:00:02