Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Lalle

win32 problem

This topic is 6430 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!