![]() |
| | #1 |
| Registered User Join Date: Oct 2009
Posts: 4
| Edit Control 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 | |
| | #2 |
| and the Hat of Guessing 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 | |
| | #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 | |
![]() |
| Thread Tools | |
| Display Modes | |
|
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 |