The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Change icon in GETN title bar

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
couturier Posted - 02/23/2020 : 08:46:26 AM
Origin Ver. and Service Release (Select Help-->About Origin): 2020
Operating System:2020

I've changed the icon in a GETN title bar and it looks nice
HWND hh = GetWindow(OGW_DB_ACTIVE_DLG);
Window wnd(hh);
HICON hic = LoadImage( NULL, strico, IMAGE_ICON, 16, 16, LR_LOADFROMFILE );
wnd.SetIcon(hic, false);


In LoadImage help, it is said:
When you are finished using a bitmap, cursor, or icon you loaded without specifying the LR_SHARED flag, you can release its associated memory by calling one of the functions in the following table.

The system automatically deletes these resources when the process that created them terminates; however, calling the appropriate function saves memory and decreases the size of the process's working set.

Should I take care on destroying that icon ?
If so, how can I do that ?
Similar to GETNE_ON_INIT, is there an event just before GETN is closed, where I could retrieve icon handle and call DestroyIcon( HICON hIcon ) ?
3   L A T E S T    R E P L I E S    (Newest First)
Castiel Posted - 02/24/2020 : 7:26:49 PM
quote:
Originally posted by couturier

Origin Ver. and Service Release (Select Help-->About Origin): 2020
Operating System:2020

I've changed the icon in a GETN title bar and it looks nice
HWND hh = GetWindow(OGW_DB_ACTIVE_DLG);
Window wnd(hh);
HICON hic = LoadImage( NULL, strico, IMAGE_ICON, 16, 16, LR_LOADFROMFILE );
wnd.SetIcon(hic, false);


In LoadImage help, it is said:
When you are finished using a bitmap, cursor, or icon you loaded without specifying the LR_SHARED flag, you can release its associated memory by calling one of the functions in the following table.

The system automatically deletes these resources when the process that created them terminates; however, calling the appropriate function saves memory and decreases the size of the process's working set.

Should I take care on destroying that icon ?
If so, how can I do that ?
Similar to GETNE_ON_INIT, is there an event just before GETN is closed, where I could retrieve icon handle and call DestroyIcon( HICON hIcon ) ?




To destroy/release/close some object, automatically, a common way is using a class object.

In the following example, DestroyIcon() is called automatically when foo() ends.

class A
{
public:
    A(LPCSTR lp) { m_h = LoadImage(...); }
    ~A() { DestroyIcon(m_h); }
    HICON get() { return m_h; }
private:
    HICON m_h;
};

void foo()
{
    A a(...);
    HICON h = a.get();
    // blablabla
    return;
}



                                          &&&&&&&&&
                                        &&&
                                       &&
                                      &  _____ ___________
                                     II__|[] | |   I I   |
                                    |        |_|_  I I  _|
                                   < OO----OOO   OO---OO
**********************************************************
couturier Posted - 02/24/2020 : 02:40:45 AM
Thanks a lot Yuki
yuki_wu Posted - 02/23/2020 : 10:25:02 PM
Hi couturier,

We could use this function directly:
HICON set_window_icon_from_file(HWND hWnd, LPCSTR szIconPath);

Regards, Yuki
OriginLab

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000