Willkommen ~Gast!
Registrieren || Einloggen || Hilfe/FAQ || Staff
Probleme mit der Registrierung im Forum? Melde dich unter registerEin Bild.
Autor Beitrag
000
12.12.2001, 18:43
RockingRolli



Hallo Leute :)

Da ich die letzten Tage nicht online gehen konnte, hab ich mich mal mit Visual Basic befasst. Eigentlich auch erfolgreich. Ich habe nur ein Problem:
Ich will per Command Button (o.ä.) ein Programm aufrufen, dessen Pfad in einer Variablen gespeichert ist.
Ich hab schon alles durchgesucht, aber nichts dazu gefunden.

Ich wäre euch dankbar, wenn ihr mir helfen könnt :)

Bis dann,
Rolli :)

ach ja: der neue Smiley ist cool ^^

--

zum Seitenanfang zum Seitenende Profil || Suche
001
12.12.2001, 20:09
apfelkorn



mh... da gabs doch in qbasic die funktion: system "command.com"

versuchs mal, man kann auch eine variable benutzen...

--

zum Seitenanfang zum Seitenende Profil || Suche
002
12.12.2001, 20:16
Retro



Geht so ganz einfach :)

AppActivate Shell("<Möp>.exe", 1)

Hmm, da deine Frage ja beantwortet sein dürfte darf ich ja mal anmerken dass der neue Smily :eek: ausschaut ;)

P.S.: Ne Millisekunde schneller als Hellfire:)

--

shielding people from their own stupidity is an evolutionary step backwards anyway.

/* God is dead!............Nietzsche */
/* Nietzsche is dead!......God */
/* Nietzsche is God!.......The Dead */


Dieser Beitrag wurde am 12.12.2001 um 20:17 von Retro bearbeitet.
zum Seitenanfang zum Seitenende Profil || Suche
003
12.12.2001, 20:16
Hellfire



Probier mal sowas hier: Shell "<Programm>", vbNormalFocus
Shell "explorer.exe", vbNormalFocus - ruft z.b. den Explorer auf.
[edit]
argh - Retro war schneller und scheint auch eine exaktere Lösung zu haben

--


Dieser Beitrag wurde am 12.12.2001 um 20:18 von Hellfire bearbeitet.
zum Seitenanfang zum Seitenende Profil || Suche
004
12.12.2001, 22:42
Ferdi



oder so: ;)

Quellcode:
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long

Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long

Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Const PROCESS_QUERY_INFORMATION = &H400
Const STATUS_PENDING = &H103&


Public Sub RunShell(cmdline$)
Dim hProcess As Long
Dim ProcessId As Long
Dim exitCode As Long
Dim r As Long

    ProcessId& = Shell(cmdline$, 1)
    hProcess& = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId&)
    Do
        Call GetExitCodeProcess(hProcess&, exitCode&)
        DoEvents
    Loop While exitCode& = STATUS_PENDING
    If exitCode& <> 0 Then
        MsgBox "Error Registering: " & cmdline$, vbExclamation, "ERROR"
    End If
    r = CloseHandle(hProcess)
End Sub

edit:
ähja...die oberste APIF hat hier keinen nennwert kann man aber auch verwenden....

--


Dieser Beitrag wurde am 12.12.2001 um 22:44 von Ferdi bearbeitet.
zum Seitenanfang zum Seitenende Profil || Suche