C++ Close App Help

XPwnd's Avatar, Join Date: May 2011
Light Poster
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...
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Can you share the code with the line breaks.
0
XPwnd's Avatar, Join Date: May 2011
Light Poster
wut? Lol i am nub... i cant find the Edit button
0
XPwnd's Avatar, Join Date: May 2011
Light Poster
bUMP
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by XPwnd View Post
wut? Lol i am nub... i cant find the Edit button
Instead of bumping you could repost the code.
0
XPwnd's Avatar, Join Date: May 2011
Light Poster
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; }
0
XPwnd's Avatar, Join Date: May 2011
Light Poster
#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; }
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
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; 
}
shabbir like this
0
XPwnd's Avatar, Join Date: May 2011
Light Poster
Can you help me with my code?
0
XPwnd's Avatar, Join Date: May 2011
Light Poster
bump!