The login interface is often used when writing database programs. The login interface is usually displayed in a temporary dialog box. For example, most program operations are implemented based on a single document, but you need to call a dialog box before initializing the program as the login interface. I usually display it at the beginning of the initinstance () function, and then judge whether the entered account and password are correct. If the program is correctly executed, the system prompts that the user password is incorrect. If the user clicks the cancel button, exit (0) is called to exit the program.
At this time, I encountered a problem: the icons you designed won't be displayed in the title bar and taskbar of the logon interface, and will not be displayed when you press Alt + TAB to switch the program. This means that you have designed your own icons and replaced the. ICO icon in the original res folder, but it is not used on the login interface. Next, we can use several steps to display the replaced icon on the login interface.
1. Define a hicon variable in the class declaration of the dialog box.
Hicon m_hicon;
2. Add the following code to the class constructor in the dialog box:
M_hicon = afxgetapp ()-> loadicon (idr_mainframe );
3. Rewrite the oninitdialog () function for the dialog box and add the following code
// Todo: add additional initialization seticon (m_hicon, true) here; // set the big icon seticon (m_hicon, false); // set the small icon
For details about the seticon () function, refer to the following article:
Http://blog.163.com/xxqi1229@126/blog/static/131653470201049102325939/