Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

  1. #include <windows.h>
  2. #include <shellapi.h>
  3. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  4. {
  5. STARTUPINFOA si;
  6. LPSTR pszCmdLine = GetCommandLineA();
  7. if ( *pszCmdLine == '\"' ) {
  8. /*
  9. * Scan, and skip over, subsequent characters until
  10. * another double-quote or a null is encountered.
  11. */
  12. while ( *++pszCmdLine && (*pszCmdLine
  13. != '\"') );
  14. /*
  15. * If we stopped on a double-quote (usual case), skip
  16. * over it.
  17. */
  18. if ( *pszCmdLine == '\"' )
  19. pszCmdLine++;
  20. }
  21. else {
  22. while (*pszCmdLine > ' ')
  23. pszCmdLine++;
  24. }
  25. /*
  26. * Skip past any white space preceeding the second token.
  27. */
  28. while (*pszCmdLine && (*pszCmdLine <= ' ')) {
  29. pszCmdLine++;
  30. }
  31. si.dwFlags = 0;
  32. GetStartupInfoA(&si);
  33. ShellExecuteA(HWND_DESKTOP, NULL, "wordpad.exe", lpCmdLine, NULL,
  34. si.dwFlags & STARTF_USESHOWWINDOW ? si.wShowWindow : SW_SHOWDEFAULT);
  35. return 0 ;
  36. }
  37.