求大神在解决一个问题。 80
//Win32Project7.cpp:定义DLL应用程序的导出函数。//#include"stdafx.h"#include<string.h>#include<str...
// Win32Project7.cpp : 定义 DLL 应用程序的导出函数。
//
#include "stdafx.h"
#include <string.h>
#include <string>
#include <iostream>
#include <shlobj.h>
#include <windows.h>
#include <stdio.h>
using namespace std;
#define DLLEXPORT extern "C" __declspec(dllexport)
int CopyFileToClipboard(char szFileName[]);
int CopyFileToClipboard(char szFileName[])
{
UINT uDropEffect;
HGLOBAL hGblEffect;
LPDWORD lpdDropEffect;
DROPFILES stDrop;
HGLOBAL hGblFiles;
LPSTR lpData;
uDropEffect = 1;
hGblEffect = GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE | GMEM_DDESHARE,sizeof(DWORD));
lpdDropEffect = (LPDWORD)GlobalLock(hGblEffect);
*lpdDropEffect = DROPEFFECT_COPY;//复制; 剪贴则用DROPEFFECT_MOVE
GlobalUnlock(hGblEffect);
stDrop.pFiles = sizeof(DROPFILES);
stDrop.pt.x = 0;
stDrop.pt.y = 0;
stDrop.fNC = FALSE;
stDrop.fWide = FALSE;
hGblFiles = GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE | GMEM_DDESHARE,\
sizeof(DROPFILES)+strlen(szFileName)+2);
lpData = (LPSTR)GlobalLock(hGblFiles);
memcpy(lpData,&stDrop,sizeof(DROPFILES));
strcpy(lpData+sizeof(DROPFILES),szFileName);
GlobalUnlock(hGblFiles);
OpenClipboard(NULL);
EmptyClipboard();
SetClipboardData(CF_HDROP,hGblFiles);
SetClipboardData(uDropEffect,hGblEffect);
CloseClipboard();
return 1;
}
DLLEXPORT int __stdcall hello(char *c1)
{
char file[]="d:\\كىچىككىنە بى.cpp"
CopyFileToClipboard();
return 0;
}
这个怎么设置呢?求大神讲解。还是从python发送UTF8过去的。 展开
//
#include "stdafx.h"
#include <string.h>
#include <string>
#include <iostream>
#include <shlobj.h>
#include <windows.h>
#include <stdio.h>
using namespace std;
#define DLLEXPORT extern "C" __declspec(dllexport)
int CopyFileToClipboard(char szFileName[]);
int CopyFileToClipboard(char szFileName[])
{
UINT uDropEffect;
HGLOBAL hGblEffect;
LPDWORD lpdDropEffect;
DROPFILES stDrop;
HGLOBAL hGblFiles;
LPSTR lpData;
uDropEffect = 1;
hGblEffect = GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE | GMEM_DDESHARE,sizeof(DWORD));
lpdDropEffect = (LPDWORD)GlobalLock(hGblEffect);
*lpdDropEffect = DROPEFFECT_COPY;//复制; 剪贴则用DROPEFFECT_MOVE
GlobalUnlock(hGblEffect);
stDrop.pFiles = sizeof(DROPFILES);
stDrop.pt.x = 0;
stDrop.pt.y = 0;
stDrop.fNC = FALSE;
stDrop.fWide = FALSE;
hGblFiles = GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE | GMEM_DDESHARE,\
sizeof(DROPFILES)+strlen(szFileName)+2);
lpData = (LPSTR)GlobalLock(hGblFiles);
memcpy(lpData,&stDrop,sizeof(DROPFILES));
strcpy(lpData+sizeof(DROPFILES),szFileName);
GlobalUnlock(hGblFiles);
OpenClipboard(NULL);
EmptyClipboard();
SetClipboardData(CF_HDROP,hGblFiles);
SetClipboardData(uDropEffect,hGblEffect);
CloseClipboard();
return 1;
}
DLLEXPORT int __stdcall hello(char *c1)
{
char file[]="d:\\كىچىككىنە بى.cpp"
CopyFileToClipboard();
return 0;
}
这个怎么设置呢?求大神讲解。还是从python发送UTF8过去的。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询