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. Windows API
  4. startprocess

startprocess

Scheduled Pinned Locked Moved Windows API
help
19 Posts 3 Posters 35 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.
  • E eftekharpour

    in C# programming in windows mobile 6.5 i have an adress.that is

    string path = "@\\Windows\\Geols\\GeolsCE.exe";

    when i want start GeolsCE.exe i write :

    public void StartProject()
    {
    try
    {
    //todo start geols
    if (!string.IsNullOrEmpty(path))
    {
    ProcessStartInfo geols = new ProcessStartInfo(path, "");
    System.Diagnostics.Process.Start(geols);
    }
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message);
    }
    }

    but in line

    System.Diagnostics.Process.Start(geols);

    this goes catch and receive "Win32Exception" what is problem??this is force :(

    L Offline
    L Offline
    Luc Pattyn
    wrote on last edited by
    #10

    1. don't just show

    ex.Message

    The message is just a minor part of all the information in an Exception; you should display all of it, using

    ex.ToString()

    eftekharpour wrote:

    string path = "@\\Windows\\Geols\\GeolsCE.exe";

    That doesn't look good. On regular Windows it would be somethink akin to either one of these:

    string path1 = "C:\\Program Files\\Windows NT\\Accessories\\Wordpad.exe";
    string path2 = @"C:\Program Files\Windows NT\Accessories\Wordpad.exe";

    so the @ goes outside the double quotes and avoids escaping (=doubling up) the backslashes. FWIW: I have no idea where things get stored on Windows Mobile, so you may have to adapt the path somewhat. :)

    Luc Pattyn [My Articles] Nil Volentibus Arduum

    E 1 Reply Last reply
    0
    • L Luc Pattyn

      1. don't just show

      ex.Message

      The message is just a minor part of all the information in an Exception; you should display all of it, using

      ex.ToString()

      eftekharpour wrote:

      string path = "@\\Windows\\Geols\\GeolsCE.exe";

      That doesn't look good. On regular Windows it would be somethink akin to either one of these:

      string path1 = "C:\\Program Files\\Windows NT\\Accessories\\Wordpad.exe";
      string path2 = @"C:\Program Files\Windows NT\Accessories\Wordpad.exe";

      so the @ goes outside the double quotes and avoids escaping (=doubling up) the backslashes. FWIW: I have no idea where things get stored on Windows Mobile, so you may have to adapt the path somewhat. :)

      Luc Pattyn [My Articles] Nil Volentibus Arduum

      E Offline
      E Offline
      eftekharpour
      wrote on last edited by
      #11

      thanks lucy.but my problem is kill process in windows mobile.i have method that kill process but sometime occurd win32Exception myMethod:

      public void EndProject()
      {
      try
      {
      //todo kill geols project
      Process process1 = Process.GetProcessById(GetProcessID());
      process1.Kill();
      process1.Dispose();
      }
      catch (Exception ex)
      {
      MessageBox.Show(ex.ToString());
      }
      }

      i found a link see it pls.http://stackoverflow.com/questions/9501771/how-to-avoid-a-win32-exception-when-accessing-process-mainmodule-filename-in-c[^]

      L 1 Reply Last reply
      0
      • E eftekharpour

        thanks lucy.but my problem is kill process in windows mobile.i have method that kill process but sometime occurd win32Exception myMethod:

        public void EndProject()
        {
        try
        {
        //todo kill geols project
        Process process1 = Process.GetProcessById(GetProcessID());
        process1.Kill();
        process1.Dispose();
        }
        catch (Exception ex)
        {
        MessageBox.Show(ex.ToString());
        }
        }

        i found a link see it pls.http://stackoverflow.com/questions/9501771/how-to-avoid-a-win32-exception-when-accessing-process-mainmodule-filename-in-c[^]

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #12

        eftekharpour wrote:

        kill process

        So all of a sudden what you want is killing, not starting a process? then why does the subject line say "startprocess"???

        eftekharpour wrote:

        GetProcessID()

        That does not even compile, the method needs an argument. I suggest you come back with a clear and precise question and/or code snippet if you want effective help. FYI: for some processes you won't be able to get any information. Whatever Task Manager is doing for you, most of it requires special privileges a typical app won't have. :|

        Luc Pattyn [My Articles] Nil Volentibus Arduum

        1 Reply Last reply
        0
        • E eftekharpour

          hello no i am not set path becouse we haven't ManagementObjectSearcherin windows mobile,this is force.pls help meeee..

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #13

          eftekharpour wrote:

          pls help meeee..

          With what? You still have not answered any of the questions asked of you, nor have you given a clear explanation of what your problem is. If a specific API call is not available in Windows Mobile, then that is probably because it would serve no purpose.

          speaking as ...

          E 1 Reply Last reply
          0
          • L Lost User

            eftekharpour wrote:

            pls help meeee..

            With what? You still have not answered any of the questions asked of you, nor have you given a clear explanation of what your problem is. If a specific API call is not available in Windows Mobile, then that is probably because it would serve no purpose.

            speaking as ...

            E Offline
            E Offline
            eftekharpour
            wrote on last edited by
            #14

            my problem is kill a process in windows mobile.i have method that kill process but sometime occurd win32Exception,i have method for get processes and processID and start process but when i kill process it say win32Exception.do u want that send my sourcecode for u? myMethod:

            public void EndProject()
            {
            try
            {
            //todo kill geols project
            Process process1 = Process.GetProcessById(GetProcessID());
            process1.Kill();
            process1.Dispose();
            }
            catch (Exception ex)
            {
            MessageBox.Show(ex.ToString());
            }
            }

            i found a link see it pls http://stackoverflow.com/questions/9501771/how-to-avoid-a-win32-exception-when-accessing-process-mainmodule-filename-in-c[^][^]

            L 1 Reply Last reply
            0
            • E eftekharpour

              my problem is kill a process in windows mobile.i have method that kill process but sometime occurd win32Exception,i have method for get processes and processID and start process but when i kill process it say win32Exception.do u want that send my sourcecode for u? myMethod:

              public void EndProject()
              {
              try
              {
              //todo kill geols project
              Process process1 = Process.GetProcessById(GetProcessID());
              process1.Kill();
              process1.Dispose();
              }
              catch (Exception ex)
              {
              MessageBox.Show(ex.ToString());
              }
              }

              i found a link see it pls http://stackoverflow.com/questions/9501771/how-to-avoid-a-win32-exception-when-accessing-process-mainmodule-filename-in-c[^][^]

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #15

              eftekharpour wrote:

              but sometime occurd win32Exception

              And once again I have to ask: "what is the exception detail"? You seem to think that people can guess what is happening on your system without any information, but I'm afraid they cannot. Unless you provide full information about what you are trying to do and the full details of what happens, then it's unlikely that anyone will be able to offer a suggestion.

              speaking as ...

              E 1 Reply Last reply
              0
              • L Lost User

                eftekharpour wrote:

                but sometime occurd win32Exception

                And once again I have to ask: "what is the exception detail"? You seem to think that people can guess what is happening on your system without any information, but I'm afraid they cannot. Unless you provide full information about what you are trying to do and the full details of what happens, then it's unlikely that anyone will be able to offer a suggestion.

                speaking as ...

                E Offline
                E Offline
                eftekharpour
                wrote on last edited by
                #16

                System.ComponentModel.Win32Exception at System.Diagnotics.Process.Kill() at Process.frmMain.EndProject() at Process.frmMain.tmrstartstop_Tick(Object Sender,EvenArgs e) at System.Windows.FormsTimer._WnProc(WM wm,Int32wParam,Int32 lParam) at System.Windows.Forms.ApplicationThreadContextMessage(WM wm,Int32 wParam,Int32 lparam)

                L 1 Reply Last reply
                0
                • E eftekharpour

                  System.ComponentModel.Win32Exception at System.Diagnotics.Process.Kill() at Process.frmMain.EndProject() at Process.frmMain.tmrstartstop_Tick(Object Sender,EvenArgs e) at System.Windows.FormsTimer._WnProc(WM wm,Int32wParam,Int32 lParam) at System.Windows.Forms.ApplicationThreadContextMessage(WM wm,Int32 wParam,Int32 lparam)

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #17

                  Try the manual, as I suggested. There's a reason why it's passing a NativeErrorCode. As stated; "Win32 error codes are translated from their numeric representations into a system message when they are displayed. Use NativeErrorCode to access the numeric representation of the error code associated with this exception. For more information about the error codes, see "Win32 Error Codes" in the Platform SDK documentation"

                  Bastard Programmer from Hell :suss:

                  E 1 Reply Last reply
                  0
                  • L Lost User

                    Try the manual, as I suggested. There's a reason why it's passing a NativeErrorCode. As stated; "Win32 error codes are translated from their numeric representations into a system message when they are displayed. Use NativeErrorCode to access the numeric representation of the error code associated with this exception. For more information about the error codes, see "Win32 Error Codes" in the Platform SDK documentation"

                    Bastard Programmer from Hell :suss:

                    E Offline
                    E Offline
                    eftekharpour
                    wrote on last edited by
                    #18

                    i don't know please explain clear..:( :(

                    L 1 Reply Last reply
                    0
                    • E eftekharpour

                      i don't know please explain clear..:( :(

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #19

                      eftekharpour wrote:

                      i don't know please explain clear..:( :(

                      Go to this[^] page. That's the manual. Next, find the link that says "Win32Exception". You can find it on that page, without scrolling. Click on that link, and you'll get a page that explains the exception, and what might cause it. It's a generic exception, and if the message doesn't tell you what went wrong, then you'd need to fetch the NativeErrorCode[^] to see what caused the exception.

                      Bastard Programmer from Hell :suss:

                      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