Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
#include <windows.h>

class CBasicWindow
{
private:
	HWND hHandle;
	static LRESULT CALLBACK wndproc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
	{
		switch (uMsg)
		{
		case WM_DESTROY:
				PostQuitMessage(0);
				return true;
				break;
	default:
		return	DefWindowProc(hwnd,uMsg,wParam,lParam);
			 break;
		}

	}
public:
	CBasicWindow(void):hHandle(0)
	{
		WNDCLASS wndclass;
		ZeroMemory(&wndclass,sizeof(wndclass));

		wndclass.style=CS_HREDRAW|CS_VREDRAW;
		wndclass.lpszClassName =TEXT("window1");
		wndclass.hbrBackground=(HBRUSH)(COLOR_BTNFACE+1);
		wndclass.hInstance=GetModuleHandle(0);
		wndclass.lpfnWndProc=(WNDPROC)wndproc;

		//Register the window class

		if(!RegisterClass(&wndclass))
			return ;

		// Create the window
		hHandle =CreateWindow(
							TEXT("window1"),
							TEXT("New Window"),
							WS_OVERLAPPEDWINDOW,
							CW_USEDEFAULT,
							CW_USEDEFAULT,
							CW_USEDEFAULT,
							CW_USEDEFAULT,
							0,
							0,
							GetModuleHandle(0),
							0);
		if (!hHandle)
			return;
		
	}

	void Show()
	{
		if (!hHandle)			
		ShowWindow(hHandle,SW_SHOW);
	}
};
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
	CBasicWindow cbwWindow;
	cbwWindow.Show;  // Error
	
	MSG msg;
	while(GetMessage(&msg,0,0,0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return 0;
}
</windows.h>






error C3867: 'CBasicWindow::Show': function call missing argument list; use '&CBasicWindow::Show' to create a pointer to member c:\documents and settings\...\test\main.cpp Line :64
Posted
Updated 20-Oct-11 19:31pm
v3

1 solution

Replace the line with

C++
cbwWindow.Show();


Calling a function requires the ( ) even if it takes no arguments.
 
Share this answer
 
Comments
MMChandrasekar 21-Oct-11 2:21am    
thank you...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900