文書番号: 410501
最終更新日: 1999/03/21
'---------------------------------------------------------- ' Procedure: CreateProgManItem ' ' Arguments: X The form where Label1 exists ' ' CmdLine$ A string that contains the command ' line for the item/icon. ' ie 'c:\myapp\setup.exe' ' ' IconTitle$ A string that contains the item's ' caption ' ' ' IconPath$ A string that contains the filename ' for the icon to be displayed in the ' group window ' ' IconIndex Specifies the index of the icon in ' the file indicated by the IconPath$ ' parameter ' -1 for default icon ' '---------------------------------------------------------- Sub CreateProgManItem (x As Form, CmdLine$, IconTitle$, IconPath$, IconIndex) Dim sParam As String Screen.MousePointer = 11 '---------------------------------------------------------------------- ' Windows requires DDE in order to create a program group and item. ' Here, a Visual Basic label control is used to generate the DDE messages '---------------------------------------------------------------------- On Error Resume Next '--------------------------------- ' Set LinkTopic to PROGRAM MANAGER '--------------------------------- x.Label1.LinkTopic = "ProgMan|Progman" x.Label1.LinkMode = 2 For i% = 1 To 10 ' Loop to ensure that there is enough time to z% = DoEvents() ' process DDE Execute. This is redundant but needed Next ' for debug windows. x.Label1.LinkTimeout = 100 '------------------------------------------------ ' Create Program Item, one of the icons to launch ' an application from Program Manager '------------------------------------------------ '----- original --------------------------------- 'x.Label1.LinkExecute "[AddItem(" + CmdLine$ + Chr$(44) + IconTitle$ + Chr$(44) + ",,)]" '----- original --------------------------------- sParam = CmdLine$ + "," + IconTitle$ sParam = sParam + "," + IconPath$ + "," If IconIndex >= 0 Then sParam = sParam + Format$(IconIndex) x.Label1.LinkExecute "[AddItem(" + sParam + ")]" '----------------- ' Reset properties '----------------- x.Label1.LinkTimeout = 50 x.Label1.LinkMode = 0 Screen.MousePointer = 0 End Sub
Sub Form_Load () ... (略) ... '-------------------------------------- ' Create program manager group and icon '-------------------------------------- CreateProgManGroup Setup1, "ローン計算", "LOAN.GRP" '----- original ----------------------- 'CreateProgManItem Setup1, destPath$ + "LOAN.EXE", "ローン計算" '----- original ----------------------- CreateProgManItem Setup1, destPath$ + "LOAN.EXE", "ローン計算", destPath$ + "LOAN.EXE", -1 ' exe's default icon 'CreateProgManItem Setup1, destPath$ + "LOAN.EXE", "ローン計算", destPath$ + "LOAN.ICO", -1 ' icon file. ... (略) ... End Sub
Keywords: KBHOWTO KB410501
Technology: kbAudDeveloper kbVBSearch