-1

I am trying to implement the zoom sdk and want to prevent my screen to be captured and by screen shots for this purpose they have given some functions to be placed inside the project. When I place the code inside the function I start getting some errors and when I remove then the errors are gone. The code which need to be placed inside the project is as follows:

BOOL CALLBACK EnumWindowsCB(HWND hwnd, LPARAM lParam)
{
    SetWindowDisplayAffinity(hwnd, WDA_MONITOR);
    return TRUE;
}
void CZoomSDKeDotNetWrap::DisableScreenRecord() {
    DWORD pid = GetCurrentProcessId();
    EnumWindows(EnumWindowsCB, pid);
    uint8_t* func_data = (uint8_t*)GetProcAddress(GetModuleHandle(L"user32.dll"), "SetWindowDisplayAffinity");
}

Please let me know what these errors mean and how to resolve them. The errors are: enter image description here

  • 2
    You may get compiler errors if you use a C++ compiler to build a C# program. They are two distinct languages. Please update your language tags with the one language you are using. – Thomas Matthews Dec 29 '21 at 18:58
  • 1
    Please edit your post with the *text* of the errors. Highlight the text, copy to clipboard, edit your post and paste into your question. – Thomas Matthews Dec 29 '21 at 18:59
  • @ThomasMatthews: Those are linker errors, not compiler errors. The C++ code compiled fine with the right compiler, as evidenced by the fact that the linker is now trying to resolve those symbols. – madreflection Dec 29 '21 at 19:09
  • @madreflection do you know how to resolve this I struggling with this a lot – Muhammad Shahzaib Dec 29 '21 at 20:03
  • FaitAccompli's answer is correct. `user32.lib` is usually included by default, IIRC, so the fact that the linker can't find the symbol is unusual. You would have to check the linker property pages and ensure that it's included. – madreflection Dec 29 '21 at 20:09

2 Answers2

2

You need to add a reference to the respective library(dll) you're using in the function you're trying to put inside the library.

As seen in your code above you're trying to use standard Windows libraries. Have you tried editing your project properties then linker input options to include user32.lib?

FaitAccompli
  • 787
  • 5
  • 16
0

Thank you everyone who answered. Actually it was just because I was not using user32.lib library in the project when I added the errors got removed and it started working for me.