1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

C++ Close App Help

Discussion in 'C++' started by XPwnd, May 17, 2011.

  1. XPwnd

    XPwnd New Member

    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...
     
  2. shabbir

    shabbir Administrator Staff Member

    Can you share the code with the line breaks.
     
  3. XPwnd

    XPwnd New Member

    wut? Lol i am nub... i cant find the Edit button
     
  4. XPwnd

    XPwnd New Member

    bUMP
     
  5. shabbir

    shabbir Administrator Staff Member

    Instead of bumping you could repost the code.
     
  6. XPwnd

    XPwnd New Member

    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; }
     
  7. XPwnd

    XPwnd New Member

    #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; }
     
  8. xpi0t0s

    xpi0t0s 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 likes this.
  9. XPwnd

    XPwnd New Member

    Can you help me with my code?
     
  10. XPwnd

    XPwnd New Member

    bump!
     
  11. XPwnd

    XPwnd New Member

    ****!
     
  12. xpi0t0s

    xpi0t0s Mentor

    Well I'm not posting cos I don't know. Anyone else?

    Maybe instead of posting bump and **** (thereby risking getting banned) you could take the question to a Microsoft forum. No point getting mad at us just cos we don't happen to have the specific bit of knowledge you're looking for.
     
  13. xpi0t0s

    xpi0t0s Mentor

    In your opening post you say "when i inject it" - could you clarify exactly what you mean by that? How do you "inject" a DLL?
     

Share This Page