Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to open notepad.exe

How to open notepad.exe

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
11 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H hanno25

    Hi! Does somebody know, how to to open notepad.exe? In the opened notepad's page, the user should be able to write, save and close the file. Would be great, if somebody could help me with this problem.:)

    C Offline
    C Offline
    Cedric Moonen
    wrote on last edited by
    #2

    Take a look at ShellExecute[^]

    H 1 Reply Last reply
    0
    • C Cedric Moonen

      Take a look at ShellExecute[^]

      H Offline
      H Offline
      hanno25
      wrote on last edited by
      #3

      Hi! Thanks, that was a big help. Maybe you can tell me, too, how to insert text of a CString-object in the already opened notepad-File? Or do I have to do this at the same time and if yes: how? With best regards,:-D Hanno

      C T 2 Replies Last reply
      0
      • H hanno25

        Hi! Thanks, that was a big help. Maybe you can tell me, too, how to insert text of a CString-object in the already opened notepad-File? Or do I have to do this at the same time and if yes: how? With best regards,:-D Hanno

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #4

        I don't know if this is possible. However, what you could to is first, save your text into a text file, then open this file in notepad with ShellExecute. But, why exactly do you want to have such a thing ? Maybe there is another solution that is better.

        H 1 Reply Last reply
        0
        • H hanno25

          Hi! Thanks, that was a big help. Maybe you can tell me, too, how to insert text of a CString-object in the already opened notepad-File? Or do I have to do this at the same time and if yes: how? With best regards,:-D Hanno

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #5

          you cannot directly interract with the notepad content. however,you could write your string (CString object content) into a file that you pass to notepad as a command line parameter so that it is opened when notepad is launched.

          ::ShellExecute(this, "open", "notepad.exe", "myfile", NULL, SW_SHOW);


          TOXCCT >>> GEII power
          [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]

          1 Reply Last reply
          0
          • C Cedric Moonen

            I don't know if this is possible. However, what you could to is first, save your text into a text file, then open this file in notepad with ShellExecute. But, why exactly do you want to have such a thing ? Maybe there is another solution that is better.

            H Offline
            H Offline
            hanno25
            wrote on last edited by
            #6

            I want to have such a thing, because there are points to display on a window. There is a function, responsible for displaying the points. Of course, the function needs coordinates. First of all, this function gets the point names from the calling program. THen, the function is looking for fitting coordinates, which should be in a already existing text-file. But it can happen, that the coordinate-file will be empty. Then, the function has to open a notepad-file, where the point-names should be already inserted. The user has to write down the missing coordinates for the point-names. That's the way. Maybe you have a better idea to do this? Hanno

            C 1 Reply Last reply
            0
            • H hanno25

              I want to have such a thing, because there are points to display on a window. There is a function, responsible for displaying the points. Of course, the function needs coordinates. First of all, this function gets the point names from the calling program. THen, the function is looking for fitting coordinates, which should be in a already existing text-file. But it can happen, that the coordinate-file will be empty. Then, the function has to open a notepad-file, where the point-names should be already inserted. The user has to write down the missing coordinates for the point-names. That's the way. Maybe you have a better idea to do this? Hanno

              C Offline
              C Offline
              Cedric Moonen
              wrote on last edited by
              #7

              Err...:~ Honnestly, I don't think notepad is the right tool for doing that. Why don't you simply ask for this data in a program of your own (either a separate or even in your existing application) ? Then save the data in a file and its done. Why do you want to use notepad for that ?

              D 1 Reply Last reply
              0
              • C Cedric Moonen

                Err...:~ Honnestly, I don't think notepad is the right tool for doing that. Why don't you simply ask for this data in a program of your own (either a separate or even in your existing application) ? Then save the data in a file and its done. Why do you want to use notepad for that ?

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #8

                Cedric Moonen wrote:

                Honnestly, I don't think notepad is the right tool for doing that.

                I concur. It's the old square-peg-in-a-round-hole paradigm.


                "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

                H 1 Reply Last reply
                0
                • D David Crow

                  Cedric Moonen wrote:

                  Honnestly, I don't think notepad is the right tool for doing that.

                  I concur. It's the old square-peg-in-a-round-hole paradigm.


                  "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

                  H Offline
                  H Offline
                  hanno25
                  wrote on last edited by
                  #9

                  But it works that way. It is not my idea to do it this way, maybe that makes you a little bit happier? Best regards, Hanno

                  C 1 Reply Last reply
                  0
                  • H hanno25

                    But it works that way. It is not my idea to do it this way, maybe that makes you a little bit happier? Best regards, Hanno

                    C Offline
                    C Offline
                    Cedric Moonen
                    wrote on last edited by
                    #10

                    hanno25 wrote:

                    It is not my idea to do it this way

                    Let me guess: it's your boss's idea :-D

                    1 Reply Last reply
                    0
                    • H hanno25

                      Hi! Does somebody know, how to to open notepad.exe? In the opened notepad's page, the user should be able to write, save and close the file. Would be great, if somebody could help me with this problem.:)

                      B Offline
                      B Offline
                      bolivar123
                      wrote on last edited by
                      #11

                      Another idea that comes to mind would be to use the Windows clipboard. What you could do in your program is launch notepad.exe. Your app could place the text content on the clipboard and then send messages to the notepad window to paste the text into it's edit window. For more info on how to use the Windows clipboard, look up the SetClipboardData function on MSDN and/or take a look at this CodeProject article[^] It doesn't really make sense as to why you can't just write your data straight out to a text file from within your program.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups