40 if (szFileName && szFileName[0])
100 if (!pFindReplace || !pszText)
104 pchPosition = &pszText[dwPosition];
116 if (
_istalnum(*(pchPosition - 1)) || *(pchPosition - 1) ==
_T(
'_'))
119 if ((
INT)dwPosition + iTargetLength < iTextLength)
121 if (
_istalnum(pchPosition[iTargetLength]) || pchPosition[iTargetLength] ==
_T(
'_'))
134 int iTextLength, iTargetLength;
135 size_t iAdjustment = 0;
137 DWORD dwPosition, dwBegin, dwEnd;
139 TCHAR szResource[128], szText[128];
156 if (bReplace && ((dwEnd - dwBegin) == (
DWORD) iTargetLength))
169 while(dwPosition < (
DWORD) iTextLength)
180 dwPosition = dwBegin;
181 while(dwPosition > 0)
193 if (dwPosition > dwBegin)
194 dwPosition += (
DWORD) iAdjustment;
273 DWORD dwStart, dwEnd;
418 HDROP hDrop = (HDROP)
wParam;
507 static const TCHAR txt[] =
_T(
".txt");
561 static const TCHAR className[] =
_T(
"Notepad");
562 static const TCHAR winName[] =
_T(
"Notepad");
582 wndclass.
cbSize =
sizeof(wndclass);
650 return (
int)
msg.wParam;
static BOOL file_exists(const WCHAR *file_name)
BOOL DIALOG_FileSaveAs(VOID)
VOID DoShowHideStatusBar(VOID)
VOID DIALOG_StatusBarAlignParts(VOID)
VOID DIALOG_Replace(VOID)
VOID DIALOG_HelpContents(VOID)
VOID DIALOG_StatusBarUpdateCaretPos(VOID)
VOID DIALOG_EditSelectAll(VOID)
VOID DIALOG_FileNew(VOID)
BOOL HasFileExtension(LPCTSTR szFilename)
VOID WaitCursor(BOOL bBegin)
VOID DIALOG_FileExit(VOID)
VOID DIALOG_FileNewWindow(VOID)
VOID DIALOG_EditUndo(VOID)
VOID DIALOG_ViewStatusBar(VOID)
VOID DIALOG_EditTimeDate(VOID)
VOID DIALOG_FileOpen(VOID)
VOID DoCreateEditWindow(VOID)
static const TCHAR txt_files[]
VOID DIALOG_SelectFont(VOID)
BOOL DIALOG_FileSave(VOID)
VOID DIALOG_HelpAboutNotepad(VOID)
VOID DIALOG_EditCut(VOID)
VOID DIALOG_EditWrap(VOID)
VOID DIALOG_SearchNext(BOOL bDown)
BOOL FileExists(LPCTSTR szFilename)
VOID DIALOG_EditPaste(VOID)
VOID DIALOG_EditCopy(VOID)
int DIALOG_StringMsgBox(HWND hParent, int formatId, LPCTSTR szString, DWORD dwFlags)
VOID DIALOG_EditDelete(VOID)
VOID DIALOG_FilePrint(VOID)
VOID DIALOG_FilePageSetup(VOID)
static BOOL NOTEPAD_FindTextAt(FINDREPLACE *pFindReplace, LPCTSTR pszText, INT iTextLength, DWORD dwPosition)
static BOOL HandleCommandLine(LPTSTR cmdline)
static VOID NOTEPAD_ReplaceAll(FINDREPLACE *pFindReplace)
static int NOTEPAD_MenuCommand(WPARAM wParam)
VOID NOTEPAD_EnableSearchMenu()
VOID SetFileName(LPCTSTR szFileName)
LRESULT CALLBACK EDIT_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static int AlertFileDoesNotExist(LPCTSTR szFileName)
static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static VOID NOTEPAD_InitData(HINSTANCE hInstance)
static VOID NOTEPAD_FindTerm(VOID)
BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert)
static ATOM aFINDMSGSTRING
static VOID NOTEPAD_InitMenuPopup(HMENU menu, LPARAM index)
static VOID DoOpenFile(PINFO pInfo)
#define HeapFree(x, y, z)
LANGID WINAPI GetUserDefaultUILanguage(void)
void WINAPI DragFinish(HDROP h)
void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLenum GLuint GLenum GLsizei const GLchar * buf
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
void UpdateWindowCaption(HWND hwnd)
void NOTEPAD_SaveSettingsToRegistry(void)
void NOTEPAD_LoadSettingsFromRegistry(PWINDOWPLACEMENT pWP)
#define STRING_DOESNOTEXIST
#define STRING_CANNOTFIND
#define CMD_HELP_CONTENTS
#define CMD_HELP_ABOUT_NOTEPAD
#define STRING_TEXT_FILES_TXT
#define UNREFERENCED_PARAMETER(P)
#define WS_OVERLAPPEDWINDOW
void WINAPI SHAddToRecentDocs(UINT uFlags, LPCVOID pv)
TCHAR szFileName[MAX_PATH]
TCHAR szFileTitle[MAX_PATH]
TW_UINT32 TW_UINT16 TW_UINT16 MSG
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define GetWindowTextLength
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define RegisterWindowMessage
#define WM_QUERYENDSESSION
BOOL WINAPI UpdateWindow(_In_ HWND)
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define MB_ICONEXCLAMATION
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
BOOL WINAPI DestroyAcceleratorTable(_In_ HACCEL)
#define TranslateAccelerator
BOOL WINAPI SetWindowPlacement(_In_ HWND hWnd, _In_ const WINDOWPLACEMENT *)
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HMENU WINAPI GetMenu(_In_ HWND)