Jump to content
  • Advertisement

Archived

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

CoolTomK

Dialog Boxes Help!

This topic is 5817 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 am having problems setting up a dialog box. When I try to compile my code when it is named mycode.c, it compiles perfectly, but when try to compile when it is names mycode.cpp, I get this error:
  
error C2664: 'DialogBoxParamA' : cannot convert parameter 4 from 'int (void *,unsigned int,unsigned int,long)' to 'int (__stdcall *)(void)'
 [\source] 

I am assuming that the file name endings tell the compiler to compile in c or c++.  And am wondering why my dialog box code wont compile under C++.  Oh yeah I am using MS VC++ 5.0...

here is my code:
[source]
BOOL	CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM);

//window procedure

BOOL CALLBACK AboutDlgProc(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
{
	switch(Message)
	{
	case WM_INITDIALOG:
		return TRUE;
	case WM_COMMAND:
		switch(LOWORD(wParam))
		{
		case IDOK:
			EndDialog(hWndDlg, 0);
			return TRUE;
		case IDC_LINKBUTTON:
			ShellExecute(NULL, "open", "http://www.keanecircuits.com", NULL, NULL, SW_SHOWDEFAULT);

			break;

		}
		break;
	}

	return FALSE;
}

//how I create the dialog box(line where error occurs)

DialogBox(hInstance, "ABOUTDLG", hWndMain, AboutDlgProc);

 [\source] 

Has anybody experienced a problem like this before, or can help me out???

<SPAN CLASS=editedby>[edited by - CoolTomK on July 18, 2002 4:40:13 PM]</SPAN>  

Share this post


Link to post
Share on other sites
Advertisement
add this line before including any headers:

#define STRICT

should help.

---
Come to #directxdev IRC channel on AfterNET

Share this post


Link to post
Share on other sites
Does you prototype and definition of AboutDlgProc look like this?

BOOL CALLBACK AboutDlgProc(HWND,UINT ,WPARAM , LPARAM );

BOOL CALLBACK AboutDlgProc(HWND hAbout,UINT msg,WPARAM wParam,
LPARAM lParam)
{
whatever !
}

maybe !!!

Share this post


Link to post
Share on other sites
quote:
Original post by doctorsixstring
DialogBox(hInstance, "ABOUTDLG", hWndMain, (DLGPROC) AboutDlgProc);


it''s better to use STRICT, you get type safety => catch more errors at compile-time rather than at run-time.

---
Come to #directxdev IRC channel on AfterNET

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!