C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-24-2009, 04:00 AM   #1
Registered User
 
Join Date: Oct 2009
Posts: 4
Edit Control

Hi, I have a error with my createwindow for the edit control:C2198 to few parameters.
As far as I can see the parameters are correct or am I not seeing something stupid that I did. If I comment out the createwindow for the edit control all compiles ok.
Code:
#include <windows.h>

#define IDC_EDIT WM_USER + 1000;

LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );

HINSTANCE hInst;

int WINAPI WinMain( HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode )
{
	WNDCLASSEX wc;
	HWND hwnd;
	HWND hEdit;
	MSG msg;
	
	hInst = hThisInst;
	
	// register window class
	wc.cbSize = sizeof( WNDCLASSEX );
	wc.style = 0;
	wc.lpfnWndProc = WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = hInst;
	wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
	wc.hIconSm = NULL;
	wc.hCursor = LoadCursor( NULL, IDC_ARROW );
	wc.hbrBackground = ( HBRUSH )GetStockObject( BLACK_BRUSH );
	wc.lpszMenuName = NULL;
	wc.lpszClassName = "EditBoxTest";
	RegisterClassEx( &wc );
	
	// create main window
	hwnd = CreateWindow( "EditBoxTest", 
		                 "EditBox Test", 
		                 WS_OVERLAPPEDWINDOW,
		                 0, 0, 800, 600,
		                 NULL, NULL, hInst, NULL );

	// create edit box
	hEdit = CreateWindowEx(WS_EX_CLIENTEDGE,TEXT("Edit"),"",WS_CHILD|WS_VISIBLE,
                             10,10,200,30,hwnd,
                             (HMENU)IDC_EDIT,hInst,NULL);

	
	ShowWindow( hwnd, nWinMode );
	UpdateWindow( hwnd );

	while( GetMessage( &msg, NULL, 0, 0 ) )
	{
		TranslateMessage( &msg );
		DispatchMessage( &msg );
	}
	
	return msg.wParam;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch( message )
	{
		case WM_DESTROY: PostQuitMessage( 0 );
		                 break;
		default: return DefWindowProc( hwnd, message, wParam, lParam );
			     break;
	}
	return 0;
}
Kosei Inoue is offline   Reply With Quote
Old 10-24-2009, 08:22 AM   #2
and the Hat of Guessing
 
tabstop's Avatar
 
Join Date: Nov 2007
Posts: 8,740
I get the error "missing ';' before ','" when compiling your code. The reason for that is you have an extraneous semicoloin at the end of your #define at the top.
tabstop is offline   Reply With Quote
Old 10-24-2009, 09:01 AM   #3
Registered User
 
Join Date: Oct 2009
Posts: 4
ugh I knew it would be something dumb, must have typed the ; without thinking. I never thought to check before winmain for the error, but i guess the error was in winmain as IDC_EDIT would have been replaced by a value with an ; on the end of it.
Thanks
Kosei Inoue is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I send a text string to an edit control marc74 Windows Programming 5 01-06-2005 10:14 PM
Appending text to an edit control dit6a9 Windows Programming 3 08-13-2004 09:52 PM
Restricting input to an edit control bennyandthejets Windows Programming 7 10-05-2003 01:10 AM
endless edit control ZerOrDie Windows Programming 3 03-21-2003 02:51 AM
Keeping focus on an edit control ... Unregistered Windows Programming 3 02-19-2002 02:12 AM


All times are GMT -6. The time now is 06:07 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22