Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenmain.c
Go to the documentation of this file.
00001 /* 00002 * Notepad 00003 * 00004 * Copyright 2000 Mike McCormack <Mike_McCormack@looksmart.com.au> 00005 * Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch> 00006 * Copyright 2002 Sylvain Petreolle <spetreolle@yahoo.fr> 00007 * Copyright 2002 Andriy Palamarchuk 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00022 * 00023 */ 00024 00025 #include <notepad.h> 00026 00027 NOTEPAD_GLOBALS Globals; 00028 static ATOM aFINDMSGSTRING; 00029 00030 VOID NOTEPAD_EnableSearchMenu() 00031 { 00032 EnableMenuItem(Globals.hMenu, CMD_SEARCH, 00033 MF_BYCOMMAND | ((GetWindowTextLength(Globals.hEdit) == 0) ? MF_DISABLED | MF_GRAYED : MF_ENABLED)); 00034 EnableMenuItem(Globals.hMenu, CMD_SEARCH_NEXT, 00035 MF_BYCOMMAND | ((GetWindowTextLength(Globals.hEdit) == 0) ? MF_DISABLED | MF_GRAYED : MF_ENABLED)); 00036 } 00037 00038 /*********************************************************************** 00039 * 00040 * SetFileName 00041 * 00042 * Sets Global File Name. 00043 */ 00044 VOID SetFileName(LPCTSTR szFileName) 00045 { 00046 _tcscpy(Globals.szFileName, szFileName); 00047 Globals.szFileTitle[0] = 0; 00048 GetFileTitle(szFileName, Globals.szFileTitle, SIZEOF(Globals.szFileTitle)); 00049 } 00050 00051 /*********************************************************************** 00052 * 00053 * NOTEPAD_MenuCommand 00054 * 00055 * All handling of main menu events 00056 */ 00057 static int NOTEPAD_MenuCommand(WPARAM wParam) 00058 { 00059 switch (wParam) 00060 { 00061 case CMD_NEW: DIALOG_FileNew(); break; 00062 case CMD_OPEN: DIALOG_FileOpen(); break; 00063 case CMD_SAVE: DIALOG_FileSave(); break; 00064 case CMD_SAVE_AS: DIALOG_FileSaveAs(); break; 00065 case CMD_PRINT: DIALOG_FilePrint(); break; 00066 case CMD_PAGE_SETUP: DIALOG_FilePageSetup(); break; 00067 case CMD_PRINTER_SETUP: DIALOG_FilePrinterSetup();break; 00068 case CMD_EXIT: DIALOG_FileExit(); break; 00069 00070 case CMD_UNDO: DIALOG_EditUndo(); break; 00071 case CMD_CUT: DIALOG_EditCut(); break; 00072 case CMD_COPY: DIALOG_EditCopy(); break; 00073 case CMD_PASTE: DIALOG_EditPaste(); break; 00074 case CMD_DELETE: DIALOG_EditDelete(); break; 00075 case CMD_SELECT_ALL: DIALOG_EditSelectAll(); break; 00076 case CMD_TIME_DATE: DIALOG_EditTimeDate();break; 00077 00078 case CMD_SEARCH: DIALOG_Search(); break; 00079 case CMD_SEARCH_NEXT: DIALOG_SearchNext(); break; 00080 case CMD_REPLACE: DIALOG_Replace(); break; 00081 case CMD_GOTO: DIALOG_GoTo(); break; 00082 00083 case CMD_WRAP: DIALOG_EditWrap(); break; 00084 case CMD_FONT: DIALOG_SelectFont(); break; 00085 00086 case CMD_STATUSBAR: DIALOG_ViewStatusBar(); break; 00087 00088 case CMD_HELP_CONTENTS: DIALOG_HelpContents(); break; 00089 case CMD_HELP_SEARCH: DIALOG_HelpSearch(); break; 00090 case CMD_HELP_ON_HELP: DIALOG_HelpHelp(); break; 00091 case CMD_ABOUT: DialogBox(GetModuleHandle(NULL), 00092 MAKEINTRESOURCE(IDD_ABOUTBOX), 00093 Globals.hMainWnd, 00094 AboutDialogProc); 00095 break; 00096 case CMD_ABOUT_WINE: DIALOG_HelpAboutWine(); break; 00097 00098 default: 00099 break; 00100 } 00101 return 0; 00102 } 00103 00104 /*********************************************************************** 00105 * 00106 * NOTEPAD_FindTextAt 00107 */ 00108 00109 static BOOL NOTEPAD_FindTextAt(FINDREPLACE *pFindReplace, LPCTSTR pszText, int iTextLength, DWORD dwPosition) 00110 { 00111 BOOL bMatches; 00112 size_t iTargetLength; 00113 00114 iTargetLength = _tcslen(pFindReplace->lpstrFindWhat); 00115 00116 /* Make proper comparison */ 00117 if (pFindReplace->Flags & FR_MATCHCASE) 00118 bMatches = !_tcsncmp(&pszText[dwPosition], pFindReplace->lpstrFindWhat, iTargetLength); 00119 else 00120 bMatches = !_tcsnicmp(&pszText[dwPosition], pFindReplace->lpstrFindWhat, iTargetLength); 00121 00122 if (bMatches && pFindReplace->Flags & FR_WHOLEWORD) 00123 { 00124 if ((dwPosition > 0) && !_istspace(pszText[dwPosition-1])) 00125 bMatches = FALSE; 00126 if ((dwPosition < (DWORD) iTextLength - 1) && !_istspace(pszText[dwPosition+1])) 00127 bMatches = FALSE; 00128 } 00129 00130 return bMatches; 00131 } 00132 00133 /*********************************************************************** 00134 * 00135 * NOTEPAD_FindNext 00136 */ 00137 00138 BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert) 00139 { 00140 int iTextLength, iTargetLength; 00141 size_t iAdjustment = 0; 00142 LPTSTR pszText = NULL; 00143 DWORD dwPosition, dwBegin, dwEnd; 00144 BOOL bMatches = FALSE; 00145 TCHAR szResource[128], szText[128]; 00146 BOOL bSuccess; 00147 00148 iTargetLength = (int) _tcslen(pFindReplace->lpstrFindWhat); 00149 00150 /* Retrieve the window text */ 00151 iTextLength = GetWindowTextLength(Globals.hEdit); 00152 if (iTextLength > 0) 00153 { 00154 pszText = (LPTSTR) HeapAlloc(GetProcessHeap(), 0, (iTextLength + 1) * sizeof(TCHAR)); 00155 if (!pszText) 00156 return FALSE; 00157 00158 GetWindowText(Globals.hEdit, pszText, iTextLength + 1); 00159 } 00160 00161 SendMessage(Globals.hEdit, EM_GETSEL, (WPARAM) &dwBegin, (LPARAM) &dwEnd); 00162 if (bReplace && ((dwEnd - dwBegin) == (DWORD) iTargetLength)) 00163 { 00164 if (NOTEPAD_FindTextAt(pFindReplace, pszText, iTextLength, dwBegin)) 00165 { 00166 SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM) pFindReplace->lpstrReplaceWith); 00167 iAdjustment = _tcslen(pFindReplace->lpstrReplaceWith) - (dwEnd - dwBegin); 00168 } 00169 } 00170 00171 if (pFindReplace->Flags & FR_DOWN) 00172 { 00173 /* Find Down */ 00174 dwPosition = dwEnd; 00175 while(dwPosition < (DWORD) iTextLength) 00176 { 00177 bMatches = NOTEPAD_FindTextAt(pFindReplace, pszText, iTextLength, dwPosition); 00178 if (bMatches) 00179 break; 00180 dwPosition++; 00181 } 00182 } 00183 else 00184 { 00185 /* Find Up */ 00186 dwPosition = dwBegin; 00187 while(dwPosition > 0) 00188 { 00189 dwPosition--; 00190 bMatches = NOTEPAD_FindTextAt(pFindReplace, pszText, iTextLength, dwPosition); 00191 if (bMatches) 00192 break; 00193 } 00194 } 00195 00196 if (bMatches) 00197 { 00198 /* Found target */ 00199 if (dwPosition > dwBegin) 00200 dwPosition += (DWORD) iAdjustment; 00201 SendMessage(Globals.hEdit, EM_SETSEL, dwPosition, dwPosition + iTargetLength); 00202 SendMessage(Globals.hEdit, EM_SCROLLCARET, 0, 0); 00203 bSuccess = TRUE; 00204 } 00205 else 00206 { 00207 /* Can't find target */ 00208 if (bShowAlert) 00209 { 00210 LoadString(Globals.hInstance, STRING_CANNOTFIND, szResource, SIZEOF(szResource)); 00211 _sntprintf(szText, SIZEOF(szText), szResource, pFindReplace->lpstrFindWhat); 00212 LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, SIZEOF(szResource)); 00213 MessageBox(Globals.hFindReplaceDlg, szText, szResource, MB_OK); 00214 } 00215 bSuccess = FALSE; 00216 } 00217 00218 if (pszText) 00219 HeapFree(GetProcessHeap(), 0, pszText); 00220 return bSuccess; 00221 } 00222 00223 /*********************************************************************** 00224 * 00225 * NOTEPAD_ReplaceAll 00226 */ 00227 00228 static VOID NOTEPAD_ReplaceAll(FINDREPLACE *pFindReplace) 00229 { 00230 BOOL bShowAlert = TRUE; 00231 00232 SendMessage(Globals.hEdit, EM_SETSEL, 0, 0); 00233 00234 while (NOTEPAD_FindNext(pFindReplace, TRUE, bShowAlert)) 00235 { 00236 bShowAlert = FALSE; 00237 } 00238 } 00239 00240 /*********************************************************************** 00241 * 00242 * NOTEPAD_FindTerm 00243 */ 00244 00245 static VOID NOTEPAD_FindTerm(VOID) 00246 { 00247 Globals.hFindReplaceDlg = NULL; 00248 } 00249 00250 /*********************************************************************** 00251 * Data Initialization 00252 */ 00253 static VOID NOTEPAD_InitData(VOID) 00254 { 00255 LPTSTR p = Globals.szFilter; 00256 static const TCHAR txt_files[] = _T("*.txt"); 00257 static const TCHAR all_files[] = _T("*.*"); 00258 00259 p += LoadString(Globals.hInstance, STRING_TEXT_FILES_TXT, p, MAX_STRING_LEN)+1; 00260 _tcscpy(p, txt_files); 00261 p += SIZEOF(txt_files); 00262 00263 p += LoadString(Globals.hInstance, STRING_ALL_FILES, p, MAX_STRING_LEN)+1; 00264 _tcscpy(p, all_files); 00265 p += SIZEOF(all_files); 00266 *p = '\0'; 00267 Globals.find.lpstrFindWhat = NULL; 00268 } 00269 00270 /*********************************************************************** 00271 * Enable/disable items on the menu based on control state 00272 */ 00273 static VOID NOTEPAD_InitMenuPopup(HMENU menu, LPARAM index) 00274 { 00275 int enable; 00276 00277 UNREFERENCED_PARAMETER(index); 00278 00279 CheckMenuItem(GetMenu(Globals.hMainWnd), CMD_WRAP, 00280 MF_BYCOMMAND | (Globals.bWrapLongLines ? MF_CHECKED : MF_UNCHECKED)); 00281 if ( !Globals.bWrapLongLines ) 00282 { 00283 CheckMenuItem(GetMenu(Globals.hMainWnd), CMD_STATUSBAR, 00284 MF_BYCOMMAND | (Globals.bShowStatusBar ? MF_CHECKED : MF_UNCHECKED)); 00285 } 00286 EnableMenuItem(menu, CMD_UNDO, 00287 SendMessage(Globals.hEdit, EM_CANUNDO, 0, 0) ? MF_ENABLED : MF_GRAYED); 00288 EnableMenuItem(menu, CMD_PASTE, 00289 IsClipboardFormatAvailable(CF_TEXT) ? MF_ENABLED : MF_GRAYED); 00290 enable = (int) SendMessage(Globals.hEdit, EM_GETSEL, 0, 0); 00291 enable = (HIWORD(enable) == LOWORD(enable)) ? MF_GRAYED : MF_ENABLED; 00292 EnableMenuItem(menu, CMD_CUT, enable); 00293 EnableMenuItem(menu, CMD_COPY, enable); 00294 EnableMenuItem(menu, CMD_DELETE, enable); 00295 00296 EnableMenuItem(menu, CMD_SELECT_ALL, 00297 GetWindowTextLength(Globals.hEdit) ? MF_ENABLED : MF_GRAYED); 00298 DrawMenuBar(Globals.hMainWnd); 00299 } 00300 00301 LRESULT CALLBACK EDIT_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) 00302 { 00303 switch (msg) 00304 { 00305 case WM_KEYDOWN: 00306 case WM_KEYUP: 00307 { 00308 switch (wParam) 00309 { 00310 case VK_UP: 00311 case VK_DOWN: 00312 case VK_LEFT: 00313 case VK_RIGHT: 00314 DIALOG_StatusBarUpdateCaretPos(); 00315 break; 00316 } 00317 } 00318 case WM_LBUTTONUP: 00319 { 00320 DIALOG_StatusBarUpdateCaretPos(); 00321 break; 00322 } 00323 } 00324 return CallWindowProc( (WNDPROC)Globals.EditProc, hWnd, msg, wParam, lParam); 00325 } 00326 00327 /*********************************************************************** 00328 * 00329 * NOTEPAD_WndProc 00330 */ 00331 static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam, 00332 LPARAM lParam) 00333 { 00334 switch (msg) { 00335 00336 case WM_CREATE: 00337 Globals.hMenu = GetMenu(hWnd); 00338 break; 00339 00340 case WM_COMMAND: 00341 if (HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == EN_HSCROLL || HIWORD(wParam) == EN_VSCROLL) 00342 DIALOG_StatusBarUpdateCaretPos(); 00343 if ((HIWORD(wParam) == EN_CHANGE)) 00344 NOTEPAD_EnableSearchMenu(); 00345 NOTEPAD_MenuCommand(LOWORD(wParam)); 00346 break; 00347 00348 case WM_DESTROYCLIPBOARD: 00349 /*MessageBox(Globals.hMainWnd, "Empty clipboard", "Debug", MB_ICONEXCLAMATION);*/ 00350 break; 00351 00352 case WM_CLOSE: 00353 if (DoCloseFile()) { 00354 if (Globals.hFont) 00355 DeleteObject(Globals.hFont); 00356 DestroyWindow(hWnd); 00357 } 00358 break; 00359 00360 case WM_QUERYENDSESSION: 00361 if (DoCloseFile()) { 00362 return 1; 00363 } 00364 break; 00365 00366 case WM_DESTROY: 00367 SetWindowLongPtr(Globals.hEdit, GWLP_WNDPROC, (LONG_PTR)Globals.EditProc); 00368 SaveSettings(); 00369 PostQuitMessage(0); 00370 break; 00371 00372 case WM_SIZE: 00373 { 00374 if (Globals.bShowStatusBar == TRUE && 00375 Globals.bWrapLongLines == FALSE) 00376 { 00377 RECT rcStatusBar; 00378 HDWP hdwp; 00379 00380 if (!GetWindowRect(Globals.hStatusBar, &rcStatusBar)) 00381 break; 00382 00383 hdwp = BeginDeferWindowPos(2); 00384 if (hdwp == NULL) 00385 break; 00386 00387 hdwp = DeferWindowPos(hdwp, Globals.hEdit, NULL, 0, 0, LOWORD(lParam), HIWORD(lParam) - (rcStatusBar.bottom - rcStatusBar.top), SWP_NOZORDER | SWP_NOMOVE); 00388 if (hdwp == NULL) 00389 break; 00390 00391 hdwp = DeferWindowPos(hdwp, Globals.hStatusBar, NULL, 0, 0, LOWORD(lParam), LOWORD(wParam), SWP_NOZORDER); 00392 00393 if (hdwp != NULL) 00394 EndDeferWindowPos(hdwp); 00395 } 00396 else 00397 SetWindowPos(Globals.hEdit, NULL, 0, 0, LOWORD(lParam), HIWORD(lParam), SWP_NOZORDER | SWP_NOMOVE); 00398 00399 break; 00400 } 00401 00402 // The entire client area is covered by edit control and by 00403 // the status bar. So there is no need to erase main background. 00404 // This resolves the horrible fliker effect during windows resizes. 00405 case WM_ERASEBKGND: 00406 return 1; 00407 00408 case WM_SETFOCUS: 00409 SetFocus(Globals.hEdit); 00410 break; 00411 00412 case WM_DROPFILES: 00413 { 00414 TCHAR szFileName[MAX_PATH]; 00415 HDROP hDrop = (HDROP) wParam; 00416 00417 DragQueryFile(hDrop, 0, szFileName, SIZEOF(szFileName)); 00418 DragFinish(hDrop); 00419 DoOpenFile(szFileName); 00420 break; 00421 } 00422 case WM_CHAR: 00423 case WM_INITMENUPOPUP: 00424 NOTEPAD_InitMenuPopup((HMENU)wParam, lParam); 00425 break; 00426 default: 00427 if (msg == aFINDMSGSTRING) 00428 { 00429 FINDREPLACE *pFindReplace = (FINDREPLACE *) lParam; 00430 Globals.find = *(FINDREPLACE *) lParam; 00431 00432 if (pFindReplace->Flags & FR_FINDNEXT) 00433 NOTEPAD_FindNext(pFindReplace, FALSE, TRUE); 00434 else if (pFindReplace->Flags & FR_REPLACE) 00435 NOTEPAD_FindNext(pFindReplace, TRUE, TRUE); 00436 else if (pFindReplace->Flags & FR_REPLACEALL) 00437 NOTEPAD_ReplaceAll(pFindReplace); 00438 else if (pFindReplace->Flags & FR_DIALOGTERM) 00439 NOTEPAD_FindTerm(); 00440 break; 00441 } 00442 00443 return DefWindowProc(hWnd, msg, wParam, lParam); 00444 } 00445 return 0; 00446 } 00447 00448 static int AlertFileDoesNotExist(LPCTSTR szFileName) 00449 { 00450 int nResult; 00451 TCHAR szMessage[MAX_STRING_LEN]; 00452 TCHAR szResource[MAX_STRING_LEN]; 00453 00454 LoadString(Globals.hInstance, STRING_DOESNOTEXIST, szResource, SIZEOF(szResource)); 00455 wsprintf(szMessage, szResource, szFileName); 00456 00457 LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, SIZEOF(szResource)); 00458 00459 nResult = MessageBox(Globals.hMainWnd, szMessage, szResource, 00460 MB_ICONEXCLAMATION | MB_YESNO); 00461 00462 return(nResult); 00463 } 00464 00465 static void HandleCommandLine(LPTSTR cmdline) 00466 { 00467 int opt_print=0; 00468 00469 while (*cmdline == _T(' ') || *cmdline == _T('-') || *cmdline == _T('/')) 00470 { 00471 TCHAR option; 00472 00473 if (*cmdline++ == _T(' ')) continue; 00474 00475 option = *cmdline; 00476 if (option) cmdline++; 00477 while (*cmdline == _T(' ')) cmdline++; 00478 00479 switch(option) 00480 { 00481 case 'p': 00482 case 'P': 00483 opt_print=1; 00484 break; 00485 } 00486 } 00487 00488 if (*cmdline) 00489 { 00490 /* file name is passed in the command line */ 00491 LPCTSTR file_name = NULL; 00492 BOOL file_exists = FALSE; 00493 TCHAR buf[MAX_PATH]; 00494 00495 if (cmdline[0] == _T('"')) 00496 { 00497 cmdline++; 00498 cmdline[lstrlen(cmdline) - 1] = 0; 00499 } 00500 00501 file_name = cmdline; 00502 if (FileExists(file_name)) 00503 { 00504 file_exists = TRUE; 00505 } 00506 else if (!HasFileExtension(cmdline)) 00507 { 00508 static const TCHAR txt[] = _T(".txt"); 00509 00510 /* try to find file with ".txt" extension */ 00511 if (!_tcscmp(txt, cmdline + _tcslen(cmdline) - _tcslen(txt))) 00512 { 00513 file_exists = FALSE; 00514 } 00515 else 00516 { 00517 _tcsncpy(buf, cmdline, MAX_PATH - _tcslen(txt) - 1); 00518 _tcscat(buf, txt); 00519 file_name = buf; 00520 file_exists = FileExists(file_name); 00521 } 00522 } 00523 00524 if (file_exists) 00525 { 00526 DoOpenFile(file_name); 00527 InvalidateRect(Globals.hMainWnd, NULL, FALSE); 00528 if (opt_print) 00529 DIALOG_FilePrint(); 00530 } 00531 else 00532 { 00533 switch (AlertFileDoesNotExist(file_name)) { 00534 case IDYES: 00535 DoOpenFile(file_name); 00536 break; 00537 00538 case IDNO: 00539 break; 00540 } 00541 } 00542 } 00543 } 00544 00545 /*********************************************************************** 00546 * 00547 * WinMain 00548 */ 00549 int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE prev, LPTSTR cmdline, int show) 00550 { 00551 MSG msg; 00552 HACCEL hAccel; 00553 WNDCLASSEX wndclass; 00554 HMONITOR monitor; 00555 MONITORINFO info; 00556 INT x, y; 00557 00558 static const TCHAR className[] = _T("NPClass"); 00559 static const TCHAR winName[] = _T("Notepad"); 00560 00561 UNREFERENCED_PARAMETER(prev); 00562 00563 aFINDMSGSTRING = (ATOM) RegisterWindowMessage(FINDMSGSTRING); 00564 00565 ZeroMemory(&Globals, sizeof(Globals)); 00566 Globals.hInstance = hInstance; 00567 LoadSettings(); 00568 00569 ZeroMemory(&wndclass, sizeof(wndclass)); 00570 wndclass.cbSize = sizeof(wndclass); 00571 wndclass.lpfnWndProc = NOTEPAD_WndProc; 00572 wndclass.hInstance = Globals.hInstance; 00573 wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_NPICON)); 00574 wndclass.hCursor = LoadCursor(0, IDC_ARROW); 00575 wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 00576 wndclass.lpszMenuName = MAKEINTRESOURCE(MAIN_MENU); 00577 wndclass.lpszClassName = className; 00578 wndclass.hIconSm = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_NPICON), 00579 IMAGE_ICON, 16, 16, 0); 00580 00581 if (!RegisterClassEx(&wndclass)) return FALSE; 00582 00583 /* Setup windows */ 00584 00585 monitor = MonitorFromRect( &Globals.main_rect, MONITOR_DEFAULTTOPRIMARY ); 00586 info.cbSize = sizeof(info); 00587 GetMonitorInfoW( monitor, &info ); 00588 00589 x = Globals.main_rect.left; 00590 y = Globals.main_rect.top; 00591 if (Globals.main_rect.left >= info.rcWork.right || 00592 Globals.main_rect.top >= info.rcWork.bottom || 00593 Globals.main_rect.right < info.rcWork.left || 00594 Globals.main_rect.bottom < info.rcWork.top) 00595 x = y = CW_USEDEFAULT; 00596 00597 Globals.hMainWnd = 00598 CreateWindow(className, winName, WS_OVERLAPPEDWINDOW, 00599 x, y, Globals.main_rect.right - Globals.main_rect.left, 00600 Globals.main_rect.bottom - Globals.main_rect.top, 00601 NULL, NULL, Globals.hInstance, NULL); 00602 if (!Globals.hMainWnd) 00603 { 00604 ShowLastError(); 00605 ExitProcess(1); 00606 } 00607 00608 DoCreateEditWindow(); 00609 00610 NOTEPAD_InitData(); 00611 DIALOG_FileNew(); 00612 00613 ShowWindow(Globals.hMainWnd, show); 00614 UpdateWindow(Globals.hMainWnd); 00615 DragAcceptFiles(Globals.hMainWnd, TRUE); 00616 00617 DIALOG_ViewStatusBar(); 00618 00619 HandleCommandLine(cmdline); 00620 00621 hAccel = LoadAccelerators( hInstance, MAKEINTRESOURCE(ID_ACCEL) ); 00622 00623 while (GetMessage(&msg, 0, 0, 0)) 00624 { 00625 if (!IsDialogMessage(Globals.hFindReplaceDlg, &msg) && 00626 !TranslateAccelerator(Globals.hMainWnd, hAccel, &msg)) 00627 { 00628 TranslateMessage(&msg); 00629 DispatchMessage(&msg); 00630 } 00631 } 00632 return (int) msg.wParam; 00633 } Generated on Fri May 25 2012 04:15:01 for ReactOS by
1.7.6.1
|