PureBasic Take Over!
PureBasic Take Over!
Ugh!... Is there any way to start a program in PB without it taking over the other programs ability to read and write... =\...
Re: PureBasic Take Over!
What do you mean? Can you give an example?
All of this code works... o_O but it takes over the program... It won't allow the program to read and write... =\ So the program being run cant get the info it neads to make the particles...
Code: Select all
;#STANDARD_RIGHTS_REQUIRED = $000F0000
;#SYNCHRONIZE = $00100000
;#PROCESS_ALL_ACCESS = #STANDARD_RIGHTS_REQUIRED+#SYNCHRONIZE+$0FFF
;ProgramName.s = "System/Particles.exe"
;WindowTitle.s = "Particles v0.0.2 Alpha Runtime Window - Puff Inter@ctive"
;RunProgram(ProgramName.s)
; ProcessId.l
; ExitCode.l
; hWindow = FindWindow_(0, WindowTitle)
; GetWindowThreadProcessId_(hWindow, @ProcessId)
; hProcess = OpenProcess_(#PROCESS_ALL_ACCESS, #TRUE, ProcessId)
; GetExitCodeProcess_(hProcess, @ExitCode)
; TerminateProcess_(hProcess, ExitCode)
; ProcessId.l
; ExitCode.l
; hWindow = FindWindow_(0, WindowTitle)
; GetWindowThreadProcessId_(hWindow, @ProcessId)
; hProcess = OpenProcess_(#PROCESS_ALL_ACCESS, #TRUE, ProcessId)
; GetExitCodeProcess_(hProcess, @ExitCode)
; TerminateProcess_(hProcess, ExitCode) Heres all of the code... o_O Its a purebasic problem... =\ (no explanation... I don't know why just starting up a program with this one will not allow the other program to access .dat files and read strings to turn the info into ints and make it so the other program and "talk with this one")
Code: Select all
;#STANDARD_RIGHTS_REQUIRED = $000F0000
;#SYNCHRONIZE = $00100000
;#PROCESS_ALL_ACCESS = #STANDARD_RIGHTS_REQUIRED+#SYNCHRONIZE+$0FFF
;ProgramName.s = "System/Particles.exe"
;WindowTitle.s = "Particles v0.0.2 Alpha Runtime Window - Puff Inter@ctive"
;RunProgram(ProgramName.s)
If OpenWindow(0,0,0,215,375, #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_MinimizeGadget,"Particles v0.0.2 Alpha")
If CreateToolBar(0, WindowID())
ToolBarStandardButton(0, #PB_ToolBarIcon_New)
ToolBarStandardButton(1, #PB_ToolBarIcon_Open)
ToolBarStandardButton(2, #PB_ToolBarIcon_Save)
ToolBarSeparator()
ToolBarStandardButton(6, #PB_ToolBarIcon_Print)
ToolBarSeparator()
ToolBarStandardButton(4, #PB_ToolBarIcon_Help)
EndIf
If CreateMenu(0, WindowID())
MenuTitle("File")
MenuItem( 0, "New")
MenuBar()
MenuItem( 1, "Open")
MenuItem( 2, "Save")
MenuBar()
OpenSubMenu("Recent")
CloseSubMenu()
MenuBar()
MenuItem( 3, "Exit")
MenuTitle("Help")
MenuItem(4, "Help")
MenuBar()
MenuItem(5, "About")
EndIf
If CreateGadgetList(WindowID())
PanelGadget(0,0,30,215,325)
AddGadgetItem(0,0,"Variables")
TextGadget(1, 0, 0, 75, 25, "Radius", #PB_Text_Center)
ButtonGadget(2, 75, 0, 15, 25, "<=")
ButtonGadget(3, 90, 0, 15, 25, "<")
StringGadget(4, 105, 0, 75, 25, Radius2.s , #PB_String_Numeric)
ButtonGadget(5, 180, 0, 15, 25, ">")
ButtonGadget(6, 195, 0, 15, 25, "=>")
TextGadget(7, 0, 25, 75, 25, "Speed" , #PB_Text_Center)
ButtonGadget(8, 75, 25, 15, 25, "<=")
ButtonGadget(9, 90, 25, 15, 25, "<")
StringGadget(10, 105, 25, 75, 25, Speed2.s, #PB_String_Numeric)
ButtonGadget(11, 180, 25, 15, 25, ">")
ButtonGadget(12, 195, 25, 15, 25, "=>")
TextGadget(13, 0, 50, 75, 25, "Gravity" , #PB_Text_Center)
ButtonGadget(14, 75, 50, 15, 25, "<=")
ButtonGadget(15, 90, 50, 15, 25, "<")
StringGadget(16, 105, 50, 75, 25, Gravity2.s , #PB_String_Numeric)
ButtonGadget(17, 180, 50, 15, 25, ">")
ButtonGadget(18, 195, 50, 15, 25, "=>")
TextGadget(19, 0, 75, 75, 25, "Velocity" , #PB_Text_Center)
ButtonGadget(20, 75, 75, 15, 25, "<=")
ButtonGadget(21, 90, 75, 15, 25, "<")
StringGadget(22, 105, 75, 75, 25, Velocity2.s , #PB_String_Numeric)
ButtonGadget(23, 180, 75, 15, 25, ">")
ButtonGadget(24, 195, 75, 15, 25, "=>")
TextGadget(25, 0, 100, 75, 25, "Chaos" , #PB_Text_Center)
ButtonGadget(26, 75, 100, 15, 25, "<=")
ButtonGadget(27, 90, 100, 15, 25, "<")
StringGadget(28, 105, 100, 75, 25, Chaos2.s , #PB_String_Numeric)
ButtonGadget(29, 180, 100, 15, 25, ">")
ButtonGadget(30, 195, 100, 15, 25, "=>")
TextGadget(31, 0, 125, 75, 25, "Life" , #PB_Text_Center)
ButtonGadget(32, 75, 125, 15, 25, "<=")
ButtonGadget(33, 90, 125, 15, 25, "<")
StringGadget(34, 105, 125, 75, 25, Life2.s , #PB_String_Numeric)
ButtonGadget(35, 180, 125, 15, 25, ">")
ButtonGadget(36, 195, 125, 15, 25, "=>")
TextGadget(37, 0, 150, 75, 25, "Emissions" , #PB_Text_Center)
ButtonGadget(38, 75, 150, 15, 25, "<=")
ButtonGadget(39, 90, 150, 15, 25, "<")
StringGadget(40, 105, 150, 75, 25, Emissions2.s , #PB_String_Numeric)
ButtonGadget(41, 180, 150, 15, 25, ">")
ButtonGadget(42, 195, 150, 15, 25, "=>")
TextGadget(43, 0, 175, 75, 25, "Frequency" , #PB_Text_Center)
ButtonGadget(44, 75, 175, 15, 25, "<=")
ButtonGadget(45, 90, 175, 15, 25, "<")
StringGadget(46, 105, 175, 75, 25, Frequency2.s , #PB_String_Numeric)
ButtonGadget(47, 180, 175, 15, 25, ">")
ButtonGadget(48, 195, 175, 15, 25, "=>")
TextGadget(49, 0, 200, 75, 25, "Depth" , #PB_Text_Center)
ButtonGadget(50, 75, 200, 15, 25, "<=")
ButtonGadget(51, 90, 200, 15, 25, "<")
StringGadget(52, 105, 200, 75, 25, Depth2.s, #PB_String_Numeric)
ButtonGadget(53, 180, 200, 15, 25, ">")
ButtonGadget(54, 195, 200, 15, 25, "=>")
TextGadget(55, 0, 225, 75, 25, "Height" , #PB_Text_Center)
ButtonGadget(56, 75, 225, 15, 25, "<=")
ButtonGadget(57, 90, 225, 15, 25, "<")
StringGadget(58, 105, 225, 75, 25, Height2.s, #PB_String_Numeric)
ButtonGadget(59, 180, 225, 15, 25, ">")
ButtonGadget(60, 195, 225, 15, 25, "=>")
TextGadget(61, 0, 250, 75, 25, "Width" , #PB_Text_Center)
ButtonGadget(62, 75, 250, 15, 25, "<=")
ButtonGadget(63, 90, 250, 15, 25, "<")
StringGadget(64, 105, 250, 75, 25, Width2.s, #PB_String_Numeric)
ButtonGadget(65, 180, 250, 15, 25, ">")
ButtonGadget(66, 195, 250, 15, 25, "=>")
CheckBoxGadget(67, 0, 275, 215, 25, "Floor | Key: [>] +\- Less [=>] +\- More")
AddGadgetItem(0,0,"Image")
ButtonGadget(68, 0, 0, 75, 25, "Open Image")
ButtonGadget(69, 0, 25, 75, 25, "Pick Color")
OptionGadget(70, 100, 0, 125, 25, "Use Image [32x32]")
OptionGadget(71, 100, 25, 75, 25, "Use Color")
TextGadget(72, 0, 75, 150, 25, "Current Image:")
ImageGadget(77, 75, 70, 32, 32, 0, #PB_Image_Border)
TextGadget(73, 0, 175, 150, 25, "Current Color:")
AddGadgetItem(0,0,"Effect")
ButtonGadget(74, 0, 0, 210, 100, "Fountain")
ButtonGadget(75, 0, 100, 210, 100, "Fire")
ButtonGadget(76, 0, 200, 210, 100, "Snow")
AddGadgetItem(0,0,"Rotation")
ClosePanelGadget()
EndIf
Radius.l
Radius=20
Radius2.s=Str(Radius)
SetGadgetText(4, Radius2.s)
Speed.f
Speed=0.01
Speed2.s=StrF(Speed)
SetGadgetText(10, Speed2.s)
Gravity.l
Gravity=2
Gravity2.s=Str(Gravity)
SetGadgetText(16, Gravity2.s)
Velocity.l
Velocity=5
Velocity2.s=Str(Velocity)
SetGadgetText(22, Velocity2.s)
Chaos.l
Chaos=0
Chaos2.s=Str(Chaos)
SetGadgetText(28, Chaos2.s)
Life.l
Life=100
Life2.s=Str(Life)
SetGadgetText(34, Life2.s)
Emissions.l
Emissions=10
Emissions2.s=Str(Emissions)
SetGadgetText(40, Emissions2.s)
Frequency.l
Frequency=100
Frequency2.s=Str(Frequency)
SetGadgetText(46, Frequency2.s)
Depth.f
Depth=5
Depth2.s=StrF(Depth)
SetGadgetText(52, Depth2.s)
Height.f
Height=5
Height2.s=StrF(Height)
SetGadgetText(58, Height2.s)
Width.f
Width=5
Width2.s=StrF(Width)
SetGadgetText(64, Width2.s)
Floor.b
SetGadgetState(67, 1)
Floor=GetGadgetState(67)
Image.b
SetGadgetState(71, 1)
Image=GetGadgetState(70)
small.b
big.b
InitKeyboard()
Repeat
ExamineKeyboard()
If KeyboardPushed(#PB_Key_All)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
EndIf
file.s = "System\Update.dat"
DeleteFile(file.s)
OpenFile(0,file.s)
WriteStringN(GetGadgetText(4))
WriteStringN(GetGadgetText(10))
WriteStringN(GetGadgetText(16))
WriteStringN(GetGadgetText(22))
WriteStringN(GetGadgetText(28))
WriteStringN(GetGadgetText(34))
WriteStringN(GetGadgetText(40))
WriteStringN(GetGadgetText(46))
WriteStringN(GetGadgetText(52))
WriteStringN(GetGadgetText(58))
WriteStringN(GetGadgetText(64))
WriteStringN(Str(GetGadgetState(67)))
WriteStringN(Str(GetGadgetState(70)))
WriteStringN(Str(GetGadgetState(71)))
path.s=GetPathPart(File2.s)
WriteStringN(path.s)
part.s=GetFilePart(File2.s)
WriteString(part.s)
CloseFile(0)
nop.s="System\nop.dat"
If FileSize(nop.s)<>-1
DeleteFile(nop.s)
MessageRequester("Particles - Error!", "The specified path does not exist!", #PB_MessageRequester_Ok)
EndIf
noi.s="System\noi.dat"
If FileSize(noi.s)<>-1
DeleteFile(noi.s)
MessageRequester("Particles - Error!", "The specified image does not exist!", #PB_MessageRequester_Ok)
EndIf
EventID.l = WaitWindowEvent()
If EventID = #PB_EventMenu
Select EventMenuID()
Case 0
Radius=20
Radius2.s=Str(Radius)
SetGadgetText(4, Radius2.s)
Speed=0.01
Speed2.s=StrF(Speed)
SetGadgetText(10, Speed2.s)
Gravity=2
Gravity2.s=Str(Gravity)
SetGadgetText(16, Gravity2.s)
Velocity=5
Velocity2.s=Str(Velocity)
SetGadgetText(22, Velocity2.s)
Chaos=0
Chaos2.s=Str(Chaos)
SetGadgetText(28, Chaos2.s)
Life=100
Life2.s=Str(Life)
SetGadgetText(34, Life2.s)
Emissions=10
Emissions2.s=Str(Emissions)
SetGadgetText(40, Emissions2.s)
Frequency=100
Frequency2.s=Str(Frequency)
SetGadgetText(46, Frequency2.s)
Depth=5
Depth2.s=StrF(Depth)
SetGadgetText(52, Depth2.s)
Height=5
Height2.s=StrF(Height)
SetGadgetText(58, Height2.s)
Width=5
Width2.s=StrF(Width)
SetGadgetText(64, Width2.s)
SetGadgetState(67, 1)
Floor=GetGadgetState(67)
SetGadgetState(70, 0)
SetGadgetState(71, 1)
Image=GetGadgetState(70)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 1
File.s = OpenFileRequester("Particles - Open", "C:\", "Particle (*.part)|*.part", 0)
If File.s+File.s
MessageRequester("Information", "Selected File: "+File.s, 0)
EndIf
Case 2
File.s = SaveFileRequester("Particles - Save", "C:\", "Particle (*.part)|*.part", 1)
If File.s
MessageRequester("Information", "Selected File: "+File.s, 0)
EndIf
Case 3
; ProcessId.l
; ExitCode.l
; hWindow = FindWindow_(0, WindowTitle)
; GetWindowThreadProcessId_(hWindow, @ProcessId)
; hProcess = OpenProcess_(#PROCESS_ALL_ACCESS, #TRUE, ProcessId)
; GetExitCodeProcess_(hProcess, @ExitCode)
; TerminateProcess_(hProcess, ExitCode)
End
EndSelect
EndIf
If EventID = #PB_EventGadget
Select EventGadgetID()
Case 2
Radius2.s=GetGadgetText(4)
Radius=Val(Radius2.s)
Radius=Radius-5
Radius2.s=Str(Radius)
SetGadgetText(4, Radius2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 3
Radius2.s=GetGadgetText(4)
Radius=Val(Radius2.s)
Radius=Radius-1
Radius2.s=Str(Radius)
SetGadgetText(4, Radius2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 5
Radius2.s=GetGadgetText(4)
Radius=Val(Radius2.s)
Radius=Radius+1
Radius2.s=Str(Radius)
SetGadgetText(4, Radius2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 6
Radius2.s=GetGadgetText(4)
Radius=Val(Radius2.s)
Radius=Radius+5
Radius2.s=StrF(Radius)
SetGadgetText(4, Radius2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 8
Speed2.s=GetGadgetText(10)
Speed=ValF(Speed2.s)
Speed=Speed-0.000005
Speed2.s=StrF(Speed)
SetGadgetText(10, Speed2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 9
Speed2.s=GetGadgetText(10)
Speed=ValF(Speed2.s)
Speed=Speed-0.000001
Speed2.s=StrF(Speed)
SetGadgetText(10, Speed2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 11
Speed2.s=GetGadgetText(10)
Speed=ValF(Speed2.s)
Speed=Speed+0.000001
Speed2.s=StrF(Speed)
SetGadgetText(10, Speed2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 12
Speed2.s=GetGadgetText(10)
Speed=ValF(Speed2.s)
Speed=Speed+0.000005
Speed2.s=StrF(Speed)
SetGadgetText(10, Speed2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 14
Gravity2.s=GetGadgetText(16)
Gravity=Val(Gravity2.s)
Gravity=Gravity-5
Gravity2.s=Str(Gravity)
SetGadgetText(16, Gravity2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 15
Gravity2.s=GetGadgetText(16)
Gravity=Val(Gravity2.s)
Gravity=Gravity-1
Gravity2.s=Str(Gravity)
SetGadgetText(16, Gravity2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 17
Gravity2.s=GetGadgetText(16)
Gravity=Val(Gravity2.s)
Gravity=Gravity+1
Gravity2.s=Str(Gravity)
SetGadgetText(16, Gravity2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 18
Gravity2.s=GetGadgetText(16)
Gravity=Val(Gravity2.s)
Gravity=Gravity+5
Gravity2.s=Str(Gravity)
SetGadgetText(16, Gravity2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 20
Velocity2.s=GetGadgetText(22)
Velocity=Val(Velocity2.s)
Velocity=Velocity-5
Velocity2.s=Str(Velocity)
SetGadgetText(22, Velocity2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 21
Velocity2.s=GetGadgetText(22)
Velocity=Val(Velocity2.s)
Velocity=Velocity-1
Velocity2.s=Str(Velocity)
SetGadgetText(22, Velocity2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 23
Velocity2.s=GetGadgetText(22)
Velocity=Val(Velocity2.s)
Velocity=Velocity+1
Velocity2.s=Str(Velocity)
SetGadgetText(22, Velocity2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 24
Velocity2.s=GetGadgetText(22)
Velocity=Val(Velocity2.s)
Velocity=Velocity+5
Velocity2.s=Str(Velocity)
SetGadgetText(22, Velocity2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 26
Chaos2.s=GetGadgetText(28)
Chaos=Val(Chaos2.s)
Chaos=Chaos-5
Chaos2.s=Str(Chaos)
SetGadgetText(28, Chaos2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 27
Chaos2.s=GetGadgetText(28)
Chaos=Val(Chaos2.s)
Chaos=Chaos-1
Chaos2.s=Str(Chaos)
SetGadgetText(28, Chaos2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 29
Chaos2.s=GetGadgetText(28)
Chaos=Val(Chaos2.s)
Chaos=Chaos+1
Chaos2.s=Str(Chaos)
SetGadgetText(28, Chaos2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 30
Chaos2.s=GetGadgetText(28)
Chaos=Val(Chaos2.s)
Chaos=Chaos+5
Chaos2.s=Str(Chaos)
SetGadgetText(28, Chaos2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 32
Life2.s=GetGadgetText(34)
Life=Val(Life2.s)
Life=Life-5
Life2.s=Str(Life)
SetGadgetText(34, Life2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 33
Life2.s=GetGadgetText(34)
Life=Val(Life2.s)
Life=Life-1
Life2.s=Str(Life)
SetGadgetText(34, Life2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 35
Life2.s=GetGadgetText(34)
Life=Val(Life2.s)
Life=Life+1
Life2.s=Str(Life)
SetGadgetText(34, Life2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 36
Life2.s=GetGadgetText(34)
Life=Val(Life2.s)
Life=Life+5
Life2.s=Str(Life)
SetGadgetText(34, Life2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 38
Emissions2.s=GetGadgetText(40)
Emissions=Val(Emissions2.s)
Emissions=Emissions-5
Emissions2.s=Str(Emissions)
SetGadgetText(40, Emissions2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 39
Emissions2.s=GetGadgetText(40)
Emissions=Val(Emissions2.s)
Emissions=Emissions-1
Emissions2.s=Str(Emissions)
SetGadgetText(40, Emissions2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 41
Emissions2.s=GetGadgetText(40)
Emissions=Val(Emissions2.s)
Emissions=Emissions+1
Emissions2.s=Str(Emissions)
SetGadgetText(40, Emissions2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 42
Emissions2.s=GetGadgetText(40)
Emissions=Val(Emissions2.s)
Emissions=Emissions+5
Emissions2.s=Str(Emissions)
SetGadgetText(40, Emissions2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 44
Frequency2.s=GetGadgetText(46)
Frequency=Val(Frequency2.s)
Frequency=Frequency-5
Frequency2.s=Str(Frequency)
SetGadgetText(46, Frequency2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 45
Frequency2.s=GetGadgetText(46)
Frequency=Val(Frequency2.s)
Frequency=Frequency-1
Frequency2.s=Str(Frequency)
SetGadgetText(46, Frequency2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 47
Frequency2.s=GetGadgetText(46)
Frequency=Val(Frequency2.s)
Frequency=Frequency+1
Frequency2.s=Str(Frequency)
SetGadgetText(46, Frequency2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 48
Frequency2.s=GetGadgetText(46)
Frequency=Val(Frequency2.s)
Frequency=Frequency+5
Frequency2.s=Str(Frequency)
SetGadgetText(46, Frequency2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 50
Depth2.s=GetGadgetText(52)
Depth=ValF(Depth2.s)
Depth=Depth-0.1
Depth2.s=StrF(Depth)
SetGadgetText(52, Depth2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 51
Depth2.s=GetGadgetText(52)
Depth=ValF(Depth2.s)
Depth=Depth-0.01
Depth2.s=StrF(Depth)
SetGadgetText(52, Depth2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 53
Depth2.s=GetGadgetText(52)
Depth=ValF(Depth2.s)
Depth=Depth+0.01
Depth2.s=StrF(Depth)
SetGadgetText(52, Depth2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 54
Depth2.s=GetGadgetText(52)
Depth=ValF(Depth2.s)
Depth=Depth+0.1
Depth2.s=StrF(Depth)
SetGadgetText(52, Depth2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 56
Height2.s=GetGadgetText(58)
Height=ValF(Height2.s)
Height=Height-0.1
Height2.s=StrF(Height)
SetGadgetText(58, Height2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 57
Height2.s=GetGadgetText(58)
Height=ValF(Height2.s)
Height=Height-0.01
Height2.s=StrF(Height)
SetGadgetText(58, Height2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 59
Height2.s=GetGadgetText(58)
Height=ValF(Height2.s)
Height=Height+0.01
Height2.s=StrF(Height)
SetGadgetText(58, Height2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 60
Height2.s=GetGadgetText(58)
Height=ValF(Height2.s)
Height=Height+0.1
Height2.s=StrF(Height)
SetGadgetText(58, Height2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 62
Width2.s=GetGadgetText(64)
Width=ValF(Width2.s)
Width=Width-0.1
Width2.s=StrF(Width)
SetGadgetText(64, Width2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 63
Width2.s=GetGadgetText(64)
Width=ValF(Width2.s)
Width=Width-0.01
Width2.s=StrF(Width)
SetGadgetText(64, Width2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 65
Width2.s=GetGadgetText(64)
Width=ValF(Width2.s)
Width=Width+0.01
Width2.s=StrF(Width)
SetGadgetText(64, Width2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 66
Width2.s=GetGadgetText(64)
Width=ValF(Width2.s)
Width=Width+0.1
Width2.s=StrF(Width)
SetGadgetText(64, Width2.s)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 67
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
Case 68
File2.s = OpenFileRequester("Particles - Open", "C:\", "Bitmap (*.bmp)|*.bmp", 0)
If File2.s+File2.s
LoadImage(0,File2.s)
If ImageHeight()<32 Or ImageWidth()<32
MessageRequester("Particles - Error!", "The Image "+File2.s+" is either not tall or not wide enough!", #PB_MessageRequester_Ok)
small=1
FreeImage(UseImage(0))
EndIf
If ImageHeight()>32 Or ImageWidth()>32
MessageRequester("Particles - Error!", "The Image "+File2.s+" is either too wide or too tall!", #PB_MessageRequester_Ok)
big=1
FreeImage(UseImage(0))
EndIf
If small=0 And big=0
SetGadgetState(77,UseImage(0))
file.s = "System\Update.dat"
DeleteFile(file.s)
OpenFile(0,file.s)
WriteStringN(GetGadgetText(4))
WriteStringN(GetGadgetText(10))
WriteStringN(GetGadgetText(16))
WriteStringN(GetGadgetText(22))
WriteStringN(GetGadgetText(28))
WriteStringN(GetGadgetText(34))
WriteStringN(GetGadgetText(40))
WriteStringN(GetGadgetText(46))
WriteStringN(GetGadgetText(52))
WriteStringN(GetGadgetText(58))
WriteStringN(GetGadgetText(64))
WriteStringN(Str(GetGadgetState(67)))
WriteStringN(Str(GetGadgetState(70)))
WriteStringN(Str(GetGadgetState(71)))
path.s=GetPathPart(File2.s)
WriteStringN(path.s)
part.s=GetFilePart(File2.s)
WriteString(part.s)
CloseFile(0)
file.s="System\refresh.dat"
If CreateFile(0,file.s)
CloseFile(0)
EndIf
EndIf
big=0
small=0
EndIf
Case 69
ColorRequester()
EndSelect
EndIf
Floor=GetGadgetState(67)
Image=GetGadgetState(70)
Radius2.s=GetGadgetText(4)
Radius=Val(Radius2.s)
Speed2.s=GetGadgetText(10)
Speed=ValF(Speed2.s)
Gravity2.s=GetGadgetText(16)
Gravity=Val(Gravity2.s)
Velocity2.s=GetGadgetText(22)
Velocity=Val(Velocity2.s)
Chaos2.s=GetGadgetText(28)
Chaos=Val(Chaos2.s)
Life2.s=GetGadgetText(34)
Life=Val(Life2.s)
Emissions2.s=GetGadgetText(40)
Emissions=Val(Emissions2.s)
Frequency2.s=GetGadgetText(46)
Frequency=Val(Frequency2.s)
Depth2.s=GetGadgetText(52)
Depth=ValF(Depth2.s)
Height2.s=GetGadgetText(58)
Height=ValF(Height2.s)
Width2.s=GetGadgetText(64)
Width=ValF(Width2.s)
Until EventID = #PB_EventCloseWindow
; ProcessId.l
; ExitCode.l
; hWindow = FindWindow_(0, WindowTitle)
; GetWindowThreadProcessId_(hWindow, @ProcessId)
; hProcess = OpenProcess_(#PROCESS_ALL_ACCESS, #TRUE, ProcessId)
; GetExitCodeProcess_(hProcess, @ExitCode)
; TerminateProcess_(hProcess, ExitCode)
EndIfMaybe because when you use OpenFile() the file is locked until you close it... which is okay unless you are constantly opening and closing it in a loop, which would not allow other apps to touch it ??starting up a program with this one will not allow the other program to access .dat files
Also if you read the docs it says when using OpenFile() it should ALWAYS be tested (just something else you might want to look at)
Good luck
DarthPuff, I can't run your code because I'm missing the files from the
System folder (is that THE System folder, or another one that you made?).
Anyway, it's all a bit too much to work out without having everything, so
I'm going to have to pass on trying to help with this one. I'm on holiday
from tomorrow anyway, so I can't work on it until I get back on the 23rd.
What you could do, if you can't solve it by then, is make up a zip file with
all files and source for your app, and have it ready when I get back, and
then I'll look into it further.
System folder (is that THE System folder, or another one that you made?).
Anyway, it's all a bit too much to work out without having everything, so
I'm going to have to pass on trying to help with this one. I'm on holiday
from tomorrow anyway, so I can't work on it until I get back on the 23rd.
What you could do, if you can't solve it by then, is make up a zip file with
all files and source for your app, and have it ready when I get back, and
then I'll look into it further.
o_O Paul... The other side of the program does the testing... =\ and I'm not sure if you guys would understand the code... its another language... the programs run FINE!... BUT!... if I use the RunProgram() command to start the second exe it wont allow that exe to open the files... IF I run them seperately then it will... =\ I'm going to try and use a shortcut... eh...
DartPuff, it would be much easier for people to help if you would be able to cut down your program to only the basic stuff, but it must still contain enough code so the error occurs... A guess would be, as someone mentioned earlier, that one of the files the other program tries to read is locked because it's already opened with writing rights..
BTW i don't think PB wanted the sources to the other files just the EXE's you're calling... But then again i might be wrong about that
BTW i don't think PB wanted the sources to the other files just the EXE's you're calling... But then again i might be wrong about that




