--- a\np2src\src\Helpers.c Mon Jun 22 20:03:44 2009 +++ b\np2src\src\Helpers.c Mon Jun 22 20:05:28 2009 @@ -1393,8 +1393,12 @@ BOOL MRU_AddFile(LPMRULIST pmru,LPCWSTR pmru->pszItems[0] = StrDup(wchFile); } else pmru->pszItems[0] = StrDup(pszFile); + + // Needed to make W7 jump lists work when NP2 is not explicitly associated + if (IsW7()) SHAddToRecentDocs(SHARD_PATHW, pszFile); + return(1); } BOOL MRU_Delete(LPMRULIST pmru,int iIndex) { --- a\np2src\src\Notepad2.c Mon Jun 22 20:03:44 2009 +++ b\np2src\src\Notepad2.c Mon Jun 22 20:11:39 2009 @@ -330,8 +330,20 @@ int WINAPI WinMain(HINSTANCE hInstance,H LocalFree(lpMsgBuf); return(0); } + // Needed to make W7 jump lists work when NP2 is not explicitly associated + // Notepad2 should be registered under HKCR\*\OpenWithList + if (IsW7()) { + typedef HRESULT (WINAPI *PFNSCPEAUMID)( PCWSTR AppID ); + + PFNSCPEAUMID pfnSetCurrentProcessExplicitAppUserModelID = (PFNSCPEAUMID) + GetProcAddress(GetModuleHandleA("SHELL32.dll"), "SetCurrentProcessExplicitAppUserModelID"); + + if (pfnSetCurrentProcessExplicitAppUserModelID) + pfnSetCurrentProcessExplicitAppUserModelID(L"Notepad2"); + } + // Command Line, Ini File and Flags ParseCommandLine(); FindIniFile(); TestIniFile(); @@ -4975,8 +4987,9 @@ void ParseCommandLine() { LPWSTR lp1,lp2,lp3; BOOL bContinue = TRUE; + BOOL bIsReplacement = FALSE; LPWSTR lpCmdLine = GetCommandLine(); if (lstrlen(lpCmdLine) == 0) @@ -5064,8 +5077,16 @@ void ParseCommandLine() flagStartAsTrayIcon = 1; break; case L'P': + + // Notepad uses the /p switch to print, and many file types have + // a "print" shell verb associated with them that will launch Notepad + // with the /p switch, so if the /z replacement switch was used, + // the /p switch should not be treated as positioning; in the future, + // perhaps instead of ignoring the /p switch, it could actually print + if (bIsReplacement) break; + if (*(lp1+1) == L'0' || *CharUpper(lp1+1) == L'O') { flagPosParam = 1; flagDefaultPos = 1; } @@ -5216,8 +5237,13 @@ void ParseCommandLine() } iInitialLexer = 2; flagLexerSpecified = 1; break; + + case L'Z': + ExtractFirstArgument(lp2,lp1,lp2); + bIsReplacement = TRUE; + break; case L'?': flagDisplayHelp = 1; break;