1 /* Edit Control Test for ReactOS, quick n' dirty. Very rigid too. 2 * There you go, is only a test program. Not made to be fast, small 3 * easy to mantain, or portable. Lots of duplicated code too. 4 5 * I'm not erasing text because I don't want to use other functions from th API 6 * or make this more complex. 7 8 * This source code is in the PUBLIC DOMAIN and has NO WARRANTY. 9 * by Waldo Alvarez Ca�izares <wac at ghost.matcom.uh.cu>, June 22, 2003. */ 10 11 //#define WIN32_LEAN_AND_MEAN 12 #include <windows.h> 13 #include "utils.h" 14 15 #define CREATEWINDOW 106 16 #define CREATEWINDOWEX 107 17 #define CREATEWINDOWW 108 18 19 #define ResultX 0 20 #define ResultY 305 21 22 #define NOTIFYX 350 23 #define NOTIFYY 285 24 25 #define BUFFERLEN 80 /* Size of buffer to hold result strings */ 26 27 /* Edit is created with this text */ 28 #define TestStr "The quick brown fox jumps over the lazy dog" 29 30 #define TestStrW L"This is a WCHAR string" /* Wide to support unicode edits */ 31 32 #define MAXMESSAGEBUTTONS 42 33 34 HWND g_hwnd = NULL; 35 HINSTANCE g_hInst = NULL; 36 37 int pos = 10; 38 int n = 0; 39 int yButPos = 10; 40 int xButPos = 10; 41 42 DWORD EditStyle = 0; 43 DWORD EditWidth = 240; 44 DWORD EditHeight = 250; 45 46 BOOL UnicodeUsed = FALSE; 47 48 HWND hwndEdit = NULL; 49 50 POINTL point={10,3}; 51 RECT rect = {0,0,20,20},rect2; 52 DWORD StartP,EndP; 53 54 #define ReplaceTextStr "->> Replaced!! <<-" 55 56 char* AllocatedText; /* Buffer in the heap to feed it to the edit control */ 57 char* NewText = "New text for the edit control"; 58 wchar_t* NewTextW = L"New text for the edit control in UNICODE"; // Wide 59 60 char TextBuffer[BUFFERLEN]={'R','e','s','u','l','t',':',' '}; 61 62 typedef void FunctionHandler(HWND,DWORD,WPARAM,LPARAM); 63 typedef FunctionHandler* LPFUNCTIONHANDLER; 64 65 VOID 66 PrintTextXY(char* Text,int x,int y,int len) 67 { 68 HDC hdc; 69 hdc = GetDC (g_hwnd); 70 SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT)); 71 72 TextOut (hdc, x,y,Text,len); 73 ReleaseDC (g_hwnd, hdc); 74 ValidateRect (g_hwnd, &rect); 75 } 76 77 static 78 VOID 79 HandlePrintReturnHex(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam) 80 { 81 int ret; 82 ret = SendMessage(handle,Msg,wParam,lParam); 83 htoa(ret,&TextBuffer[8]); 84 PrintTextXY(TextBuffer,ResultX,ResultY,16); 85 } 86 87 static 88 VOID 89 HandleSetHandlePrintHex(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam) 90 { 91 LPVOID pMem; 92 HANDLE hNewBuffer; 93 int ret; 94 95 LocalFree((HLOCAL)SendMessage(handle, EM_GETHANDLE, 0, 0L)); 96 if (UnicodeUsed) 97 { 98 hNewBuffer = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, 100); 99 pMem = LocalLock(hNewBuffer); 100 strcpyw_((wchar_t*)pMem,NewTextW); 101 } 102 else 103 { 104 hNewBuffer = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT,50); 105 pMem = LocalLock(hNewBuffer); 106 strcpy_((char*)pMem,NewText); 107 } 108 109 LocalUnlock(pMem); 110 hNewBuffer = LocalHandle(pMem); 111 112 /* Updates the buffer and displays new buffer */ 113 ret = SendMessage(handle, EM_SETHANDLE, (WPARAM)hNewBuffer, 0L); 114 115 htoa(ret,&TextBuffer[8]); 116 PrintTextXY(TextBuffer,ResultX,ResultY,16); 117 } 118 119 static 120 VOID 121 HandlePrintReturnStr(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam) 122 { 123 int ret; 124 TextBuffer[8] = (char)(BUFFERLEN - 8); /* Setting the max size to put chars in first byte */ 125 ret = SendMessage(handle,Msg,wParam,lParam); 126 PrintTextXY(TextBuffer,ResultX,ResultY,8+ret); 127 } 128 129 static 130 VOID 131 HandlePrintRect(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam) 132 { 133 TextBuffer[8] = (char)(BUFFERLEN - 8); /* Setting the max size to put chars in first byte */ 134 SendMessage(handle,Msg,wParam,lParam); 135 136 htoa(rect.top,&TextBuffer[8]); 137 TextBuffer[8+8] = ' '; 138 htoa(rect.bottom,&TextBuffer[8+8+1]); 139 TextBuffer[8+8+8+1] = ' '; 140 htoa(rect.left,&TextBuffer[8+8+8+1+1]); 141 TextBuffer[8+8+8+8+1+1] = ' '; 142 htoa(rect.right,&TextBuffer[8+8+8+8+1+1+1]); 143 144 PrintTextXY(TextBuffer,ResultX,ResultY,8+4*9-1); 145 } 146 147 static 148 VOID 149 HandlePrintPasswdChar(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam) 150 { 151 HDC hdc; 152 int ret = SendMessage(handle,Msg,wParam,lParam); 153 154 int s; 155 156 if (ret) 157 { 158 s = 1; 159 TextBuffer[8] = (char)(ret); 160 } 161 else 162 { 163 TextBuffer[8] = 'N'; 164 TextBuffer[9] = 'U'; 165 TextBuffer[10] = 'L'; 166 TextBuffer[11] = 'L'; 167 s = 4; 168 } 169 170 hdc = GetDC (g_hwnd); 171 SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT)); 172 173 TextOut (hdc,ResultX ,ResultY,TextBuffer,8+s); 174 ReleaseDC (g_hwnd, hdc); 175 ValidateRect (g_hwnd, &rect); 176 } 177 178 179 struct 180 { 181 char* Text; /* Text for the button */ 182 DWORD MsgCode; /* Message Code */ 183 WPARAM wParam; /* Well hope you can understand this */ 184 LPARAM lParam; /* ditto */ 185 LPFUNCTIONHANDLER Handler; /* Funtion called to handle the result of each message */ 186 } 187 Msg[] = 188 { 189 {"EM_CANUNDO",EM_CANUNDO,0,0,&HandlePrintReturnHex}, 190 {"EM_CHARFROMPOS",EM_CHARFROMPOS,(WPARAM)&point,0,&HandlePrintReturnHex}, 191 {"EM_EMPTYUNDOBUFFER",EM_EMPTYUNDOBUFFER,0,0,&HandlePrintReturnHex}, 192 {"EM_FMTLINES",EM_FMTLINES,TRUE,0,&HandlePrintReturnHex}, 193 {"EM_GETFIRSTVISIBLELINE",EM_GETFIRSTVISIBLELINE,0,0,&HandlePrintReturnHex}, 194 195 {"EM_GETLIMITTEXT",EM_GETLIMITTEXT,0,0,&HandlePrintReturnHex}, 196 {"EM_GETLINE",EM_GETLINE,2,(WPARAM)&TextBuffer[8],&HandlePrintReturnStr}, 197 {"EM_GETLINECOUNT",EM_GETLINECOUNT,0,0,&HandlePrintReturnHex}, 198 {"EM_GETMARGINS",EM_GETMARGINS,0,0,&HandlePrintReturnHex}, 199 {"EM_SETMARGINS",EM_SETMARGINS,EC_LEFTMARGIN,10,&HandlePrintReturnHex}, 200 201 {"EM_GETMODIFY",EM_GETMODIFY,0,0,&HandlePrintReturnHex}, 202 {"EM_SETMODIFY",EM_SETMODIFY,TRUE,0,&HandlePrintReturnHex}, 203 204 {"EM_GETSEL",EM_GETSEL,(WPARAM)&StartP,(LPARAM)&EndP,&HandlePrintReturnHex}, 205 206 {"EM_GETTHUMB",EM_GETTHUMB,0,0,&HandlePrintReturnHex}, 207 208 {"EM_LIMITTEXT",EM_LIMITTEXT,10,0,&HandlePrintReturnHex}, 209 {"EM_LINEFROMCHAR",EM_LINEFROMCHAR,-1,0,&HandlePrintReturnHex}, 210 {"EM_POSFROMCHAR",EM_POSFROMCHAR,10,0,&HandlePrintReturnHex}, 211 {"EM_LINEINDEX",EM_LINEINDEX,2,0,&HandlePrintReturnHex}, 212 {"EM_LINELENGTH",EM_LINELENGTH,-1,0,&HandlePrintReturnHex}, 213 214 {"EM_GETWORDBREAKPROC",EM_GETWORDBREAKPROC,0,0,&HandlePrintReturnHex}, 215 {"EM_REPLACESEL",EM_REPLACESEL,TRUE,(LPARAM)&ReplaceTextStr,&HandlePrintReturnHex}, 216 217 {"EM_LINESCROLL",EM_LINESCROLL,5,1,&HandlePrintReturnHex}, 218 {"EM_SCROLL",EM_SCROLL,SB_LINEDOWN,0,&HandlePrintReturnHex}, 219 {"EM_SCROLLCARET",EM_SCROLLCARET,0,0,&HandlePrintReturnHex}, 220 221 {"EM_SETHANDLE",EM_SETHANDLE,0,0,&HandleSetHandlePrintHex}, 222 {"EM_GETHANDLE",EM_GETHANDLE,0,0,&HandlePrintReturnHex}, 223 {"EM_GETPASSWORDCHAR",EM_GETPASSWORDCHAR,0,0,&HandlePrintPasswdChar}, 224 {"EM_SETPASSWORDCHAR - clear",EM_SETPASSWORDCHAR,0,0,&HandlePrintReturnHex}, 225 {"EM_SETPASSWORDCHAR - x",EM_SETPASSWORDCHAR,'x',0,&HandlePrintReturnHex}, 226 227 {"EM_SETREADONLY - set",EM_SETREADONLY,TRUE,0,&HandlePrintReturnHex}, 228 {"EM_SETREADONLY - clear",EM_SETREADONLY,FALSE,0,&HandlePrintReturnHex}, 229 230 {"EM_GETRECT",EM_GETRECT,0,(LPARAM)&rect2,&HandlePrintRect}, 231 {"EM_SETRECT",EM_SETRECT,0,(LPARAM)&rect,&HandlePrintReturnHex}, 232 {"EM_SETRECTNP",EM_SETRECTNP,0,(LPARAM)&rect,&HandlePrintReturnHex}, 233 {"EM_SETSEL",EM_SETSEL,1,3,&HandlePrintReturnHex}, 234 235 {"EM_SETSEL - all",EM_SETSEL,0,-1,&HandlePrintReturnHex}, 236 {"EM_SETSEL - remove",EM_SETSEL,-1,0,&HandlePrintReturnHex}, 237 {"EM_UNDO",EM_UNDO,0,0,&HandlePrintReturnHex}, 238 {"WM_UNDO",WM_UNDO,0,0,&HandlePrintReturnHex}, 239 {"WM_PASTE",WM_PASTE,0,0,&HandlePrintReturnHex}, 240 241 {"WM_CUT",WM_CUT,0,0,&HandlePrintReturnHex}, 242 {"WM_COPY",WM_COPY,0,0,&HandlePrintReturnHex} 243 244 }; 245 246 DWORD EditStyles[] = { 247 WS_THICKFRAME,WS_DISABLED,WS_BORDER,ES_LOWERCASE,ES_UPPERCASE,ES_NUMBER,ES_AUTOVSCROLL, 248 ES_AUTOHSCROLL,ES_LEFT,ES_CENTER,ES_RIGHT,ES_MULTILINE, 249 ES_NOHIDESEL,ES_OEMCONVERT,ES_PASSWORD,ES_READONLY,ES_WANTRETURN, 250 WS_HSCROLL,WS_VSCROLL 251 }; 252 253 char* StyleNames[] = { 254 "WS_THICKFRAME","WS_DISABLED","WS_BORDER","ES_LOWERCASE","ES_UPPERCASE","ES_NUMBER","ES_AUTOVSCROLL", 255 "ES_AUTOHSCROLL","ES_LEFT","ES_CENTER","ES_RIGHT","ES_MULTILINE", 256 "ES_NOHIDESEL","ES_OEMCONVERT","ES_PASSWORD","ES_READONLY","ES_WANTRETURN", 257 "WS_HSCROLL","WS_VSCROLL" 258 }; 259 260 #define NUMBERBUTTONS 26 261 HWND Buttons[NUMBERBUTTONS]; 262 HWND MessageButtons[MAXMESSAGEBUTTONS]; 263 HWND Back1But,Back2But; 264 HWND NextBut; 265 266 267 HWND 268 CreateCheckButton(const char* lpWindowName, DWORD xSize, DWORD id) 269 { 270 HWND h; 271 h = CreateWindowEx(0, 272 "BUTTON", 273 lpWindowName, 274 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 275 xButPos, /* x */ 276 yButPos, /* y */ 277 xSize, /* nWidth */ 278 20, /* nHeight */ 279 g_hwnd, 280 UlongToHandle(id), 281 g_hInst, 282 NULL 283 ); 284 yButPos += 21; 285 return h; 286 } 287 288 HWND 289 CreatePushButton(const char* lpWindowName, DWORD xSize, DWORD id,DWORD Style) 290 { 291 292 HWND h = CreateWindow("BUTTON", 293 lpWindowName, 294 WS_CHILD | BS_PUSHBUTTON | Style, 295 xButPos, // x 296 yButPos, // y 297 xSize, // nWidth 298 20, // nHeight 299 g_hwnd, 300 (HMENU)(ULONG_PTR) id, 301 g_hInst, 302 NULL 303 ); 304 305 yButPos += 21; 306 return h; 307 } 308 309 VOID 310 ReadNHide() 311 { 312 int i; 313 EditStyle = 0; 314 for (i=0 ; i< 19 ; i++) 315 { 316 if(BST_CHECKED == SendMessage(Buttons[i],BM_GETCHECK,0,0)) 317 EditStyle |= EditStyles[i]; 318 ShowWindow(Buttons[i],SW_HIDE); 319 } 320 321 for (; i< NUMBERBUTTONS ; i++)ShowWindow(Buttons[i],SW_HIDE); 322 for (i=0 ; i< 26 ; i++) ShowWindow(MessageButtons[i],SW_SHOW); 323 324 ShowWindow(Back1But,SW_SHOW); 325 ShowWindow(NextBut,SW_SHOW); 326 } 327 328 VOID 329 ForwardToSecondPage() 330 { 331 int i; 332 for (i=0;i<26;i++)ShowWindow(MessageButtons[i],SW_HIDE); 333 for(;i<MAXMESSAGEBUTTONS;i++)ShowWindow(MessageButtons[i],SW_SHOW); 334 ShowWindow(Back2But,SW_SHOW); 335 336 ShowWindow(Back1But,SW_HIDE); 337 ShowWindow(NextBut,SW_HIDE); 338 } 339 340 VOID 341 BackToFirstPage() 342 { 343 int i; 344 for (i=0;i<26;i++)ShowWindow(MessageButtons[i],SW_SHOW); 345 for(;i<MAXMESSAGEBUTTONS;i++)ShowWindow(MessageButtons[i],SW_HIDE); 346 ShowWindow(Back2But,SW_HIDE); 347 ShowWindow(Back1But,SW_SHOW); 348 ShowWindow(NextBut,SW_SHOW); 349 } 350 351 VOID 352 BackToInitialPage() 353 { 354 int i; 355 DestroyWindow(hwndEdit); 356 for (i=0 ; i< NUMBERBUTTONS ; i++) {ShowWindow(Buttons[i],SW_SHOW);} 357 for (i=0;i<26;i++)ShowWindow(MessageButtons[i],SW_HIDE); 358 ShowWindow(Back1But,SW_HIDE); 359 ShowWindow(NextBut,SW_HIDE); 360 } 361 362 LRESULT 363 CALLBACK 364 WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) 365 { 366 int i; 367 switch ( msg ) 368 { 369 case WM_CREATE: 370 g_hwnd = hwnd; 371 372 /* ---- Initial page ---- */ 373 374 for (i = 0 ; i < 14 ; i++) 375 Buttons[i] = CreateCheckButton(StyleNames[i],150,500+i); 376 377 xButPos += 160; 378 yButPos = 10; 379 380 for (; i < 19 ; i++) 381 Buttons[i] = CreateCheckButton(StyleNames[i],140,500+i); 382 383 Buttons[i++] = CreatePushButton("Width +",70,100,WS_VISIBLE); 384 Buttons[i++] = CreatePushButton("Width -",70,101,WS_VISIBLE); 385 386 Buttons[i++] = CreatePushButton("Heigth +",70,102,WS_VISIBLE); 387 Buttons[i++] = CreatePushButton("Heigth -",70,103,WS_VISIBLE); 388 389 Buttons[i++] = CreatePushButton("CreateWindowA",140,CREATEWINDOW,WS_VISIBLE); 390 Buttons[i++] = CreatePushButton("CreateWindowExA",140,CREATEWINDOWEX,WS_VISIBLE); 391 Buttons[i++] = CreatePushButton("CreateWindowExW",140,CREATEWINDOWW,WS_VISIBLE); 392 393 394 /* ---- The 1st page of buttons ---- */ 395 396 xButPos = 0; 397 yButPos = 10; 398 399 for (i = 0 ; i < 14 ; i++) 400 MessageButtons[i] = CreatePushButton(Msg[i].Text,170,600+i,0); 401 402 xButPos += 180; 403 yButPos = 10; 404 405 for (; i < 26 ; i++) 406 MessageButtons[i] = CreatePushButton(Msg[i].Text,170,600+i,0); 407 408 Back1But = CreatePushButton("Back - destroys edit",170,400,0); 409 NextBut = CreatePushButton("Next",170,401,0); 410 411 /* ---- The 2nd page of buttons ------*/ 412 413 xButPos = 0; 414 yButPos = 10; 415 416 for (; i<40; i++) 417 MessageButtons[i] = CreatePushButton(Msg[i].Text,170,600+i,0); 418 419 xButPos += 180; 420 yButPos = 10; 421 422 for (; i < MAXMESSAGEBUTTONS ; i++) 423 MessageButtons[i] = CreatePushButton(Msg[i].Text,170,600+i,0); 424 425 Back2But = CreatePushButton("Back",170,402,0); 426 427 break; 428 429 case WM_COMMAND: 430 if (LOWORD(wParam) >= 600) 431 { 432 Msg[LOWORD(wParam)-600].Handler(hwndEdit, 433 Msg[LOWORD(wParam)-600].MsgCode, 434 Msg[LOWORD(wParam)-600].wParam, 435 Msg[LOWORD(wParam)-600].lParam); 436 break; 437 } 438 439 switch(LOWORD(wParam)){ 440 441 case 100: 442 EditWidth += 10; 443 break; 444 445 case 101: 446 EditWidth -= 10; 447 break; 448 449 case 102: 450 EditHeight += 10; 451 break; 452 453 case 103: 454 EditHeight -= 10; 455 break; 456 457 case 400: 458 BackToInitialPage(); 459 break; 460 461 case 401: 462 ForwardToSecondPage(); 463 break; 464 465 case 402: 466 BackToFirstPage(); 467 break; 468 469 case CREATEWINDOW: 470 UnicodeUsed = FALSE; 471 ReadNHide(); 472 hwndEdit = CreateWindow("EDIT", 473 TestStr, 474 EditStyle | WS_CHILD | WS_VISIBLE, 475 350, 476 10, 477 EditWidth, 478 EditHeight, 479 g_hwnd, 480 NULL, 481 g_hInst, 482 NULL); 483 break; 484 485 case CREATEWINDOWEX: 486 UnicodeUsed = FALSE; 487 ReadNHide(); 488 hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE, 489 "EDIT", 490 TestStr, 491 EditStyle | WS_CHILD | WS_VISIBLE , 492 350, 493 10, 494 EditWidth, 495 EditHeight, 496 g_hwnd, 497 NULL, 498 g_hInst, 499 NULL); 500 break; 501 502 case CREATEWINDOWW: 503 UnicodeUsed = TRUE; 504 ReadNHide(); 505 hwndEdit = CreateWindowExW(WS_EX_CLIENTEDGE, 506 L"EDIT", 507 TestStrW, 508 EditStyle | WS_CHILD | WS_VISIBLE , 509 350, 510 10, 511 EditWidth, 512 EditHeight, 513 g_hwnd, 514 NULL, 515 g_hInst, 516 NULL); 517 break; 518 } 519 520 if (lParam == (LPARAM)hwndEdit) 521 switch(HIWORD(wParam)) 522 { 523 case EN_CHANGE: 524 PrintTextXY("EN_CHANGE notification",NOTIFYX,NOTIFYY,22); 525 break; 526 527 case EN_ERRSPACE: 528 PrintTextXY("EN_ERRSPACE notification",NOTIFYX,NOTIFYY,24); 529 break; 530 531 /* --- FIXME not defined in w32api-2.3 headers 532 case H_SCROLL: 533 PrintTextXY("H_SCROLL notification",NOTIFYX,NOTIFYY,21); 534 break; */ 535 536 /* --- FIXME not defined in w32api-2.3 headers 537 case KILL_FOCUS: 538 PrintTextXY("KILL_FOCUS notification",NOTIFYX,NOTIFYY,23); 539 break; */ 540 541 /* --- FIXME not defined in w32api-2.3 headers 542 case EN_MAXTEST: 543 PrintTextXY("EN_MAXTEXT notification",NOTIFYX,NOTIFYY,23); 544 break; */ 545 546 case EN_SETFOCUS: 547 PrintTextXY("EN_SETFOCUS notification",NOTIFYX,NOTIFYY,24); 548 break; 549 550 case EN_UPDATE: 551 PrintTextXY("EN_UPDATE notification",NOTIFYX,NOTIFYY + 20,22); 552 break; 553 554 case EN_VSCROLL: 555 PrintTextXY("EN_VSCROLL notification",NOTIFYX,NOTIFYY,23); 556 break; 557 558 } 559 560 break; 561 562 case WM_SIZE : 563 return 0; 564 565 case WM_CLOSE: 566 DestroyWindow (g_hwnd); 567 return 0; 568 569 case WM_QUERYENDSESSION: 570 return 0; 571 572 case WM_DESTROY: 573 PostQuitMessage(0); 574 return 0; 575 } 576 return DefWindowProc ( hwnd, msg, wParam, lParam ); 577 } 578 579 HWND 580 RegisterAndCreateWindow (HINSTANCE hInst, 581 const char* className, 582 const char* title) 583 { 584 WNDCLASSEX wc; 585 HWND hwnd; 586 587 g_hInst = hInst; 588 589 wc.cbSize = sizeof (WNDCLASSEX); 590 591 wc.lpfnWndProc = WndProc; /* window procedure */ 592 wc.hInstance = hInst; /* owner of the class */ 593 594 wc.lpszClassName = className; 595 wc.hCursor = LoadCursor ( 0, (LPCTSTR)IDC_ARROW ); 596 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); 597 wc.style = CS_HREDRAW | CS_VREDRAW; 598 wc.cbClsExtra = 0; 599 wc.cbWndExtra = 0; 600 wc.hIcon = 0; 601 wc.hIconSm = 0; 602 wc.lpszMenuName = 0; 603 604 if ( !RegisterClassEx ( &wc ) ) 605 return NULL; 606 607 hwnd = CreateWindowEx ( 608 0, /* dwStyleEx */ 609 className, /* class name */ 610 title, /* window title */ 611 612 WS_OVERLAPPEDWINDOW, /* dwStyle */ 613 614 1, /* x */ 615 1, /* y */ 616 560, /* width */ 617 350, /* height */ 618 NULL, /* hwndParent */ 619 NULL, /* hMenu */ 620 hInst, 621 0 622 ); 623 624 if (!hwnd) return NULL; 625 626 ShowWindow (hwnd, SW_SHOW); 627 UpdateWindow (hwnd); 628 629 return hwnd; 630 } 631 632 int 633 WINAPI 634 WinMain ( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdParam, int cmdShow ) 635 { 636 char className [] = "Edit Control Test"; 637 MSG msg; 638 639 RegisterAndCreateWindow ( hInst, className, "Edit Control Styles Test" ); 640 641 // Message loop 642 while (GetMessage (&msg, NULL, 0, 0)) 643 { 644 TranslateMessage (&msg); 645 DispatchMessage (&msg); 646 } 647 return msg.wParam; 648 649 } 650