Is it possible to close a window(process)
that i startet with
Execfile?
Thanks,
soli
that i startet with
Execfile?
Thanks,
soli
ExecFile "command /c ping.exe 127.0.0.1 >testping.txt"
;own window for testing Graphics 600,400,16,2 AppTitle "mywindow" Global handlewinhlp% ;the app that i wanted to execute If FileType("c:/windows/winhlp32.exe")=1 Then helpprogramm$="winhlp32" If FileType("c:/windows/winhlp.exe")=1 Then helpprogramm$="winhlp" ;my rules-file mydir$="d:/eigene dateien/blitz/games/as-solitaire/" helpfile$=mydir$+"soli.hlp" ;only importand for my-file tmpas=23 ; pointer for testing parameter$=" -I SHM_contents" number$=Right$("0000"+Str$(tmpas),4) ;here i start the app ExecFile (helpprogramm$+" "+parameter$+number$+" "+helpfile$) ;only for testing, i wait until the app has startet properly Delay 1000 ;i get a handle, everything is fine. handlewinhlp%=api_FindWindow(0,"AS-Solitaire Spielregeln") DebugLog handlewinhlp% ;i wait until i want to close the help-window WaitKey() ; i get an "Memory Access Violation" :-(((( api_SendMessage(handlewinhlp%,WM_CLOSE,0,0) ; wait to end While Not KeyHit(1) Wend End
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) { if(!hPrevInstance) { // create the window }
CreateMutex(0,1,"My Help File") If GetLastError() = ERROR_ALREADY_EXISTS Then result = 0 Else result = 1 EndIf If result = 1 ExecFile("help\help.chm") EndIf
Graphics 640,480,0,2 AppTitle "hello" Const ERROR_ALREADY_EXISTS=183 CreateMutex(0,1,"hello") If GetLastError()=ERROR_ALREADY_EXISTS Text 0,0,"Yep" Else Text 0,0,"Nope" End If WaitKey()
Graphics 600,400,16,2 AppTitle "mywindow" Global handlewinhlp% Global apptitlename$="Rechner" Global appname$="c:/windows/calc.exe" ; to show that it only run once While Not KeyHit(1) handlewinhlp%=api_FindWindow(0,apptitlename$) If handlewinhlp%=0 ExecFile (appname$) ;wait until the app is open Delay 1000 EndIf Wend End
Graphics 600,400,16,2 AppTitle "mywindow" Global handlewinhlp% Global apptitlename$="Calculator" Global appname$="calc.exe" ; to show that it only run once While Not KeyHit(1) handlewinhlp%=api_FindWindow(0,apptitlename$) If handlewinhlp%=0 ExecFile (appname$) ;wait until the app is open Delay 1000 EndIf Wend End
