Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

Black background around PB icons in systray on NT 4.0

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Black background around PB icons in systray on NT 4.0

    Hello All,

    How do i get rid of the black background around
    my pb app icons in the systray on NT 4.0 PCs?

    The programs are compiled with pbdll 6.0?

    They show normal on 95/98

    Here is my .RC file
    ---------------------------------------------------
    PROGRAM ICON Icon.ico

    Thanks for any help
    Jason


    ------------------

  • #2
    Jason --

    My PB/DLL programs create System Tray icons all the time, on all versions of Windows, and I've never seen a black background.

    In some cases, background transparency is determined by the color in location 0,0 (the top-left pixel) of an icon. Whatever color is used at 0,0 is considered to be transparent. The illusion of transparency can also be achieved by using a gray background for the icon. But the most reliable way is to use the color that is pre-defined for icon transparency. It is often displayed as an ugly gray-green color, but that depends on your icon editor.

    I'm guessing that your icon currently uses a black or gray background, when it should use a transparent background.

    -- Eric

    ------------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>

    [This message has been edited by Eric Pearson (edited January 16, 2001).]
    "Not my circus, not my monkeys."

    Comment


    • #3
      How do I specify the background color in the .RC file or in code?

      Thanks
      Jason

      ------------------

      Comment


      • #4
        You have to edit the icon file itself. All colors -- even "transparent" -- are specified by the icon image itself.

        I use and recommend the MicroAngelo icon editor from impactsoft.com .

        -- Eric


        ------------------
        Perfect Sync: Perfect Sync Development Tools
        Email: mailto:[email protected][email protected]</A>



        [This message has been edited by Eric Pearson (edited January 16, 2001).]
        "Not my circus, not my monkeys."

        Comment


        • #5
          Well I guess whats confusing to me is that the icon does not have
          the black background on 95/98 PCs.

          Its only NT that it shows up as black???

          Can it be the way im loading the icon from the .RC file?

          Thanks
          Jason

          ------------------

          Comment


          • #6
            No. As far as I know that is not possible.

            My best guess is that the icon has a gray background. When Windows NT displays it in the system tray, it is changing it to black or a darker gray. I have seen this before when working with the System Tray.

            There's a very easy way to find out for sure: look at the icon in an icon editor! If you own Visual Studio or the Borland Resource Workshop use those. Or MicroAngelo. You may even be able to tell by placing the icon on the Windows Desktop (assuming that the desktop is not gray).

            If you don't have access to the original icon file that is embedded in the RC file, you can download an icon extractor here...

            http://www.powerbasic.com/files/pub/tools/win32/

            -- Eric


            ------------------
            Perfect Sync: Perfect Sync Development Tools
            Email: mailto:[email protected][email protected]</A>
            "Not my circus, not my monkeys."

            Comment


            • #7
              Thanks Eric, I'll give it a try.

              Jason

              ------------------

              Comment


              • #8
                Ok, I've checked the top 0,0 position of the icon its clear or trans.

                I set the background to gray and thats ok, but it bugs me that i
                cant use a trans bckgnd.

                This is how i set the icon for the window

                '--Set the icon for the window.
                LOCAL hIcon&
                hInst = GetModuleHandle("")
                hIcon = LoadIcon(hInst,"PROGRAM")
                DIALOG SEND hfrmMaX&, %WM_SETICON, %ICON_SMALL, hIcon
                '--End set icon.

                This is how i add the tray icon.

                '--Add tray icon
                ti.cbSize = SIZEOF(ti)
                ti.hWnd = hfrmEmailX&
                ti.uID = hInst
                ti.uFlags = %NIF_ICON OR %NIF_MESSAGE OR %NIF_TIP
                ti.uCallbackMessage = %WM_TRAYICON
                ti.hIcon = LoadIcon(ti.uID, "PROGRAM")
                ti.szTip = "Some Text"
                Shell_NotifyIcon %NIM_ADD, ti
                DestroyIcon ti.hIcon
                '--End Add tray icon

                This is my .RC file.

                PROGRAM ICON Icon.ico

                '-- End RC file


                Any ideas??

                Stomped
                Jason


                ------------------


                [This message has been edited by jforgey (edited January 19, 2001).]

                Comment


                • #9
                  I've noticed one more thing.

                  In explorer if I browse to any folder that has icons in it with trans.
                  bkgnds they are also black.

                  Maybe this is just a $&*&% Windows thing

                  Anyone ever seen this?

                  Jason


                  ------------------

                  Comment


                  • #10
                    Jason --
                    Have you troubles with PB's tray sample ?
                    If not, find normal icon editor and set transparent color.

                    ------------------
                    E-MAIL: [email protected]

                    Comment


                    • #11
                      Ok, I found the problem!

                      The icon im using is 32X32 True color.


                      I'm not exp. this problem with the Tray example which are 16 color.

                      Thanks All
                      Jason

                      ------------------


                      [This message has been edited by jforgey (edited January 19, 2001).]

                      Comment


                      • #12
                        That does explain it... If your system does not support TrueColor, when you try to display a color that the video card can't reproduce it will pick the closest available color. And that may be black.

                        Yes, it's a Windows thing and there's not much you can do about it, other than sticking to icons and bitmaps that use the lowest color depth that will be encountered at runtime. Personally I almost always stick to 256 colors or less.

                        -- Eric

                        ------------------
                        Perfect Sync: Perfect Sync Development Tools
                        Email: mailto:[email protected][email protected]</A>
                        "Not my circus, not my monkeys."

                        Comment


                        • #13
                          Well now I know it wasn't a problem with PowerBasic or my code.

                          Not that I questioned ether


                          Thanks for your help
                          Jason

                          ------------------

                          Comment

                          Working...
                          X