Page 1 of 1
[SOLVED] Error in catching image
Posted: Wed Aug 07, 2019 3:41 am
by SkyManager
I have tested the following codes in PB 5.7 (Windows 10, 64 bits)
Code: Select all
DataSection
Config:
IncludeBinary "A:/config.bmp"
EndDataSection
Global IconCfg = CatchImage(100, ?Config)
Debug "IconCfg = " + Str(IconCfg)
Global ImgCfg = ImageID(IconCfg) ;<------- Error reports
Error reports for
image not initialized
I have no idea what that means.
Also, the IconCfg sometimes reports a negative value, is that correct or mistake?
Could anybody help me out??
Re: Error in catching image
Posted: Wed Aug 07, 2019 3:51 am
by RASHAD
Hi
IconCfg is the handle of the image
100 is the image ID
Re: Error in catching image
Posted: Wed Aug 07, 2019 4:03 am
by Little John
@SkyManager:
See
Handles and Numbers in the Reference Manual.
Re: Error in catching image
Posted: Wed Aug 07, 2019 9:29 am
by Demivec
Here is the application of the previous replies with respect to your code sample:
Code: Select all
DataSection
Config:
IncludeBinary "A:/config.bmp"
EndDataSection
Global IconCfg = CatchImage(100, ?Config) ;IconCfg = resulting image handle of image #100 if succesful
Debug "IconCfg = " + Str(IconCfg) ;and =0 if CatchImage() fails.
;Global ImgCfg = ImageID(IconCfg) ;<------- Error reports, incorrect usage see below
Global ImgCfg = IconCfg ;or ImgCfg = ImageID(100) ; valid only if CatchImage() was successful
Re: Error in catching image
Posted: Wed Aug 07, 2019 9:50 am
by SkyManager
Thanks a lot.
I confuse about the handle and image id
Re: Error in catching image
Posted: Wed Aug 07, 2019 9:55 am
by Mohawk70
SkyManager wrote:I have tested the following codes in PB 5.7 (Windows 10, 64 bits)
Code: Select all
DataSection
Config:
IncludeBinary "A:/config.bmp"
EndDataSection
Global IconCfg = CatchImage(100, ?Config)
Debug "IconCfg = " + Str(IconCfg)
Global ImgCfg = ImageID(IconCfg) ;<------- Error reports
Error reports for
image not initialized
I have no idea what that means.
Also, the IconCfg sometimes reports a negative value, is that correct or mistake?
Could anybody help me out??
"A:/config.bmp" --> "A:\config.bmp" for Windows
Sent from my SM-N960U using Tapatalk