Skip to content

How to open .txt file with out using system.diagnostics.process

vardhan reddy

Asked Jul 19, 2009, 10:42 PM EDT1 answer
Share
LinkedInX
hi,
  i want to open a text file(notepad) with using process command .
                   thank you.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    I don't think it makes sense to avoid Process, but:
    [System.Runtime.InteropServices.DllImport("shell32.dll")]
    private static extern long ShellExecute(Int32 hWnd, string lpOperation,
    string lpFile, string lpParameters, string lpDirectory, long nShowCmd);

    private enum SW
    {
    SW_HIDE = 0,
    SW_SHOWNORMAL = 1
    }
    private void OpenNotepad()
    {
    ShellExecute(0, "open", "notepad.exe", null, null, (long)SW.SW_SHOWNORMAL);
    }
    0