Thread: OpenClipboard MFC

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    39

    OpenClipboard MFC

    Hello

    I'm doing a application using MFC.

    My problem is when I call OpenClipboard the program crashes because the member m_hWnd of class CWnd is not valid.

    I tried gave a HWND handle for it , because you have direct access to that member, but dosen't work either, i gave the HWND of my child window, the crash stop but my child window closes.


    Anyone knows something?

    Thanks =)

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Why is the m_hWnd member not valid? Does your CWnd class represent a created window?

    You can always just open the clipboard with the win32 function. Pass NULL as the parameter, so the clipboard is associated with your current task.

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    39
    Hi,

    I dont know why is invalid =(

    The strange thing is that in another function of the same class dont crash, the only difference is that this class is a afx msg function.

    I cant use the standard GetForegroundWindow, the compiler dont allow me.

    Thanks for attention =)

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    3
    Quote Originally Posted by gadu View Post
    I cant use the standard GetForegroundWindow, the compiler dont allow me.
    Why? What does it output, which error?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MFC Controls and Thread Safety :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 12-06-2002, 11:36 AM
  2. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 08:52 PM
  3. Release MFC Programs & Dynamic MFC DLL :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 05-18-2002, 06:42 PM
  4. Beginning MFC (Prosise) Part III - Now What? :: C++
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 03-03-2002, 06:58 PM
  5. MFC is Challenging :: C++
    By kuphryn in forum C++ Programming
    Replies: 8
    Last Post: 02-05-2002, 01:33 AM