Re: Loading A Graphic Using CxImage From User Input

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

Thanks, the code does work, but for some reason, when ever I try to load a "user" selected image, my program crashes on me. I am probably doing something wrong in my code.

Nothing should change, except that you'll be calling getOpenFileName() to obtain the image file from the user. If you could post the code that's crashing, I could take a look at it.

-Greg

	fName = getOpenFileName(EDWin,file,GraphicType) 
	 
	if length(fName) = 0 then 
		return 
	end if 
	 
	handle = open(fName,"rb") 
	 
	while 1 do 
		data = gets(handle) 
		 
	if atom(data) then 
		exit 
	end if 
	 
	buffer = buffer & data 
	end while 
	 
	close(handle) 
	 
	HeroWalk_Gfx = CXI_LoadImage(file,GraphicType,0) 
	 
	HeroWalk_Gfx = createDIBFromCXImage(HeroWalk_Gfx) 
	 
	copyBlt(EDWin,710,220,HeroWalk_Gfx) 
end procedure 
setHandler(Hero_WalkGfx_Add,w32HClick,routine_id("Add_Hero_WalkGfx")) 
setHandler(EDWin,w32HPaint,routine_id("Add_Hero_WalkGfx")) 

That is my code for the user selected image. However whenever I actually tried to click on the image to have it displayed on the window it crashes.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu