hello all,
I have just wrote an application that looks error free to me, but according to my MSVC 6.0 there is a linker error . here is my code, compiles 0 errors 0 warnings. also note that I am using stdafx for the precompiled header, and I have the following included in stdafx.h:
Code:
#include <cstdlib>
#include <windows.h>
#include <commctrl.h>
Code:
#include "stdafx.h"
#include "resource.h"
static BOOL CALLBACK DialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASS wc;
INITCOMMONCONTROLSEX cc;
memset(&wc, 0, sizeof(wc));
wc.lpfnWndProc = DefDlgProc;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.lpszClassName = "stringscan";
RegisterClass(&wc);
memset(&cc, 0, sizeof(cc));
cc.dwSize = sizeof(cc);
cc.dwICC = 0xffffffff;
InitCommonControlsEx(&cc);
return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG), NULL, (DLGPROC)DialogFunc);
}
static int InitApp(HWND hDlg, WPARAM wParam, LPARAM lParam)
{
/* initialize some controls with values here */
return 1;
}
static BOOL CALLBACK DialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
case WM_INITDIALOG:
InitApp(hwndDlg, wParam, lParam);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDC_BUTTON_SCAN:
/* do some tests and call scan function */
break;
}
case WM_CLOSE:
EndDialog(hwndDlg, 0);
return TRUE;
}
return FALSE;
}
the full error that I am getting is:
stringscan.obj : error LNK2001: unresolved external symbol __imp__InitCommonControlsEx@4 Release/stringscan.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe
stringscan.exe - 2 error(s), 0 warning(s)
according to it it has something to do with InitCommonControls? don't see what I am doing wrong there . could it have something to do with WIN32_LEAN_AND_MEAN defined in stdafx.h? somehow it might be excluding commctrl.h?
can anyone please help show me what is going wrong here? thanks in advance.