Attribute VB_Name = "mMain" Option Explicit Public Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Public Declare Function ReleaseCapture Lib "user32" () As Long Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public lHandle As Long Public Const WM_NCLBUTTONDOWN = &HA1 Public Const HTCAPTION = 2 Public b_form As Form1 Public a_form As frmTrial Public Type tagInitCommonControlsEx lngSize As Long lngICC As Long End Type Public Declare Function InitCommonControlsEx Lib "comctl32.dll" (iccex As tagInitCommonControlsEx) As Boolean Public Const ICC_USEREX_CLASSES = &H200 Public Sub Main() ' 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 Set b_form = New Form1 Load b_form 'If GetSetting("PPCalc", "Settings", "Serial") <> "" Then ' If ValidatePassword(GetSetting("PPCalc", "Settings", "Serial")) = True And GetSetting("PPCalc", "Settings", "Name") <> "" Then b_form.Show ' Else ' GoTo serial_needed ' End If 'Else ' GoTo serial_needed 'End If Exit Sub serial_needed: If GetSetting("PPCalc", "Settings", "ExpDate") = "" Then SaveSetting "PPCalc", "Settings", "ExpDate", Format(DateAdd("d", 30, Now), "General Date") End If Set a_form = New frmTrial Load a_form a_form.Show End Sub Public Function AppPath() As String AppPath = IIf(Right(App.Path, 1) = "\", App.Path, App.Path & "\") End Function Public Sub DragEntireForm(Button As Integer, Shift As Integer, X As Single, Y As Single, obj As Form) If Button = 1 Then ReleaseCapture SendMessage obj.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0 End If End Sub Public Sub EndTheProgram() Dim frm As Form For Each frm In Forms Unload frm Next End Sub Public Function ValidatePassword(ByRef input_str As String) As Boolean ValidatePassword = False If input_str = "YSFdS-XkPP9-Qq5M0-49eQN-bYzPs" Then ValidatePassword = True End If End Function