【问题标题】:GetClipboardSequenceNumber() function declarationGetClipboardSequenceNumber() 函数声明
【发布时间】:2014-03-01 14:47:38
【问题描述】:

我想在 C++ 中捕获剪贴板复制和剪切地址,但编译器说 GetClipboardSequenceNumber() 函数未声明存在错误。我该如何声明。

#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <conio.h> 
#include <winuser.h>
using namespace std; 

int _tmain(int argc, _TCHAR* argv[])
{
   DWORD y = GetClipboardSequenceNumber();
   while(1) {
        Sleep(1000);
        if(y!=GetClipboardSequenceNumber()) 
             {
               OpenClipboard(NULL);
               HANDLE X =GetClipboardData(CF_TEXT);
               cout<<(char*)GlobalLock(X);
               GlobalUnlock(X);
             }
           }
getch();
return 0;
}

【问题讨论】:

  • 您似乎正在使用特定于操作系统的 API 调用(我猜是 Windows)。请适当修改您的标签。也请正确缩进你的代码。
  • 是的,我使用的是 Windows 7。你能给我正确的代码吗
  • 否,但如果您在帖子上设置适当的标签,其他人可能会这样做。

标签: c++ keylogger


【解决方案1】:

这可能取决于编译器,但documentation 声明这仅适用于 Windows 2000 和更新版本,因此您应确保声明正确的 WINVER 版本以获得对必要功能的访问。 ie: #define WINVER 0x0501 before you include Windows.h 让它包含为 XP 定义的函数,但不包含仅在 Windows Vista (0x600) 中可用的函数。如果您使用 Visual C++,那么 Platform SDK 往往会定义一个合理的值。但可以肯定的是 - 在包含任何 Windows 标头之前定义 WINVER 和 _WIN32_WINNT。

【讨论】:

  • 我的编译器是 Dev c++,我的操作系统是 win 7 32 位。你说的那个工作是行不通的。请告诉我该怎么办
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-11-07
  • 2014-05-25
  • 2010-12-24
  • 2012-08-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多