Page 1 of 1

PostPosted: Tue Jan 18, 2005 9:26 am
by Mikael
This is probably a dum question but...

Is a way to return the constant equivalent of a resource id number from a .h file, when using BmpInfo(), instead of the resource number itself?

Thanks in advance.


PostPosted: Tue Jan 18, 2005 2:05 pm
by jstadolnik
You can specify your bitmap resource ids with #defines in an .h file. PilRC can include this .h file, as can your PocketC code. This way both tools use the same ids at compile time.


The PToolboxLib guy.

PostPosted: Tue Jan 18, 2005 5:49 pm
by Mikael
Hi Joe,
I've already been doing as you suggest as with:
#define One_Char0 4001
#define One_Char1 4002
#define One_Char2 4003
#define One_Char3 4004
#define One_Char4 4005
#define One_Char5 4006

in One.h etc, but I was hoping there was a way of returning the constant, say One_Char0, instead of 4001, when returning the id value in BmpInfo(); such as in your example:

id = BmpInfo(index, &width, &height,&depth,&trans,&comp);

which alway returns a number - which is great normally, but I suddenly have to check through lots of resources to strip some stuff here and add some stuff there. My task would be both faster and easier if I could navigate by constants rather than numbers. I tried making 'id' a string instead of an integer, but got the same result.

Failing that, I'll probably try converting the .h files to CSV's, import them to PilotDb and use the Db functions in PToolbox to do what I need to do.



PostPosted: Tue Jan 18, 2005 8:08 pm
by jstadolnik
Keep in mind that when the complier launches, the pre-processor replaces all macros specified by #defines with their actual values (numbers or strings), after which the actual compile begins. As such, the compiler doesn't see any "constants" only numbers (or strings if the value is in quotes).

Also, bitmap resources do not contain any internal text information. So it's not possible for BmpInfo() to retrieve a string label for a bitmap.

For faster array searching use the PToolboxLib's Query() function.


The PToolboxLib guy.