Article ID: 119724
Article Last Modified on 6/13/2001
Table: tbl_Progman
------------------------
Field Name: mGroupName
Data Type: Text
Field Size: 30
Required: Yes
Field Name: mIconText
Data Type: Text
Field Size: 40
Required: Yes
Field Name: mIconFile
Data Type: Text
Field Size: 50
Field Name: mIconNum
Data Type: Text
Field Size: 5
Field Name: mCommandLine
Data Type: Text
Field Size: 120
Required: Yes
Field Name: mIconDefault
Data Type: Text
Field Size: 120
The following list describes the tbl_Progman table specifications:
mGroupName: NWIND Utilities
mIconText: My README.TXT
mCommandLine: NOTEPAD.EXE NWIND.TXT
NOTE: In the following example, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this example.
mGroupName: NWIND Utilities
mIconText: Repair/Compact NWIND
mIconFile: PROGMAN.EXE
mIconNum: 22
mCommandLine: MSARN200.EXE NWIND.MDB /ini myapp.ini /Repair / _
Compact
mGroupName: NWIND Utilities
mIconText: Solutions Database
mIconFile: PROGMAN.EXE
mIconNum: 16
mCommandLine: MSARN200.EXE SOLUTION.MDB /ini myapp.ini
Option Explicit
NOTE: In the following sample code, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.
'***************************************************
' FUNCTION: CreateProgmanGroupIcons()
'
' PURPOSE:
' To create Program Manager groups and icons
' when the application is run for the first time.
'***************************************************
Function CreateProgmanGroupIcons ()
Dim mydb As Database, rs As Recordset, Rcount As Integer, Xyz _
As Integer
Dim chan As Integer, Exe As String
Dim GroupName$, IconText$, IconFile$, IconNum$, CommandLine$, _
IconDefault$
On Error GoTo Creat_Errors
DoCmd Hourglass False
Set mydb = CurrentDB()
Set rs = mydb.OpenRecordset("tbl_Progman", DB_OPEN_DYNASET)
rs.MoveLast
Rcount = rs.recordcount
rs.MoveFirst
'Begin a DDE conversation with Program Manager.
chan = DDEInitiate("PROGMAN", "PROGMAN")
For Xyz = 1 To Rcount
GroupName$ = rs![mGroupName]
IconText$ = rs![mIconText]
IconFile$ = IIf(IsNull(rs![mIconFile]), "", rs![mIconFile])
IconNum$ = IIf(IsNull(rs![mIconNum]), "", rs![mIconNum])
CommandLine$ = CurDir & "\" & rs![mCommandLine]
IconDefault$ = IIf(IsNull(rs![mIconDefault]), CurDir, _
rs![mIconDefault])
'GroupName is a string that names the group to be created or
'activated.
'Run the CreateGroup DDE command to PROGMAN.
DDEExecute chan, "[CreateGroup(" & GroupName$ & ")]"
On Error Resume Next
'If duplicate icons exist, they will be replaced.
DDEExecute chan, "[ReplaceItem(" & IconText$ & ")]"
'Instruct Program Manager to create a new program icon in
'the active group specified by the variable GroupName.
'Run the AddItem DDE command to PROGMAN.
Exe = "[AddItem(" & CommandLine$ & ", " & IconText$ & ", " & _
IconFile$ & ", " & IconNum$ & ",,, " & IconDefault$ & ")]"
DDEExecute chan, Exe
rs.MoveNext
Next Xyz
rs.Close
mydb.tabledefs.Delete "tbl_Progman"
DDETerminate chan
DoCmd Hourglass False
Exit Function
Creat_Errors:
If Err = 3011 Then
Exit Function
Else
MsgBox Error$
End If
End Function
Macro Name Macro Actions
--------------------------
AutoExec RunCode
AutoExec Actions
-------------------------------------------
RunCode
Function Name: CreateProgmanGroupIcons()
NOTE: The first time the application is run, the AutoExec macro runs the CreateProgmanGroupIcons() function to create the Program Manager groups and icons specified in the tbl_Progman table.
Additional query words: install
Keywords: kbinfo KB119724