Hello Silvio,
The FIVEWIN-sample :
- Code: Select all Expand view RUN
function Main()
WinExec( "Calc" ) // Let's execute the calculator
MsgInfo( "Now we will close the calculator" )
// Use "Calculator" ( or "calc" ? ) in USA for "Calculadora"
SendMessage( FindWindow( 0, "Calculadora" ), WM_CLOSE )
MsgInfo( OemToAnsi( "Voil " ) )
return nil
Here is the original description from Microsoft for SHELLEXECUTE :
I think, only OPEN is possible.
- Code: Select all Expand view RUN
HINSTANCE ShellExecute( HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd )
Parameters
hwnd
------
A handle to the owner window used for displaying a user interface (UI) or error messages. This value can be NULL if the operation is not associated with a window.
lpOperation
-------------
-------------
A pointer to a null-terminated string, referred to in this case as a verb, that specifies the action to be performed. The set of available verbs depends on the particular file or folder. Generally, the actions available from an object's shortcut menu are available verbs.
The following verbs are commonly used:
edit
Launches an editor and opens the document for editing. If lpFile is not a document file, the function will fail.
explore
Explores a folder specified by lpFile.
find
Initiates a search beginning in the directory specified by lpDirectory.
open
Opens the item specified by the lpFile parameter. The item can be a file or folder.
print
Prints the file specified by lpFile. If lpFile is not a document file, the function fails.
NULL
In systems prior to Microsoft Windows 2000, the default verb is used if it is valid and available in the registry. If not, the "open" verb is used.
In Windows 2000 and later, the default verb is used if available. If not, the "open" verb is used. If neither verb is available, the system uses the first verb listed in the registry.
// -----------------------
To close the window, a different set of APIs would do the job
As a sample ( not Fivewin ) :
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Const WM_CLOSE = &H10
Private Sub cmdCloseApp_Click()
Dim lngCloseIt As Long
lngCloseIt = FindWindow(vbNullString, "Caption Of Window To Be Closed")
PostMessage lngCloseIt, WM_CLOSE, CLng(0), CLng(0)
End Sub
Regards
uwe