: : : 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