Additional info can be found at this link.
http://support.microsoft.com/support...s/Q97/9/25.ASP
Cecil

------------------
Declare Function MySubCall(ByVal p1 As Long, ByVal p2 As Long) As Long Sub SwitchToThisWindow (hWnd As Long) Static SubrAddr As Dword, lResult As Long If SubrAddr = 0 Then _ SubrAddr = GetProcAddress(GetModuleHandle("user32.dll"), "SwitchToThisWindow") Call Dword SubrAddr Using MySubCall&(hWnd, %True) To lResult End Sub
hPrevWnd = FindWindow(BYVAL wndClass.lpszClassName, BYVAL 0) IF ISTRUE hPrevWnd THEN IF ISTRUE IsIconic(hPrevWnd) THEN ShowWindow hPrevWnd, %SW_RESTORE SetforegroundWindow hPrevWnd FUNCTION = 0 EXIT FUNCTION END IF
#Compile Exe #Dim All #Register None #Include "WIN32API.INC" Function PbMain() Local hMutex As Long, hDlg As Long, PrgName As Asciiz * %MAX_PATH PrgName = "Any unique name" ' Important hMutex = CreateMutex(ByVal %Null, 0, PrgName): _ If hMutex = 0 Then Exit Function ' Error in Mutex If GetLastError = %ERROR_ALREADY_EXISTS Then _ MsgBox "Already running": Exit Function Dialog New hDlg, "First Instance", , , 100, 100, %WS_SYSMENU To hDlg Dialog Show Modal hDlg CloseHandle hMutex ' Possible to delete End Function
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: