none
how to get handle for MFC application

    Question

  •  

    Hi ,

     

      How can i get handle of a MFC application.

      There is a GetHandle() function which returns the handle ,but when i try to do it ,its not working properly can someone guide me.

     

    Thanks in advance

    Thursday, November 29, 2007 5:41 AM

Answers



  • See your question is not clear .can you elaborate it little bit More . Either you want to take handle of your Own Application or some third party application if it is third party application then you can use FindWindow() function with window class name or by Window Name . if it is your own window  then directly you can use m_hWnd ,which is the handle of the Windows window attached to this CWnd or CWindow object.

    Thanx
    Thursday, November 29, 2007 8:34 AM

All replies

  • What do u mean by handle ?

     

    A window CWnd* AfxGetMainWnd( );

    An application CWinApp* AfxGetApp( );

     

    Regards,

    Paresh.

    Thursday, November 29, 2007 5:50 AM
  • Thanks Paresh for replying..

     

    by handle i mean HWND (,as win32 so that i can send messages to the other application.

    Here i am trying to get handle of one application so that other application can send messges to that application.

     


    Thanks

    Thursday, November 29, 2007 6:22 AM


  • See your question is not clear .can you elaborate it little bit More . Either you want to take handle of your Own Application or some third party application if it is third party application then you can use FindWindow() function with window class name or by Window Name . if it is your own window  then directly you can use m_hWnd ,which is the handle of the Windows window attached to this CWnd or CWindow object.

    Thanx
    Thursday, November 29, 2007 8:34 AM
  • Haa thanks Pintu

     

    actually i needed to send a handle of an application to another application for MFC application.

     

    m_hWnd parameter is the handle for MFC application .

     

    Sending this is parameter will fix my issue.

     

    Thanks for your replys,

     

    Thursday, November 29, 2007 9:21 AM