Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


Visual Basic Programming Code Examples

Visual Basic > Windows and Controls Code Examples

Make programgroup en icons in win3.x

Make programgroup en icons in win3.x 'VB3 & win3.x 'use as 'Call CreateProgManGroup(Form1,[groupname],[groupfile]) 'Call CreateProgManItem(Form1,[path&executablename],[iconname]) ' Procedure: CreateProgManGroup ' Arguments: X The Form where a Label1 exist ' GroupName$ A string that contains the group name ' GroupPath$ A string that contains the group file ' name ie 'myapp.grp' Sub CreateProgManGroup (x as Form, GroupName$, GroupPath$) 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 group x.Label1.LinkExecute "[CreateGroup(" + GroupName$ + Chr$(44) + GroupPath$ + ")]" ' Reset properties x.Label1.LinkTimeout = 50 x.Label1.LinkMode = 0 Screen.MousePointer = 0 End Sub ' 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 Sub CreateProgManItem (x as Form, CmdLine$, IconTitle$) 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 ' Win 3.1 has a ReplaceItem, which will allow us to replace existing icons x.Label1.LinkExecute "[ReplaceItem(" + IconTitle$ + ")]" x.Label1.LinkExecute "[AddItem(" + CmdLine$ + Chr$(44) + IconTitle$ + Chr$(44) + ",,)]" x.Label1.LinkExecute "[ShowGroup(groupname, 1)]" ' This will ensure that program manager does not ' have a Maximized group, which causes problem in RestoreProgMan ' Reset properties x.Label1.LinkTimeout = 50 x.Label1.LinkMode = 0 Screen.MousePointer = 0 End Sub Return