|
From: Andre M. B. <ab...@cp...> - 2005-01-04 16:08:39
|
Dear Users,
I am trying to compile a Windows .C project with
the three files: the .c source-code, the .rc resource file=20
and the .h resource.h file. I still getting the compile
error message in the resource file.
Two sets of recommendations I=B4ve already receive. The
two sets I=B4ve already implemented.
The previous e-mail already showed the results of the
1st set of recommendations (->to update Dev without effect,
->#include <windows.h> inside the .rc file with good effect
to some cases, ->to begin with an empty project, instead of
a windows project without effect).
Here are the results of the the 2nd. set of=20
recommendations:
1-To update the binutils packet from mingw to get the
newest windres.exe:
I made the download (current packet option) and
installed FULL binutils packet over my c:\dev-cpp folder
(on the respective places, ok?), but the version of the=20
windres.exe file was the same, that is, 2.15.91, and
the compile error on resource file message was the
same.
2-To add c:\dev-cpp\bin folder on the PATH variable:
I put on the AUTOEXEC.BAT, boot the computer and
the compile error message on the resource file
"fowarded" to some lines bellow, stopping specifically=20
indicating a "unkown" IDC_STATIC constant. Looking
for this constant, I found it in winuser.h (that
is automatically called via windows.h). I "forced"
a #define IDC_STATIC -1 in the resource.h, but the
compile error message "forwarded" again and stopped
in another place :-(((
Please be patient...
Any other ideas?
Regards
Andre Barros
If it is interesting to anyone, here are the=20
codes:
*************** about1.c ***************************************
/*------------------------------------------
ABOUT1.C -- About Box Demo Program No. 1
(c) Charles Petzold, 1998
------------------------------------------*/
#include <windows.h>
#include "resource.h"
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
BOOL CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM) ;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] =3D TEXT ("About1") ;
MSG msg ;
HWND hwnd ;
WNDCLASS wndclass ;
=20
wndclass.style =3D CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc =3D WndProc ;
wndclass.cbClsExtra =3D 0 ;
wndclass.cbWndExtra =3D 0 ;
wndclass.hInstance =3D hInstance ;
wndclass.hIcon =3D LoadIcon (hInstance, szAppName) ;
wndclass.hCursor =3D LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground =3D (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName =3D szAppName ;
wndclass.lpszClassName =3D szAppName ;
=20
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
=20
hwnd =3D CreateWindow (szAppName, TEXT ("About Box Demo Program"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL) ;
=20
ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;=20
=20
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM=20
lParam)
{
static HINSTANCE hInstance ;
=20
switch (message)
{
case WM_CREATE :
hInstance =3D ((LPCREATESTRUCT) lParam)->hInstance ;
return 0 ;
=20
case WM_COMMAND :
switch (LOWORD (wParam))
{
case IDM_APP_ABOUT :
DialogBox (hInstance, TEXT ("AboutBox"), hwnd, AboutDlgPro=
c) ;
break ;
}
return 0 ;
=20
case WM_DESTROY :
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT message,=20
WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG :
return TRUE ;
=20
case WM_COMMAND :
switch (LOWORD (wParam))
{
case IDOK :
case IDCANCEL :
EndDialog (hDlg, 0) ;
return TRUE ;
}
break ;
}
return FALSE ;
}
***************************************************************
************ about1.rc ************************************
#include <windows.h>
#include "resource.h"
ABOUTBOX DIALOG DISCARDABLE 32, 32, 180, 102
STYLE DS_MODALFRAME | WS_POPUP
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,66,81,50,14
/*
ICON "ABOUT1",IDC_STATIC,7,7,21,20
*/
ICON "ABOUT1",-1,7,7,21,20
CTEXT "About1",IDC_STATIC,40,12,100,8
CTEXT "About Box Demo Program",IDC_STATIC,7,40,166,8
CTEXT "(c) Charles Petzold, 1998",IDC_STATIC,7,52,166,8
END
ABOUT1 MENU DISCARDABLE =20
BEGIN=20
POPUP "&Help"
BEGIN
MENUITEM "&About About1...", IDM_APP_ABOUT
END
END
ABOUT1 ICON DISCARDABLE "about1.ico"
GUIDELINES DESIGNINFO DISCARDABLE=20
BEGIN
"ABOUTBOX", DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 173
TOPMARGIN, 7
BOTTOMMARGIN, 95
END
END
***************************************************************
************** resource.h *******************************
#include <windows.h>
#define IDM_APP_ABOUT 40001
*********************************************************
****************** makefile.win ******************
# Project: p-about1
# Makefile created by Dev-C++ 4.9.9.1
CPP =3D g++.exe
CC =3D gcc.exe
WINDRES =3D windres.exe
RES =3D p-about1_private.res
OBJ =3D about1.o $(RES)
LINKOBJ =3D about1.o $(RES)
LIBS =3D -L"C:/Dev-Cpp/lib" -mwindows =20
INCS =3D -I"C:/Dev-Cpp/include" -I"C:/Dev-Cpp/include"=20
CXXINCS =3D -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw3=
2" -
I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include" -I"C:/Dev-
Cpp/include"=20
BIN =3D p-about1.exe
CXXFLAGS =3D $(CXXINCS) =20
CFLAGS =3D $(INCS) =20
.PHONY: all all-before all-after clean clean-custom
all: all-before p-about1.exe all-after
clean: clean-custom
rm -f $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o "p-about1.exe" $(LIBS)
about1.o: about1.c
$(CC) -c about1.c -o about1.o $(CFLAGS)
p-about1_private.res: p-about1_private.rc about1.rc=20
$(WINDRES) -i p-about1_private.rc --input-format=3Drc -o p-
about1_private.res -O coff=20
******************************************************
|