MFC static library and problem with loading external rc (resource) file icon

I have a problem loading icons from external resource files in the main application. I will try to explain how the application is installed right now. The main application resources include an external * .rc dialog and the corresponding * .h. And the linker includes an implementation of the dialog (CDialog / CFormView), which is located in the external * .lib static library.

External * .rc has:

IDI_MY_ICON ICON "my_icon.ico"

External * .h has:

#define IDI_MY_ICON 10000

Running a dialog in static lib * .cpp has:

HICON MyDialog::GetNeededIcon()
{
  return AfxGetApp()->LoadIcon(IDI_MY_ICON);
}

I thought it should be in the same folder as the external * .rc file. I also tried putting them in the main folder of the application, but the application still does not load them. Can someone explain to me where my_icon.ico is located?

PS - The contents of the files are just examples.

+3
2

.rc rc.exe . rc.exe include . INCLUDE /I rc.exe. "my_icon.ico" , .

:

rc.exe .rc .res, , .

+1

AfxGetApp()->LoadIcon(IDI_MY_ICON); (exe).

, , LoadLibrary, GetModuleHandle .

+2

All Articles