Very Crude Atari800Win Plus Front End
Posted: Sat Dec 29, 2007 1:46 am
... but it shows how to open other programs, how to simulate a drag and drop, and how to finish them off 
x_findwindow(), by the way, is just a wrapper for FindWindow_().

Code: Select all
IncludeFile "x_lib\x_lib.pb"
;
; start the emulator
;
i_program = RunProgram("C:\emulator_software\atari800win_plus\Atari800Win.exe","","",#PB_Program_Open)
;
; wait until it has started
;
Repeat
Until x_findwindow("*atari800win plus*",#True) = #True
;
; send it the file as a drag n drop action (as atari800win plus does not support command line options, we'll trick it
; by simulating drag'n'drop)
;
filename.s = "F:\emulator_data\atari_8bit\prg\pengo (1983).exe"
filename.s = "F:\emulator_data\atari_8bit\prg\pac-man - atari (19xx).exe"
filename_l = Len(filename)
buffer_h = GlobalAlloc_(#GMEM_MOVEABLE|#GMEM_ZEROINIT|#GMEM_DDESHARE,SizeOf(DROPFILES)+StringByteLength(filename)+2)
*buffer_m.DROPFILES = GlobalLock_(buffer_h)
*buffer_m\pFiles = SizeOf(DROPFILES)
*buffer_m\fWide = #True
PokeS(*buffer_m+SizeOf(DROPFILES),filename,-1,#PB_Unicode)
GlobalUnlock_(buffer_h)
PostMessage_(x_window_h,#WM_DROPFILES,buffer_h,0)
GlobalFree_(buffer_h)
;
; bring the atariwin800plus window to the foreground
;
SetForegroundWindow_(x_window_h)
;
; kill the program and close the connection
; ;
Repeat
Delay(64)
Until (GetKeyState_(#VK_ESCAPE) & %10000000) Or ProgramRunning(i_program) = #False
;
SendMessage_(x_window_h,#WM_CLOSE,0,0)
CloseProgram(i_program)
;
; and we're done
;