CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 1999
    Posts
    19

    destroy another window

    Hi!
    I want to destroy another windows.
    I coded it.
    ==================================
    HWND hWnd;
    hWnd = ::FindWindow(NULL,"test");
    :estroyWindow(hWnd);
    ==================================

    But I can't destroy "test window".
    What's wrong there? or How do I destroy window?

    Buy..^-^ <: <: ....


  2. #2
    Join Date
    Jul 1999
    Location
    Romania - Iasi
    Posts
    558

    Re: destroy another window

    I'm not sure will work but try this:

    HWND hWnd;
    hWnd = ::FindWindow(NULL,"test");
    CWnd* pWnd = FromHandle( hWnd );
    if( NULL != pWnd )
    {
    :estroyWindow(hWnd);
    delete pWnd;
    }





    Let me know if this help you

    Regards,
    Ovidiu




  3. #3
    Join Date
    Jun 1999
    Location
    Canada - Québec
    Posts
    273

    Re: destroy another window

    u can try this but i thinks that is the same..
    PostMessage(hWnd,WM_DESTROY,NULL,NULL);

    i found it in MSDN : "A thread cannot use DestroyWindow to destroy a window created by a different thread."

    maybe for your is better to use this if u want close other window..:
    PostQuitMessage(hWnd,WM_CLOSE,NULL,NULL);




  4. #4
    Join Date
    Jul 1999
    Posts
    535

    Re: destroy another window

    This works jus' fine fer me....

    CString strTitle = "Input your title here"
    HWND hWnd;

    hWnd = ::FindWindow(strTitle);
    ::PostMessage(hWnd,WM_CLOSE,NULL,NULL);






  5. #5
    Join Date
    Jun 1999
    Location
    Canada - Québec
    Posts
    273

    Re: destroy another window

    yep its that.. i made mistake.. sorry..


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured