Re: Program Crashes

new topic     » goto parent     » topic index » view thread      » older message » newer message
Icy_Viking said...

Hello,

Whenver I try to launch an executable file from my program, it crashes. I have it so that you can launch .exe files from within the program, but when trying to launch them, my program crashes. Here is my code. Maybe I'm not loading it correctly?

procedure Launched(integer self, integer event, sequence parm) 
 
	parm = getOpenFileName(MainWin,"",{"Exe Files","*.exe"}) 
	 
	if parm = -1 then 
		self = message_box("Could not open file!","File",MB_OK) 
		else 
		x = system_exec(parm,0) 
	end if 
	 
	if x = -1 then 
		self = message_box("Could not launch game","Launcher",MB_OK) 
		elsif x = 0 then 
			times_game_played += 1 
	end if 
	 
end procedure 
setHandler(Launch_Game,w32HClick,routine_id("Launched")) 
 
 

I can post more code if it is needed.

This looks like a windows program and I may not be much help... but I'll try. There are some interesting things going on in this code.

  1. The variable "self" is reassigned and then never used.
  2. The variable "event" is passed in but never used.
  3. The variable "param" is passed in as a sequence and then an attempt to reassign it to an integer (or atom) was made. This may be your bug.

-xecronix

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu