VBA

Moderators: PavlinII
Number of threads: 1673
Number of posts: 3078

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
call another application Posted by linz_hime on 4 Nov 2003 at 1:08 AM
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
Report
Re: call another application Posted by PavlinII on 12 Nov 2003 at 1:25 PM
: 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
Shell "C:\Windows\Notepad.exe", vbNormalFocus
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
Report
Re: call another application Posted by linz_hime on 18 Nov 2003 at 7:37 PM
: : 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
:
Shell "C:\Windows\Notepad.exe", vbNormalFocus
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\notepad.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?

Report
Re: call another application Posted by PavlinII on 21 Nov 2003 at 10:14 AM
: : : 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
: :
Shell "C:\Windows\Notepad.exe", vbNormalFocus
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\notepad.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:

[Appz]
a1=calc;calc.exe
a2=word;C:\Program Files\Office 2k\Office\WinWord.exe
a3=...


'Api
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                        'Let's get all items from INI file
    i = i + 1
    strName = "a" & i
    strItem = Space(255)
    GetPrivateProfileString "Appz", strName, vbNullString, strItem, 255, "AppzList.ini"
    'Add item to myList
    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    'On double click 
    myPath = myList.List(myList.ListIndex)          'Get selected item
    myPath = Mid(myPath, InStr(1, myPath, ";") + 1) 'Separate path
    Shell myPath, vbNormalFocus                     'GoGoGo!!!
End Sub

And that's all! If you want to nicer myList, you'll have to play with it..

PavlinII



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.