Advertisement

win32 problem

Started by January 10, 2001 02:17 PM
2 comments, last by Lalle 24 years ago
I'm doing the tutorial at http://users.ox.ac.uk/~ball0597/Reference/WindowsProgramming/ I had a problem in the topic about adding dialog boxes: I've made a resource.h file with a dialog box in. The dialog box has id IDD_DIALOG1. Here is the code: #include windows.h //this has quotes on, but forum removed it #include tchar.h //this too #include "resource.h" BOOL MainDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { return FALSE; } int _tmain(void) { DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)MainDialogProc, 0); return 0; } Here is my error: --------------------Configuration: win - Win32 Debug-------------------- Linking... LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 Debug/win.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. win.exe - 2 error(s), 0 warning(s) Has anyone any idea of what is wrong? I'm using MSVC++ 6.0 Thanks in advance Edited by - Lalle on January 10, 2001 3:23:34 PM
Make sure you are building a Win32 Application and not a console application.

"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
We are creating a Multi-player space strategy/shoot-em-up/RPG game.
Development is well under way and we do have a playable demo.
Always looking for help.
Digital Euphoria Soft

Advertisement
wow, that was fast.
No, it is a win32 program, but thanks for reply anyway

Lalle
win32 apps have WinMain() as an entrypoint, not main(), or _tmain() like you''re using, as far as i know you can use WinMain() for Unicode too, you just can''t use the command line string, you''ll have to use GetCommandLine() for that

notice that i''ve added EndDialog() in your dialogprocedure, otherwise you wouldn''t be able to close the dialog

and you don''t have to use GetModuleHandle() anymore, you get the instance handle from WinMain()

      #include windows.h#include tchar.h#include "resource.h"BOOL MainDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){	switch(uMsg)	{		case WM_COMMAND:			switch(LOWORD(wParam))			{				case IDOK:				case IDCANCEL:					EndDialog(hWnd, IDCANCEL);					return TRUE;			}			break;	}	return FALSE;}int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdShow){	DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)MainDialogProc);	return 0;}  


please correct me if i''m wrong

This topic is closed to new replies.

Advertisement