OpenProcess_
Posted: Thu Aug 15, 2024 12:37 pm
Am I doing something wrong? I can't set the window text or minimise the opened program.
test.exe is a simple PB executable:
Code: Select all
EnableExplicit
Define prog = RunProgram("test.exe", "", "", #PB_Program_Open)
Define error
Define errorMsg.s = Space(255)
If IsProgram(prog)
Define progHandle = OpenProcess_(#PROCESS_ALL_ACCESS, #False, ProgramID(prog))
Define error = GetLastError_()
FormatMessage_(#FORMAT_MESSAGE_FROM_SYSTEM, #Null, error, 0, @errorMsg, 255, #Null)
SetWindowText_(progHandle, "testing")
ShowWindow_(progHandle, #SW_HIDE)
EndIf
CloseProgram(prog)Code: Select all
OpenWindow(0, 100, 100, 640, 480, "", #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_MinimizeGadget)
Global quit
Repeat
event = WaitWindowEvent()
If event = #PB_Event_CloseWindow
quit = #True
EndIf
Until quit