Menu

draing the icon of a minimized window at ...

2007-09-04
2012-09-26
  • aventura_alex

    aventura_alex - 2007-09-04

    at runtime.
    well, I read one can draw the icon of a minimized window. Does it mean the icon of the button that shows when the window is minimized? if so, I guess it is not working for me the way I expected it to be. It seems Dev puts something there, namely, the project icon, even if I make the icons equal to null.
    I even tried to set them to null afterwards with WM_SETICON but it didn't work.
    does anyone know of a solution for that?
    I'm using Dev C++ 4.9.9.2

     
    • Anonymous

      Anonymous - 2007-09-05

      >> My go would be first: not let the system draw an icon.

      If the window has a icon, I suppose the only option is the mentioned transparent one, because the icon is draw automatically with the apparence of the window in the desktop and in the task bar.

      >> Second: managing to get the first go

      In that moment, you need change the transparent icon by the desired one. To do that You need:

      Load the new icon

      HICON hIcon = LoadIcon (hInstance, MAKEINTRESOURCE (myStarIcon));

      Assign the icon to the window

      SendMessage (hwnd, WM_SETICON, WPARAM (ICON_SMALL), LPARAM (hIcon));

      Note: the WM_SETICON message also let you remove the previous icon (see the API Doc)

      HTH

      Old Newbie

       
    • Anonymous

      Anonymous - 2007-09-04

      >> Dev puts something there...

      No; "Windows" puts something there. Depending on de windows type, the Windows API use a default icon, or nothing.

      As an example: if you define a dialog box with

      STYLE WS_POPUP | WS_CAPTION | WS_BORDER

      It has a caption and not icon. But if you use

      STYLE WS_POPUP|WS_SYSMENU|WS_CAPTION|WS_BORDER |WS_THICKFRAME

      it has a caption and a icon.

      By the way, IMHO the Windows window's types and their properties are a nightmare.

      Old Newbie

       
    • aventura_alex

      aventura_alex - 2007-09-04

      thank you so much Old Newbie. So, it means I must change the style and see which one behaves as I like, right? maybe it is because I'm using overlapped, and probably already this style includes some of these options. take care.
      and thank you very much. I'll test this pretty soon.

       
    • aventura_alex

      aventura_alex - 2007-09-04

      hmm, I tried the style you proposed: STYLE WS_POPUP | WS_CAPTION | WS_BORDER
      the thing is that this way I cannot minimize my window. Besides, if to this style I add the minimize button style I can, but still, the icon on the button (application minimized) shown is the predefined one (Dev's project icon)

       
    • Anonymous

      Anonymous - 2007-09-04

      >> I tried the style you proposed...

      It is not a "proposed" only an example of how the style determine the widnow's appearance and behavior.

      IF you can't find the style that match your's behavior, always can use the trick to define a transparent icon.

      Old Newbie

       
    • aventura_alex

      aventura_alex - 2007-09-05

      ok, but, :)
      say I use a transparent Icon. I suppose this won't make the application call WM_PAINT to paint the icon. Do you think, or maybe know, that by using a transparent icon I may be able to draw a visible one that will be shown below the transparent one? :)
      even if this works, it sounds a bit weird :)

       
    • Anonymous

      Anonymous - 2007-09-05

      Surely I don't understood well your's goal. The proposed solution suppose that You don't want a icon when the window is minimized.

      >> it sounds a bit weird

      Absolutely agree, but can do the work...

      The theory is that you can define two icons for a window, the normal and the small ones. This last is used in the task bar display.

      You must define both in the WNDCLASSEX structure:

      WNDCLASSEX wndclass;  
          wndclass.hIcon         = LoadIcon (hInstance, MAKEINTRESOURCE (MyBigIcon));  
          wndclass.hIconSm       = LoadIcon (hInstance, MAKEINTRESOURCE (MySmallIcon));  
          ...
      

      HTH

      Old Newbie

       
    • aventura_alex

      aventura_alex - 2007-09-05

      Ok mate. My go would be first: not let the system draw an icon. Second: managing to get the first go, I read the WM_PAINT message would be called, instead of WM_PAINTICON and so I might for instance, draw a star, with polyline for instance, on the minimized window just by writing the function inside WM_PAINT and making it execute every time the isIconic function returns true.
      the thing is, that as I haven't been able to manage the icon go go NULL (in practice it is still there) , the code doesn't write say, the star or whatever. Or if it does, it is just overriden by the other icon afterwards.
      hope I have made myself clearer now :)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.