Loading an ICON from a file
-
Hi, My project does not contain any resources file , and I need to load an ICON from a specified location. I used the following :
m_hIcon = AfxGetApp()->LoadIcon(_T"C:\test\res\OPTIONS_ICON.ico"));
but m_hIcon is allways NULL. Anyone? With best regards, Eli :doh:
-
Hi, My project does not contain any resources file , and I need to load an ICON from a specified location. I used the following :
m_hIcon = AfxGetApp()->LoadIcon(_T"C:\test\res\OPTIONS_ICON.ico"));
but m_hIcon is allways NULL. Anyone? With best regards, Eli :doh:
You need to escape backslashes inside strings, change
eli15021979 wrote:
m_hIcon = AfxGetApp()->LoadIcon(_T"C:\test\res\OPTIONS_ICON.ico"));
into:
m_hIcon = AfxGetApp()->LoadIcon(_T"C:\\test\\res\\OPTIONS_ICON.ico"));
:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
You need to escape backslashes inside strings, change
eli15021979 wrote:
m_hIcon = AfxGetApp()->LoadIcon(_T"C:\test\res\OPTIONS_ICON.ico"));
into:
m_hIcon = AfxGetApp()->LoadIcon(_T"C:\\test\\res\\OPTIONS_ICON.ico"));
:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
Thanks for your quick answer... I tried this also , but m_hIcon still NULL. Note that I'm able to load an ICON using a resources file by AfxGetApp()->LoadIcon(IDI_NEW_LOGGER_ICON); Thanks again, Eli
-
Hi, My project does not contain any resources file , and I need to load an ICON from a specified location. I used the following :
m_hIcon = AfxGetApp()->LoadIcon(_T"C:\test\res\OPTIONS_ICON.ico"));
but m_hIcon is allways NULL. Anyone? With best regards, Eli :doh:
eli15021979 wrote:
AfxGetApp()->LoadIcon(_T"C:\test\res\OPTIONS_ICON.ico"));
will not work. U should use the LoadImage() function to load the icon from a file.
nave [OpenedFileFinder]
-
Hi, My project does not contain any resources file , and I need to load an ICON from a specified location. I used the following :
m_hIcon = AfxGetApp()->LoadIcon(_T"C:\test\res\OPTIONS_ICON.ico"));
but m_hIcon is allways NULL. Anyone? With best regards, Eli :doh:
Did you try with LoadImage?