It is currently Sat Jul 11, 2020 7:33 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Using #PB_any give compiler error
PostPosted: Sun Jun 03, 2018 10:53 am 
Offline
Addict
Addict
User avatar

Joined: Mon Jul 25, 2005 3:51 pm
Posts: 3716
Location: Utah, USA
Michael Vogel wrote:
Code:
FreeImage("temp")            ;how to free the memory again?

Why wouldn't you use this?
Code:
FreeImage(temp)

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Using #PB_any give compiler error
PostPosted: Sun Jun 03, 2018 11:05 am 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2545
Demivec wrote:
Why wouldn't you use this?
Code:
FreeImage(temp)


Because FreeImage needs the image number (#Image) not the handle (*Image) as a parameter, isn't it?


Top
 Profile  
Reply with quote  
 Post subject: Re: Using #PB_any give compiler error
PostPosted: Sun Jun 03, 2018 12:39 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Sep 15, 2003 5:55 am
Posts: 1342
Code:
ImageID = CreateImage(0, 32, 32)
Debug ImageID
Debug ImageID(0)
FreeImage(0)

Debug ""

ImageAny = CreateImage(#PB_Any, 32, 32)
Debug ImageAny
Debug ImageID(ImageAny)
FreeImage(ImageAny)

#PB_Any does not return the image handle. it returns a pointer to the image object, inside a pb-internal image list. a static number (0-XXXX) is an index to the image object, inside a pb-internal image array.

c ya,
nco2k

_________________
If OSVersion() = #PB_OS_Windows_ME : End : EndIf


Top
 Profile  
Reply with quote  
 Post subject: Re: Using #PB_any give compiler error
PostPosted: Sun Jun 03, 2018 1:19 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2545
Thanks, so everything is correct and fine - just got really nervous because of the high values (expected, the next 'free' number would be chosen) :oops: ...

...but when comparing multiple pointers and numbers, the difference it obvisously:
Code:
For i=1 To 10
   Debug CreateImage(i,1<<i,1<<i)
Next i

Debug ""

For i=1 To 10
   Debug CreateImage(#PB_Any,1<<i,1<<i)
Next i


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye