Results 1 to 8 of 8

Thread: Application Icon

  1. #1
    Lesser Knight
    Join Date
    Oct 2007
    Posts
    57

    Default Application Icon

    I'm a new personality,a very simple question, How to setup a new application icon? I search the example and no found,somebody help me?Thanks in advance.

  2. #2
    Lesser Knight
    Join Date
    Oct 2007
    Posts
    57

    Default

    I search the forum and found no CL_class function to setup application icon,oh no !Anybody can help me ,tell me a think ,help me !
    Last edited by DavinciZhe; 10-01-2007 at 09:28 PM.

  3. #3
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,340

    Default

    Well, I don't think Clanlib handles this for you.. it's sort different on each platform. For instance, on OSX it's not part of the executable (instead, it's more how you setup its application folder setup .. at least that's how I did it iirc)..

    It looks easy on windows though, check this out.
    Seth A. Robinson
    Robinson Technologies

  4. #4
    Lesser Knight
    Join Date
    Oct 2007
    Posts
    57

    Default

    Thanks Seth,it work! But have a another question,set the window icon in the upper left corner of the display window on Windows ,could you give me more advice,thanks a lot!

  5. #5
    Lesser Knight
    Join Date
    Oct 2007
    Posts
    57

    Default

    OK,I do it:
    CL_OpenGLWindow window("ClanLib application", 800, 600,true);

    //---设置application icon
    #ifdef WIN32

    HWND wind = window.get_wnd();

    HINSTANCE hinst = GetModuleHandle(L" curceent.exe");


    SetClassLong(wind , // window handle
    GCL_HICON, // changes icon
    (LONG) LoadIcon(hinst, MAKEINTRESOURCE(103))
    );


    #endif

    But the windows upper left corner will flash from old icon to new,how to avoid it flash???Please !

  6. #6
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,340

    Default

    I know this a dead thread, but I just had to deal with this problem myself and found an easier solution.

    Just add an icon to your project (add existing resource in visual studio) and then set the icon's resource ID to 1001. It will automatically become the application icon under windows.

    The reason this works is because in display_window_win32.cpp we've got this happening:

    Code:
    wndclass.hIcon = LoadIcon(CL_System_Win32::hInstance, MAKEINTRESOURCE(1001));
    Seth A. Robinson
    Robinson Technologies

  7. #7
    Lesser Knight
    Join Date
    Oct 2007
    Posts
    57

    Default

    Thank you very much!Oh,this is not a dead thread,I think your comment also help other people!

  8. #8
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    ClanLib 2.0 now supports an application icon on windows (See image http://www.rtsoft.com/forums/showthr...1193#post11193 )

Similar Threads

  1. Trying to set the window icon
    By JonR in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 08-09-2007, 08:14 AM
  2. Accessing the global application instance
    By Iori Branford in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 01-05-2007, 07:01 AM
  3. Application crashing before it fuly starts up?
    By kaminarukuzu in forum Novashell Game Creation System
    Replies: 9
    Last Post: 12-30-2006, 06:24 AM
  4. Using Dink Smallwood icon in my editor
    By in forum Dink Smallwood HD
    Replies: 5
    Last Post: 10-29-2002, 11:43 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •