Status bar picture

Started by Douglas McDonald, June 29, 2010, 02:03:14 PM

Previous topic - Next topic

Douglas McDonald

Whats the secret to load a picture in the status bar? If I use the statusbar editor, go to the panel, click on select and select a .bmp the click on attach to control nothing happens.

In the function Library I only see geticon and seticon. Do I use this to load a .bmp. Can I even use a .bmp. I looked in the help file and under the status bar section it says nothing about adding a picture

Here is what I want to do. I have 5 bitmaps. Depending on conditions I want to display one of the 5.

select case xyz

  case 0
     show bitmap 1
  case 2
    show bitmap 2

ect......................

what is the proper code / functions to do this?

Thank you

Doug
Doug McDonald
KD5NWK
www.redforksoftware.com
Is that 1's and 0's or 0's and 1's?

José Roca

If you want to use bitmaps you need to make the status bar ownerdraw and draw the bitmaps yourself.

Douglas McDonald

Doug McDonald
KD5NWK
www.redforksoftware.com
Is that 1's and 0's or 0's and 1's?

Paul Squires

Personally, I would convert the bitmaps to icons using any of the many programs available to do so (I use MicroAngelo a lot).
Paul Squires
PlanetSquires Software

Rolf Brandt

A good tool for Icons and converting bitmaps to icons is IcoFX. It's very powerful and it's free.

http://icofx.ro/
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Douglas McDonald

I changed over to icons and this works better. There is a problem but I doubt a solution. When I add the icon static using the statusbar editor and attach it the icons looks fine. If I do it in code they do no look the same . They are not as clear and do not seem to render correctly. The are exactly the same file. BTW the icons are 16x16

I'm using the following code


      hIcon     = LoadIcon (App.hInstance,"IMAGE_SIG_0" )
      retval  = StatusBar_SetIcon (HWND_MAIN_STATUSBAR, 5, hIcon)


The options in the statusbar editor for actual size, fit width ect... have no effect.

On an Icon related note. If I assign an Icon under Project Properties the Icon it does show the icon related to the .exe but shouldn't also be used for the icon on the programs caption?

Thank you
Doug

Doug McDonald
KD5NWK
www.redforksoftware.com
Is that 1's and 0's or 0's and 1's?

Rolf Brandt

Try to set the size of the icon in the LoadIcon function:

hIcon     = LoadIcon (App.hInstance,"IMAGE_SIG_0", 16, 16, 0)


Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Douglas McDonald

Thanks Rolf


hIcon     = LoadIcon (App.hInstance,"IMAGE_SIG_0", 16, 16, 0)


It will not compile Error 414 ")" expected.

From MSDN:

Syntax

HICON WINAPI LoadIcon(
  __in_opt  HINSTANCE hInstance,
  __in      LPCTSTR lpIconName
);


Doug McDonald
KD5NWK
www.redforksoftware.com
Is that 1's and 0's or 0's and 1's?

Rolf Brandt

You are right, Douglas. I am using LoadImage. If I remember right I had the same problem with LoadIcon and then switched to LoadImage and set the image type to icon.

hIcon = LoadImage( App.hInstance, "IMAGE_GREEN16", %IMAGE_ICON, 16, 16, 0 )

It then looked nicer. Sorry for the confusion.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Douglas McDonald

Thank you Rolf, I'll give it a try

doug
Doug McDonald
KD5NWK
www.redforksoftware.com
Is that 1's and 0's or 0's and 1's?

Douglas McDonald

Rolf

That works much much better

Thank you
Doug
Doug McDonald
KD5NWK
www.redforksoftware.com
Is that 1's and 0's or 0's and 1's?

Roger Garstang

I use LoadImage for everything, the others are far too limited.  The LR_SHARED flag I use a lot as well so my handles are easier to work with multiple times.  Paul even switched to this in FireFly.  If you look there are lots of LR_ flags as options for the controls with pictures.