siukwan / screenshot

通过调用微信的截图dll库文件,实现微信截图功能
66 stars 20 forks source link

为什么用c实现,截图的时候不显示坐标等文字 #1

Open N3verL4nd opened 7 years ago

N3verL4nd commented 7 years ago

`#include

include

typedef int (*fun)(void);

int main() { HINSTANCE hDll = LoadLibrary("PrScrn.dll"); fun f = (fun)GetProcAddress(hDll, "PrScrn"); f(); FreeLibrary(hDll); return 0; } `

rundll32 PrScrn.dll PrScrn 也是一样

everplus commented 4 years ago

因为你没有初始化 gdiplus,链接时加上 gdiplus.lib

#include "pch.h"
#include <iostream>
#include <Windows.h>
#include <gdiplus.h>

using namespace Gdiplus;

int (__cdecl *PrScrn) ();

int main()
{
    GdiplusStartupInput gdiplusStartupInput;
    ULONG_PTR gdiplusToken;
    GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

    HMODULE PrScrnLib = LoadLibraryA("PrScrn.dll");
    PrScrn = (int(*)())GetProcAddress(PrScrnLib, "PrScrn");
    PrScrn();
    FreeLibrary(PrScrnLib);

    GdiplusShutdown(gdiplusToken);
    return 0;
}