Question

I am a newbie who has been trying to venture into some winapi coding with C++ in CodeBlocks. I am struggling with adding an icon to the exe file. After creating .rc file and a header for it

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "resource.h"

LANGUAGE 0, SUBLANG_NEUTRAL
IDI_ICON1          ICON           "C:\\Users\\Stanislaw\\Desktop\\WIN32api + other    Win development\\programujte.com_3_resource\\grafika"

resource.h header: 
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif

#define IDI_ICON1                               100

then the compiler requires .rc to .o conversion

and then using Cobeblocks Project/build options/prebuild:

windres 3_icon.rc 3_icon.o

It does not get past windres in the prebuild. I get the "Permission denied" saying that I cannot access the .ico file.

Running target pre-build steps
windres 3_icon.rc 3_icon.o
windres: can't open icon file `C:\Users\Stanislaw\Desktop\WIN32api + other Win   development\programujte.com_3_resource\grafika': Permission denied

I am using CodeBlocks 10.05 on Win Vista 32bit.

Was it helpful?

Solution

The reference to an ICON resource needs to specify a file. It looks like you're pointing at a directory instead of a file.

You will get Permission Denied error messages when trying to 'open a directory as a file'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top