C++ Close App Help

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

  1. XPwnd

    XPwnd New Member

    Joined:
    May 17, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    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

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Can you share the code with the line breaks.
     
  3. XPwnd

    XPwnd New Member

    Joined:
    May 17, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    wut? Lol i am nub... i cant find the Edit button
     
  4. XPwnd

    XPwnd New Member

    Joined:
    May 17, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
  5. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Instead of bumping you could repost the code.
     
  6. XPwnd

    XPwnd New Member

    Joined:
    May 17, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    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

    Joined:
    May 17, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    #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

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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

    Joined:
    May 17, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    Can you help me with my code?
     
  10. XPwnd

    XPwnd New Member

    Joined:
    May 17, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
  11. XPwnd

    XPwnd New Member

    Joined:
    May 17, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
  12. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice