AW: externes Programm öffnen
14.10.2003 12:50:17
Dan
Hallo Olaf,
versuch es mit diesem code, aber ich habe es nicht geteste, also mogliche weisse ist es ganz fals :-). Und erstmals musst du die konstante WindowsText$ ganz genau auf den text des windows Star Money setzen und auch die konstante ProgName$ muss ganz genau dem namen des programms entsprechen. Lass es mich wissen ob es lauft mailto : dusek@cb.vakjc.cz
Dan.
--Diesen code in ein form mit einem button namens cmdFindStartMoney kopieren
Option Explicit
'The FindWindow function retrieves the handle to the top-level window whose class name and window name match the specified strings. This function does not search child windows.
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, 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 Const WindowsText$ = "Start Money"
Private Const ProgName$ = "Star Money.exe"
Private Sub cmdFindStartMoney_Click()
Dim hwnd&
hwnd& = FindWindow(vbNullString, WindowsText$)
If (hwnd& = 0) Then
MsgBox "Couldn't find the window ... I'll try to open it.": Shell ProgName$, vbMaximizedFocus
Else
'Show the window
ShowWindow WinWnd, SW_SHOWNORMAL
End If
End Sub