Using wechat PC screenshots DLL library to achieve wechat screenshots function (C++ Builder)

Using wechat PC screenshots DLL library to achieve wechat screenshots function (C++ Builder)_ passcat 2022 blog -CSDN blog

  • There are many articles on the Internet that “use wechat PC screenshots DLL library to achieve wechat screenshots function”, I use node to achieve screenshots also want to use, so FIND this

Github.com/liangtongzh… Node calls PrintScr. Exe, which in turn calls prscrn.dll. The result is that it works directly, but requires the installation of a.NET 3.5 library

  • I want a green version. So it’s time to use C++ Builder to implement a command line program that calls this DLL.

Generate the lib required by C++Builder

  • The prscrn. DLL is a 32-bit DLL that can be directly generated using the C++Builder tool implib
  • Instead of implib for 64-bit DLLS, use something else.
implib PrScrn.lib PrScrn.dll
Copy the code
  • Take a look at what interfaces this DLL has
tdump -ee -m PrScrn.dll
Copy the code

The output is as follows:

Turbo Dump  Version 6.6.1.0 Copyright (c) 1988-2021 Embarcadero Technologies, Inc.
                    Display of File prscrn.dll

EXPORT ord:0001='PrScrn'
Copy the code

As you can see, this DLL has only one function, PrScrn

  • Def files can also be generated using commands
impdef PrScrn.def PrScrn.dll
type PrScrn.def
Copy the code

The output is as follows:

LIBRARY     PRSCRN.DLL

EXPORTS
    PrScrn                         @1   ; PrScrn
Copy the code

Start C++Builder to create the console project as follows

  • The first step

  • The second step

  • The third step

  • Step 4: Save the project, save the project name as PrintScr

  • Step 5: Right-click the project and choose Options

  • Step 6: remove the use of DLL, so that it can be independent of the exe, not dependent on any DLL C++Builder

Set it to false and save it

Step 7: Copy prscrn. lib to the project directory, copy prscrn. DLL to the Win32/Release directory, then right-click the project and select add to add lib to the project

Step 8: Modify the main function

#pragma hdrstop
#pragma argsused

#ifdef _WIN32
    #include <tchar.h>
#else
typedef char _TCHAR;
    #define _tmain main
#endif

#include <stdio.h>
// External DLL function declaration
extern "C" int __stdcall PrScrn(a);

int _tmain(int argc, _TCHAR* argv[])
{
    return PrScrn(a); }Copy the code

Step 9: Select the release mode to run and successfully start the screenshot.

  • This will give you printscr.exe, and if you put these two together, it’s a green screenshot tool, and when it’s successful, the screenshot is inside the clipboard. Under WPS New Document, press CTRL + V to see your screenshot