home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / code / system / pmlist / proglist.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-02-26  |  6.8 KB  |  180 lines

  1. VERSION 2.00
  2. Begin Form ProgList 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Select Program-Manager-Group"
  5.    ClientHeight    =   1515
  6.    ClientLeft      =   2040
  7.    ClientTop       =   3495
  8.    ClientWidth     =   4935
  9.    ClipControls    =   0   'False
  10.    Height          =   2040
  11.    Icon            =   PROGLIST.FRX:0000
  12.    Left            =   1980
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   1515
  16.    ScaleWidth      =   4935
  17.    Top             =   3030
  18.    Width           =   5055
  19.    Begin ComboBox GroupList 
  20.       Height          =   300
  21.       Left            =   180
  22.       Sorted          =   -1  'True
  23.       Style           =   2  'Dropdown List
  24.       TabIndex        =   3
  25.       Top             =   1080
  26.       Width           =   2895
  27.    End
  28.    Begin TextBox MyGroup 
  29.       Height          =   315
  30.       Left            =   180
  31.       TabIndex        =   2
  32.       Text            =   "MyGroup"
  33.       Top             =   420
  34.       Width           =   2895
  35.    End
  36.    Begin CommandButton CommandKey 
  37.       Caption         =   "&Inslall"
  38.       Height          =   375
  39.       Index           =   0
  40.       Left            =   3540
  41.       TabIndex        =   1
  42.       Top             =   420
  43.       Width           =   1215
  44.    End
  45.    Begin CommandButton CommandKey 
  46.       Caption         =   "&Cancel"
  47.       Height          =   375
  48.       Index           =   1
  49.       Left            =   3540
  50.       TabIndex        =   0
  51.       Top             =   1020
  52.       Width           =   1215
  53.    End
  54.    Begin Label Label1 
  55.       AutoSize        =   -1  'True
  56.       BackStyle       =   0  'Transparent
  57.       Caption         =   "&Own Group:"
  58.       Height          =   195
  59.       Index           =   0
  60.       Left            =   180
  61.       TabIndex        =   6
  62.       Top             =   180
  63.       Width           =   1020
  64.    End
  65.    Begin Label Label1 
  66.       AutoSize        =   -1  'True
  67.       BackStyle       =   0  'Transparent
  68.       Caption         =   "&Progman Groups:"
  69.       Height          =   195
  70.       Index           =   1
  71.       Left            =   180
  72.       TabIndex        =   5
  73.       Top             =   840
  74.       Width           =   1470
  75.    End
  76.    Begin Label ItemLabel 
  77.       Alignment       =   1  'Right Justify
  78.       AutoSize        =   -1  'True
  79.       BackStyle       =   0  'Transparent
  80.       Height          =   195
  81.       Left            =   3000
  82.       TabIndex        =   4
  83.       Top             =   840
  84.       Width           =   75
  85.    End
  86. ' This example application shows...                        ;
  87. '                                                          ;
  88. '       How To Find Program Manager Groups                 ;
  89. '       ==================================                 ;
  90. '                                                          ;
  91. ' The easiest (and fastest) way is indeed a method which   ;
  92. ' uses Dynamic Data Exchange (DDE).                        ;
  93. '                                                          ;
  94. ' In a Setup Program you normally add a TextBox to give    ;
  95. ' the user the chance of typing in his own group name.     ;
  96. ' This TextBox can thus be used for DDE with the Program   ;
  97. ' Manager.                                                 ;
  98. '                                                          ;
  99. '                                                          ;
  100. ' As well as you I'm always interested in how to do things ;
  101. ' in VisualBasic which do not belong to 'normal' tasks.    ;
  102. ' If there is anything special that could be useful for    ;
  103. ' a lof of programmers - just drop it as well in the Forum ;
  104. ' you found this here...                                   ;
  105. '                                                          ;
  106. ' From:     Christian Germelmann                           ;
  107. '           Am Glaskopf 26                                 ;
  108. '           35039 Marburg/Lahn                             ;
  109. '           Phone ++49 6421 45457                          ;
  110. '           CompuServe 100520,2644                         ;
  111. '                                                          ;
  112. Declare Function GetSystemMenu Lib "USER" (ByVal hWnd As Integer, ByVal bRevert As Integer) As Integer
  113. Declare Function DeleteMenu Lib "USER" (ByVal hMenu As Integer, ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer
  114. Const SC_TASKLIST = &HF130
  115. Sub CommandKey_Click (Index As Integer)
  116. Select Case Index
  117.     Case 0  ' INSTALL
  118.     ' Make Program Manager Group
  119.         MyGroup.LinkTopic = "ProgMan|Progman"   ' --> see Form_Load as well
  120.         'MyGroup.LinkItem = "Progman"
  121.         MyGroup.LinkMode = 2
  122.         Dim OK%
  123.         For OK = 1 To 10
  124.             DoEvents
  125.         Next
  126.         MyGroup.LinkTimeout = 100               ' give it enough time...
  127.         MyGroup.LinkExecute "[CreateGroup(" + MyGroup + ")]"
  128.         
  129.         If MyGroup.Text = "My New Group" Then   ' if not ... it's a bit too much trouble !
  130.             MyGroup.LinkExecute "[AddItem(" + UCase("NOTEPAD.EXE") + ",My Notepad)]"
  131.             MyGroup.LinkExecute "[AddItem(" + UCase("CLOCK.EXE") + ",My Clock)]"
  132.             MyGroup.LinkExecute "[AddItem(" + UCase("SYSEDIT.EXE") + ",My Sysedit)]"
  133.         End If
  134.             MyGroup.LinkExecute "[AddItem(" + UCase("NOTEPAD AUTOEXEC.BAT") + ",My AUTOEXEC.BAT)]"
  135.             MyGroup.LinkExecute "[AddItem(" + UCase("NOTEPAD CONFIG.SYS") + ",My CONFIG.SYS)]"
  136.         
  137.         MyGroup.LinkExecute "[ShowGroup(" + MyGroup + ", 1)]"
  138.         MyGroup.LinkTimeout = 50                ' (set back)
  139.         MyGroup.LinkMode = 0
  140.         OK = Shell("PROGMAN.EXE", 1)            ' and show ProgMan
  141.     Case 1  ' CANCEL
  142. End Select
  143.         End
  144. End Sub
  145. Sub CutSystemMenu ()
  146. Dim hMenu%
  147.     hMenu% = GetSystemMenu(hWnd, 0)
  148.      
  149.     OK = DeleteMenu(hMenu%, SC_TASKLIST, 0)
  150.     OK = DeleteMenu(hMenu%, 0, 0)
  151.     OK = DeleteMenu(hMenu%, 0, 0)
  152. End Sub
  153. Sub Form_Load ()
  154.     Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
  155.     CutSystemMenu
  156.     MyGroup.LinkTopic = "Progman|Progman"
  157.     MyGroup.LinkItem = "Progman"
  158.     MyGroup.LinkMode = 2
  159.     MyGroup.LinkRequest
  160.     MyGroup.LinkMode = 0
  161.     'On Error Resume Next
  162.     Dim OldPos%, NewPos%
  163.     OldPos = 1
  164.     Do While InStr(NewPos + 1, MyGroup.Text, Chr$(13)) > 0
  165.         NewPos = InStr(NewPos + 1, MyGroup.Text, Chr$(13))
  166.         GroupList.AddItem Mid$(MyGroup.Text, OldPos, NewPos - OldPos)
  167.         OldPos = NewPos + 2
  168.     Loop
  169.     GroupList.ListIndex = 0
  170.     ItemLabel.Caption = "[" + GroupList.ListCount + "]"
  171.     Show
  172.     MyGroup.Text = "My New Group"
  173.     MyGroup.SelStart = 0
  174.     MyGroup.SelLength = Len(MyGroup)
  175.     MyGroup.SetFocus
  176. End Sub
  177. Sub GroupList_Change ()
  178.     MyGroup.Text = GroupList.Text
  179. End Sub
  180.