Sunday, April 22, 2012

Delete itself after execution (C++ and WIN32 API's)


#include <windows.h>
#include <iostream>
#include <string>

using namespace std;

void DeleteMe();

int main(int arg, char **argv)
{
    cout << "THIS PROGRAM WILL KILL ITSELF" << endl;
    Sleep(5000);


    DeleteMe();
    return 0;
}

void DeleteMe()
{
    STARTUPINFO sj;
    PROCESS_INFORMATION pj;

    ZeroMemory( &sj, sizeof(sj) );
    sj.cb = sizeof(sj);
    ZeroMemory( &pj, sizeof(pj) );

    if(!CreateProcess("C:\\Windows\\system32\\cmd.exe", "/k del C:\\\"Documents and Settings\"\\user\\Desktop\\removePro.exe", NULL, NULL, FALSE, 0, NULL, NULL, &sj, &pj))
    {
        cout << "process creation failed " << endl;
    }
}

How to create Custom push button in QT5

To be honest this is not my work its an exact copy from this link. http://mcmtechtips.blogspot.com/2012/03/shape-qpushbutton-in-your-own-st...