Results 1 to 9 of 9

Thread: Allowing only one process per application.

  1. #1
    amac
    Guest

    Arrow

    An example of this is with ICQ...

    If you already have the application running, when run the application again it just makes itself active, instead of creating a new process...

    Anyone know how I can do this?

    Andrew

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Code:
    If App.PrevInstance Then
        ActivateApp "My App"
    End If
    ...or something like that
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Guest
    Thank you... that helps to answer my question... although it brings up another question...

    How can I instruct the current process to do something... like activating an event of a command button or something...

    Andrew

  4. #4
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Just activate your current prog and call an event handler
    Last edited by Lethal; Mar 11th, 2001 at 10:34 PM.

  5. #5
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    This will have a better result

    Code:
    Option Explicit
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As String) As Long
    Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Private Const SW_SHOWNORMAL = 1
    Private xhwnd As Long
    
    Public Sub Main()
    Dim xAppName As String
    If App.PrevInstance Then
        xAppName = "1 Instances For the Application"
        xhwnd = FindWindow(0&, xAppName)
        If xhwnd <> 0 Then
            AppActivate xAppName
            xhwnd = ShowWindow(xhwnd, SW_SHOWNORMAL)
            End
        End If
    End If
    
    Load frmMain
    frmMain.Show
    End Sub
    
    'Code improved by vBulletin Tool (Save as...)

  6. #6
    Guest
    How can I instruct the application being activated to perform a task... Say executing an event...

    Ive been lookin at DDE but how to go about that is something Id rather not do... for now...

    If there is an easier way I would appreciate the help...

    Andrew

  7. #7
    Guest

    Question

    Does anyone have an info that could help?

    I know its possible but the best way to go about doing it is what I am looking for.

    Andrew

  8. #8
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    amac, here is the sample program for DDE communication between 2 application.
    Hope it can help you too.
    Attached Files Attached Files

  9. #9
    Guest

    Red face

    Thank you very much... I will take a look at it... and see what i can do

    Andrew

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width