PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Douglas McDonald on June 29, 2010, 02:03:14 PM

Title: Status bar picture
Post by: Douglas McDonald on June 29, 2010, 02:03:14 PM
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
Title: Re: Status bar picture
Post by: José Roca on June 29, 2010, 04:54:52 PM
If you want to use bitmaps you need to make the status bar ownerdraw and draw the bitmaps yourself.
Title: Re: Status bar picture
Post by: Douglas McDonald on June 29, 2010, 07:51:36 PM
Thank you
Title: Re: Status bar picture
Post by: Paul Squires on June 30, 2010, 08:52:27 AM
Personally, I would convert the bitmaps to icons using any of the many programs available to do so (I use MicroAngelo a lot).
Title: Re: Status bar picture
Post by: Rolf Brandt on June 30, 2010, 10:09:14 AM
A good tool for Icons and converting bitmaps to icons is IcoFX. It's very powerful and it's free.

http://icofx.ro/
Title: Re: Status bar picture
Post by: Douglas McDonald on June 30, 2010, 12:32:11 PM
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

Title: Re: Status bar picture
Post by: Rolf Brandt on June 30, 2010, 12:58:05 PM
Try to set the size of the icon in the LoadIcon function:

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


Title: Re: Status bar picture
Post by: Douglas McDonald on June 30, 2010, 02:34:50 PM
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
);


Title: Re: Status bar picture
Post by: Rolf Brandt on June 30, 2010, 07:44:17 PM
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.
Title: Re: Status bar picture
Post by: Douglas McDonald on June 30, 2010, 10:20:03 PM
Thank you Rolf, I'll give it a try

doug
Title: Re: Status bar picture
Post by: Douglas McDonald on July 09, 2010, 02:22:18 PM
Rolf

That works much much better

Thank you
Doug
Title: Re: Status bar picture
Post by: Roger Garstang on July 16, 2010, 04:18:38 PM
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.