Check of bitmap is defined in RC-file

Check of bitmap is defined in RC-file

Postby Marc Vanzegbroeck » Fri Oct 24, 2008 7:50 am

Hi,

Is there a way to check if an bitmap defined in the RC-file

Code: Select all  Expand view
TRUCK   BITMAP _Buttons\truck.bmp
TRUCK2  BITMAP _Buttons\truck2.bmp


If for example TRUCK2 is defined i want to use that BITMAP, otherwise I use TRUCK.

Thanks,
Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby Marc Vanzegbroeck » Fri Oct 24, 2008 11:47 am

Is this possible?

Thanks,
Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby JC » Fri Oct 24, 2008 12:00 pm

Marc,

This the way to define bitmaps at RC files:

Code: Select all  Expand view
ANY_IMAGE_I   BITMAP "..\\folder\\image_1.bmp"
ANY_IMAGE_II  BITMAP "..\\folder\\image_2.bmp"


There is a function for load these bitmaps:
Code: Select all  Expand view
loadBitmap( , "ANY_IMAGE_I" )

I think, if this function returns nothing... this is because the resource named ANY_IMAGE_I not exists into RC file...
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby Marc Vanzegbroeck » Fri Oct 24, 2008 12:27 pm

Thanks Júlio César,

If I call
Code: Select all  Expand view
loadBitmap( GetResources(), "TRUCK" )


The function returns '0' if it doesn't exist.

Regards,
Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby Antonio Linares » Fri Oct 24, 2008 5:58 pm

Marc,

Thats a valid solution. Another way is to use FindResource():

FindResource( GetResources(), "TRUCK", 2 ) != 0

2 means that it is a bitmap

FiveWin uses it in source\classes\menu.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby JC » Fri Oct 24, 2008 6:06 pm

Very more clean!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby Marc Vanzegbroeck » Fri Oct 24, 2008 6:44 pm

Thanks Antonio,

Regards,
Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 55 guests