C++ Close App Help

Light Poster
17May2011,14:00   #1
XPwnd's Avatar
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...
Go4Expert Founder
17May2011,14:59   #2
shabbir's Avatar
Can you share the code with the line breaks.
Light Poster
17May2011,15:36   #3
XPwnd's Avatar
wut? Lol i am nub... i cant find the Edit button
Light Poster
17May2011,19:17   #4
XPwnd's Avatar
bUMP
Go4Expert Founder
17May2011,20:51   #5
shabbir's Avatar
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.
Light Poster
18May2011,08:11   #6
XPwnd's Avatar
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; }
Light Poster
18May2011,08:12   #7
XPwnd's Avatar
#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; }
Mentor
18May2011,14:56   #8
xpi0t0s's Avatar
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 likes this
Light Poster
18May2011,16:44   #9
XPwnd's Avatar
Can you help me with my code?
Light Poster
20May2011,22:13   #10
XPwnd's Avatar
bump!