PDA

Click to See Complete Forum and Search --> : C++ GUI this tutorial i found isnt working.


flamewavetech
Jan 10th, 2002, 07:47 PM
i found a tutorial and it gave me this code

#include <windows.h>
#include <tchar.h>
#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;
}

im using VC++ compiler so i went to insert and made a new dialog and saved it. i then compiled it and got the following errors:

--------------------Configuration: test GUI4 - Win32 Debug--------------------
Compiling...
source.cpp
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/test GUI4.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

test GUI4.exe - 2 error(s), 0 warning(s)


So can someone please tell me why it isnt working?

nabeels786
Jan 10th, 2002, 08:21 PM
make sure ur doing a win32 application, not a console application

this place has good win32 tutorials, check it out
http://www.free-ed.net/fr03/lfc/030203/122/

CornedBee
Jan 11th, 2002, 02:12 PM
No. You wrote the function main, so you need to make it a console application, not a normal application.

flamewavetech
Jan 11th, 2002, 03:00 PM
what would i have to do to make it run for win32 application?

parksie
Jan 11th, 2002, 05:02 PM
int __stdcall WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *lpCmdLine, int nCmdShow) {
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, MainDialogProc, 0);
return 0;
}:)