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 Delete Application

How to Delete Application

Scheduled Pinned Locked Moved C / C++ / MFC
comhelptutorialquestion
20 Posts 6 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.
  • T toxcct

    chandu004 wrote:

    codeguru.com

    :omg::~ X|


    [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

    N Offline
    N Offline
    NormDroid
    wrote on last edited by
    #6

    I know, strange advice being handed out by the newbie

    WPF - Imagineers Wanted Follow your nose using DoubleAnimationUsingPath

    T 1 Reply Last reply
    0
    • C chandu004

      thats why i redeirected him to the codeguru.com. i dont think it is wrong, because, all of us here are open minded, and should also encourage the other programming sites. am i right or not?

      Suggestion to the members: prefix your main thread subject with [SOLVED] if it is solved. chandu.

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

      chandu004 wrote:

      am i right or not?

      yes, but not CodeGuru !!! :laugh: moreover, when you answer like that, take the time yourself to provide the link, or don't answer at all, because it's useless (I mean, yes, the OP should have searched at first, so you don't bring something new then) BTW, your Signature is a bit too aggressive. you should consider reduce its size and/or add a separator because most of the time, it looks like it's part of the body of your answer


      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

      C 1 Reply Last reply
      0
      • N NormDroid

        I know, strange advice being handed out by the newbie

        WPF - Imagineers Wanted Follow your nose using DoubleAnimationUsingPath

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

        :laugh:


        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        1 Reply Last reply
        0
        • C chandu004

          It is available in codeguru.com, just find it out.

          Suggestion to the members: prefix your main thread subject with [SOLVED] if it is solved. chandu.

          G Offline
          G Offline
          GauranG Shah
          wrote on last edited by
          #9

          It will be better if you provide the Link also. Or some keywords to find the thing.

          [ Screen Capture ][ Tool Tip ]

          C 1 Reply Last reply
          0
          • G GauranG Shah

            It will be better if you provide the Link also. Or some keywords to find the thing.

            [ Screen Capture ][ Tool Tip ]

            C Offline
            C Offline
            chandu004
            wrote on last edited by
            #10

            self deleting an application or "an application that deletes itself."

            Suggestion to the members: prefix your main thread subject with [SOLVED] if it is solved. chandu.

            1 Reply Last reply
            0
            • C chandu004

              It is available in codeguru.com, just find it out.

              Suggestion to the members: prefix your main thread subject with [SOLVED] if it is solved. chandu.

              G Offline
              G Offline
              GauranG Shah
              wrote on last edited by
              #11

              Hey Thnx, Got the link. Coming back to you after Checking.

              [ Screen Capture ][ Tool Tip ]

              1 Reply Last reply
              0
              • T toxcct

                chandu004 wrote:

                am i right or not?

                yes, but not CodeGuru !!! :laugh: moreover, when you answer like that, take the time yourself to provide the link, or don't answer at all, because it's useless (I mean, yes, the OP should have searched at first, so you don't bring something new then) BTW, your Signature is a bit too aggressive. you should consider reduce its size and/or add a separator because most of the time, it looks like it's part of the body of your answer


                [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                C Offline
                C Offline
                chandu004
                wrote on last edited by
                #12

                toxcct wrote:

                yes, but not CodeGuru !!!

                iam sorry if it has hurt the ego of any body.

                toxcct wrote:

                take the time yourself to provide the link,

                yah you are right i would have done that. but now only i came to know that, quoting the competor site, would be inconvinient to some people.

                toxcct wrote:

                BTW, your Signature is a bit too aggressive. you should consider reduce its size and/or add a separator because most of the time, it looks like it's part of the body of your answer

                thanks for the advice, i shall do the same.

                Suggestion to the members: prefix your main thread subject with [SOLVED] if it is solved. chandu.

                1 Reply Last reply
                0
                • C chandu004

                  It is available in codeguru.com, just find it out.

                  Suggestion to the members: prefix your main thread subject with [SOLVED] if it is solved. chandu.

                  G Offline
                  G Offline
                  GauranG Shah
                  wrote on last edited by
                  #13

                  Now I am using the MoveFileEx Function to delete the File at reboot. as Follows

                  GetModuleFileName(0,FileName,MAX_PATH);
                  if ( ! MoveFileEx(FileName,NULL,MOVEFILE_DELAY_UNTIL_REBOOT ) )
                  dError = GetLastError() ;
                  PostQuitMessage(0);

                  But the Problem is that it is Not supported in Windows 95/98/Me. MSDN has provided the solution for that also. And trying to implement it

                  [ Screen Capture ][ Tool Tip ]

                  1 Reply Last reply
                  0
                  • G GauranG Shah

                    Hello Friends, Is it possible to delete the file which I am running from within the File?? Means the code for deleting the File should reside in the File Itself Which I want to delete. I know in a Simple manner it will provide Access Violation Error. please tell me if you have any Idea,

                    [ Screen Capture ][ Tool Tip ]

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

                    Use a .bat file. It will work on all version of Windows.


                    "A good athlete is the result of a good and worthy opponent." - David Crow

                    "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                    G 1 Reply Last reply
                    0
                    • D David Crow

                      Use a .bat file. It will work on all version of Windows.


                      "A good athlete is the result of a good and worthy opponent." - David Crow

                      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                      G Offline
                      G Offline
                      GauranG Shah
                      wrote on last edited by
                      #15

                      But how ??

                      [ Screen Capture ][ Tool Tip ]

                      D 1 Reply Last reply
                      0
                      • G GauranG Shah

                        But how ??

                        [ Screen Capture ][ Tool Tip ]

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

                        Notice that if you put: del %0.bat in a batch file and run it from a command prompt, it will remove itself. You can take advantage of this by creating a similar batch file from within the program you are wanting to delete:

                        :DoItAgain
                        del MyProg.exe
                        if exist MyProg.exe goto DoItAgain
                        rem del folder that MyProg.exe was in
                        del %0.bat

                        Use CreateProcess() to run the batch file. Note that I've not actually tested this so you may have to tweak it for your situation (e.g., add paths, hide console window).


                        "A good athlete is the result of a good and worthy opponent." - David Crow

                        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                        G 2 Replies Last reply
                        0
                        • D David Crow

                          Notice that if you put: del %0.bat in a batch file and run it from a command prompt, it will remove itself. You can take advantage of this by creating a similar batch file from within the program you are wanting to delete:

                          :DoItAgain
                          del MyProg.exe
                          if exist MyProg.exe goto DoItAgain
                          rem del folder that MyProg.exe was in
                          del %0.bat

                          Use CreateProcess() to run the batch file. Note that I've not actually tested this so you may have to tweak it for your situation (e.g., add paths, hide console window).


                          "A good athlete is the result of a good and worthy opponent." - David Crow

                          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                          G Offline
                          G Offline
                          GauranG Shah
                          wrote on last edited by
                          #17

                          Now I am Creating the batch File at run time and Its working fine.

                          [ Screen Capture ][ Tool Tip ]

                          1 Reply Last reply
                          0
                          • D David Crow

                            Notice that if you put: del %0.bat in a batch file and run it from a command prompt, it will remove itself. You can take advantage of this by creating a similar batch file from within the program you are wanting to delete:

                            :DoItAgain
                            del MyProg.exe
                            if exist MyProg.exe goto DoItAgain
                            rem del folder that MyProg.exe was in
                            del %0.bat

                            Use CreateProcess() to run the batch file. Note that I've not actually tested this so you may have to tweak it for your situation (e.g., add paths, hide console window).


                            "A good athlete is the result of a good and worthy opponent." - David Crow

                            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                            G Offline
                            G Offline
                            GauranG Shah
                            wrote on last edited by
                            #18

                            GetModuleFileName(0,FileName,MAX_PATH);
                            char strFileName[MAX_PATH]= {} ;
                            int a = WideCharToMultiByte(CP_ACP,0,FileName,-1,strFileName,MAX_PATH,NULL,NULL);
                            FILE *fwin = fopen("Uninstall.bat","w+");
                            fprintf(fwin,"@echo off \n");
                            fprintf(fwin,":back \n");
                            fprintf(fwin,"del \"%s\"\n",strFileName);
                            fprintf(fwin,"if exist \"%s\" goto back: \n ",strFileName);
                            char Buffer[]= "%0.bat";
                            fprintf(fwin,"del %s \n",Buffer);
                            OpenProc(L"Uninstall.bat"); //User function that Open the Process

                            -- modified at 3:11 Tuesday 16th October, 2007

                            [ Screen Capture ][ Tool Tip ]

                            D 1 Reply Last reply
                            0
                            • N NormDroid

                              :doh:Yes but he is on CodeProject NOT Codeguru.:wtf:

                              WPF - Imagineers Wanted Follow your nose using DoubleAnimationUsingPath

                              H Offline
                              H Offline
                              Hamid Taebi
                              wrote on last edited by
                              #19

                              norm .net wrote:

                              Yes but he is on CodeProject NOT Codeguru.

                              Well said.;)

                              1 Reply Last reply
                              0
                              • G GauranG Shah

                                GetModuleFileName(0,FileName,MAX_PATH);
                                char strFileName[MAX_PATH]= {} ;
                                int a = WideCharToMultiByte(CP_ACP,0,FileName,-1,strFileName,MAX_PATH,NULL,NULL);
                                FILE *fwin = fopen("Uninstall.bat","w+");
                                fprintf(fwin,"@echo off \n");
                                fprintf(fwin,":back \n");
                                fprintf(fwin,"del \"%s\"\n",strFileName);
                                fprintf(fwin,"if exist \"%s\" goto back: \n ",strFileName);
                                char Buffer[]= "%0.bat";
                                fprintf(fwin,"del %s \n",Buffer);
                                OpenProc(L"Uninstall.bat"); //User function that Open the Process

                                -- modified at 3:11 Tuesday 16th October, 2007

                                [ Screen Capture ][ Tool Tip ]

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

                                GauranG33 wrote:

                                char Buffer[]= "%0.bat";

                                Use an absolute path for this. What you have now is relative to whatever the CWD happens to be at the moment.


                                "A good athlete is the result of a good and worthy opponent." - David Crow

                                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                                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