Private Declare Function InitCommonControlsEx Lib "comctl32.dll" (iccex As tagInitCommonControlsEx) As Boolean
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Declare Function LoadImageAsString Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal uType As Long, ByVal cxDesired As Long, ByVal cyDesired As Long, ByVal fuLoad As Long) As Long
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Sub Main()
'Don't allow a second instance of the app
If App.PrevInstance = True Then
MsgBox "Sorry, but this program is already running !", vbApplicationModal Or vbInformation Or vbOKOnly
End
End If
' we need to call InitCommonControls before we can use XP visual styles.
' Here I'm using InitCommonControlsEx, which is the extended version
' provided in v4.72 upwards (you need v6.00 or higher to get XP styles)
On Error Resume Next
' this will fail if Comctl not available - unlikely now though!
Dim iccex As tagInitCommonControlsEx
With iccex
.lngSize = LenB(iccex)
.lngICC = ICC_USEREX_CLASSES
End With
InitCommonControlsEx iccex
' now start the application
On Error GoTo 0
frmMain.Show
End Sub
Public Sub SetIcon(ByVal hwnd As Long, ByVal sIconResName As String, Optional ByVal bSetAsAppIcon As Boolean = True)