sskodje / ScreenRecorderLib

A .NET library for screen recording in Windows, using native Microsoft Media Foundation for realtime encoding to h264 video or PNG images.
MIT License
414 stars 94 forks source link

Issues importing from nuget #193

Closed mmuziek closed 2 years ago

mmuziek commented 2 years ago

Hello. im having a hard time importing this lib into my C++ project. it simply does not show up in the refferences so cannot be used. When checking with nuget package manager i get : https://prnt.sc/Fo3p6L3vLfOk

unrec framework? might that be the issue? i have no clue anymore?

sskodje commented 2 years ago

Hello! Note that it will only work with managed C++, with the /clr flag set. It will not work with native C++. The library will not show under References when imported via Nuget, but it will still be imported. After installing the nuget package, you should be able to use it like this

#include <iostream>
using namespace ScreenRecorderLib;
int main()
{
    std::cout << "Hello World!\n";
    Recorder^ rec = Recorder::CreateRecorder();
}
mmuziek commented 2 years ago

Well i did import it using nuget i copied ur code over and this is the result https://prnt.sc/cET6B3cU-wuj Beside that i have no clue what ur saying about managed C++ or the clr flag? im using visual studio and choose a c++ project thats it?

sskodje commented 2 years ago

im using visual studio and choose a c++ project thats it?

In which case you are running native C++. This library is targeted for .net managed code. You must enable Common Language Runtime support in your project settings to use it.

mmuziek commented 2 years ago

well i can use it but it just do not wanna work. I try to find a way to specify a window to record im not finding any docs on how to change settings set the window or screen to capture anything like that also how stop once its recording outside of the function you start the recording in All docs that are here are nowhere near what c++ is asking and the example isnt showing anything else then main recording without any setting change.. Any help would be handy

sskodje commented 2 years ago

There are code examples both for c++/CLI and C# in the repository, as well as a quick start guide for c# in the wiki. How you use them is exactly the same, just the syntax between the languages is different.