Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   C++ Close App Help (http://www.go4expert.com/forums/cpp-close-app-help-t25813/)

XPwnd 17May2011 14:00

C++ Close App Help
 
Code:

#include <Windows.h>  DWORD WINAPI MainThread( LPVOID lpNothing ) {    for( ;;Sleep(20) ) //! Loop Forever    {        if( GetAsyncKeyState(VK_F9) ) //! If 'F9' is pressed            ExitProcess( 0 ); //! Exit this process    }      return EXIT_SUCCESS; //! Same as 'return 0' }  bool WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved ) //! A dll's main routine {    if( dwReason == DLL_PROCESS_ATTACH ) //! If the dll is to attach to an existing process        CreateThread( NULL, NULL, &MainThread, NULL, NULL, NULL ); //! Create the thread      return true; }

This is what i have so far but when i inject it i pess the keys the APP Dosent close...

shabbir 17May2011 14:59

Re: C++ Close App Help
 
Can you share the code with the line breaks.

XPwnd 17May2011 15:36

Re: C++ Close App Help
 
wut? Lol i am nub... i cant find the Edit button

XPwnd 17May2011 19:17

Re: C++ Close App Help
 
bUMP

shabbir 17May2011 20:51

Re: C++ Close App Help
 
Quote:

Originally Posted by XPwnd (Post 83125)
wut? Lol i am nub... i cant find the Edit button

Instead of bumping you could repost the code.

XPwnd 18May2011 08:11

Re: C++ Close App Help
 
Code:

#include <Windows.h>  DWORD WINAPI MainThread( LPVOID lpNothing ) {    for( ;;Sleep(20) ) //! Loop Forever    {        if( GetAsyncKeyState(VK_F9) ) //! If 'F9' is pressed            ExitProcess( 0 ); //! Exit this process    }      return EXIT_SUCCESS; //! Same as 'return 0' }  bool WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved ) //! A dll's main routine {    if( dwReason == DLL_PROCESS_ATTACH ) //! If the dll is to attach to an existing process        CreateThread( NULL, NULL, &MainThread, NULL, NULL, NULL ); //! Create the thread      return true; }

XPwnd 18May2011 08:12

Re: C++ Close App Help
 
#include <Windows.h> DWORD WINAPI MainThread( LPVOID lpNothing ) { for( ;;Sleep(20) ) //! Loop Forever { if( GetAsyncKeyState(VK_F9) ) //! If 'F9' is pressed ExitProcess( 0 ); //! Exit this process } return EXIT_SUCCESS; //! Same as 'return 0' } bool WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved ) //! A dll's main routine { if( dwReason == DLL_PROCESS_ATTACH ) //! If the dll is to attach to an existing process CreateThread( NULL, NULL, &MainThread, NULL, NULL, NULL ); //! Create the thread return true; }

xpi0t0s 18May2011 14:56

Re: C++ Close App Help
 
Code:

#include <Windows.h>

DWORD WINAPI MainThread( LPVOID lpNothing )
{
        for( ;;Sleep(20) ) //! Loop Forever   
        {       
                if( GetAsyncKeyState(VK_F9) ) //! If 'F9' is pressed           
                ExitProcess( 0 ); //! Exit this process   
        }     
        return EXIT_SUCCESS; //! Same as 'return 0'


bool WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved ) //! A dll's main routine
{   
        if( dwReason == DLL_PROCESS_ATTACH ) //! If the dll is to attach to an existing process       
                CreateThread( NULL, NULL, &MainThread, NULL, NULL, NULL ); //! Create the thread     
        return true;
}


XPwnd 18May2011 16:44

Re: C++ Close App Help
 
Can you help me with my code?

XPwnd 20May2011 22:13

Re: C++ Close App Help
 
bump!


All times are GMT +5.5. The time now is 15:32.