This works for me:
#DEFINE WM_CLOSE 0x10
DECLARE LONG FindWindow IN User32 ;
STRING cClassName, STRING cWindowTitle
DECLARE LONG SendMessage IN User32 ;
LONG HWND, LONG Msg, LONG wParam, LONG LPARAM
HWND = FindWindow( NULL, 'Calculator')
IF HWND > 0
SendMessage( HWND, WM_CLOSE, 0, 0 )
ENDIF
RETURN
>I try to close another Application eg. Ms Calculator by using API call. I try the following code but it does not work.
>
>
>
>DECLARE INTEGER FindWindow ;
> IN WIN32API STRING cNull,STRING cWinName
>
>
>DECLARE INTEGER SendMessage IN user32;
> INTEGER hWnd,;
> INTEGER Msg,;
> INTEGER wParam,;
> INTEGER lParam
>
>
>mWinHandle = FindWindow(0,'Calculator')
>IF mWinHandle > 0
> SendMessage(mWinHandle,10,0,0)
>ELSE
> MESSAGEBOX(mWinHandle)
>ENDIF
.·*´¨)
.·`TCH
(..·*
010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"