call another application - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

call another application

linz_himelinz_hime Posts: 36Member
can anyone tell me how's the way to call an aplication use form in VB ?
for example : i make list of menu, when i'm doble click one of the list, it will show another application/exe from another folder

Comments

  • PavlinIIPavlinII Posts: 404Member
    : can anyone tell me how's the way to call an aplication use form in VB ?
    : for example : i make list of menu, when i'm doble click one of the list, it will show another application/exe from another folder
    :
    Hi, the most simple way is
    [code]Shell "C:WindowsNotepad.exe", vbNormalFocus[/code]Function Shell executes inserted command in the same way like when you wrote that command to command bar (Start/Run... or anywhere)
    To start process and wait for it's end is little more difficult but still possible..


    PavlinII
  • linz_himelinz_hime Posts: 36Member
    : : can anyone tell me how's the way to call an aplication use form in VB ?
    : : for example : i make list of menu, when i'm doble click one of the list, it will show another application/exe from another folder
    : :
    : Hi, the most simple way is
    : [code]Shell "C:WindowsNotepad.exe", vbNormalFocus[/code]Function Shell executes inserted command in the same way like when you wrote that command to command bar (Start/Run... or anywhere)
    : To start process and wait for it's end is little more difficult but still possible..
    :
    :
    : PavlinII
    :
    i've seen an application like i explained, it used a file *.ini
    when i wrote the location, for example :
    n1=learning komputer;windows
    otepad.exe;
    n2=...
    then it shows in the list of the menu.exe and we can double click it.
    Then i think can i make this in VB?

  • PavlinIIPavlinII Posts: 404Member
    : : : can anyone tell me how's the way to call an aplication use form in VB ?
    : : : for example : i make list of menu, when i'm doble click one of the list, it will show another application/exe from another folder
    : : :
    : : Hi, the most simple way is
    : : [code]Shell "C:WindowsNotepad.exe", vbNormalFocus[/code]Function Shell executes inserted command in the same way like when you wrote that command to command bar (Start/Run... or anywhere)
    : : To start process and wait for it's end is little more difficult but still possible..
    : :
    : :
    : : PavlinII
    : :
    : i've seen an application like i explained, it used a file *.ini
    : when i wrote the location, for example :
    : n1=learning komputer;windows
    otepad.exe;
    : n2=...
    : then it shows in the list of the menu.exe and we can double click it.
    : Then i think can i make this in VB?
    :
    :
    Of course..
    Create ListBox on form and name it myList.
    Create AppzList.ini like this:
    [blue]
    [Appz]
    a1=calc;calc.exe
    a2=word;C:Program FilesOffice 2kOfficeWinWord.exe
    a3=...[/blue]

    [code][green]'Api[/green]
    Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long


    Private Sub Form_Load()
    Dim strItem As String, strName As String
    On Error GoTo fExitDo
    Do [green]'Let's get all items from INI file[/green]
    i = i + 1
    strName = "a" & i
    strItem = Space(255)
    GetPrivateProfileString "Appz", strName, vbNullString, strItem, 255, "AppzList.ini"
    [green]'Add item to myList[/green]
    If strItem <> vbNullString Then myList.AddItem (Left(strItem, InStr(1, strItem, Chr(0)) - 1))
    Loop
    fExitDo:
    End Sub

    Private Sub myList_DblClick()
    Dim myPath As String [green]'On double click [/green]
    myPath = myList.List(myList.ListIndex) [green]'Get selected item[/green]
    myPath = Mid(myPath, InStr(1, myPath, ";") + 1) [green]'Separate path[/green]
    Shell myPath, vbNormalFocus [green]'GoGoGo!!![/green]
    End Sub[/code]
    And that's all! If you want to nicer myList, you'll have to play with it..

    PavlinII
Sign In or Register to comment.