Under what circumstances will GetClipboardData (CF_TEXT) return NULL?

I have this unstable and inconsistent problem that makes me go crazy for a long time: in my program, GetClipboardData (CF_TEXT) reaches 90% (or so) of the time, but every time it returns NULL.

This is despite the fact that OpenClipboard () is always successful (and returns a verified value) before calling GetClipboardData (CF_TEXT).

Please note that a success rate of 90% corresponds to the same page! (i.e., I know that there is CF_TEXT content)

Note. When this fails, I immediately call GetLastError (), but all it returns is, "Operation completed successfully . "

This code is simple as:

if (::OpenClipboard(hwndW))
{
  HANDLE handleClip = ::GetClipboardData(CF_TEXT);
  if (handleClip == NULL)
    dw = GetLastError()
}

GetLastError() ?

, ?

, - ? , ?

- ?

+3
2

Google - ( , ), . EmptyClipboard() , ? , .


, , GetLastError. , , NULL, NULL. , GetLastError. MSDN , GetLastError.


, , . , - , .

+1

WebRoot SecureAnywhere? Identity Shield , ( , ) , ( ). , GetClipboardData(CF_TEXT) NULL, IsClipboardFormatAvailable(CF_TEXT) true.

+3

Source: https://habr.com/ru/post/1786492/


All Articles