# Start recording from C# Forms application



## Gerhard Schreurs (Aug 15, 2018)

Hi guys. I'm a web/app developer with not much experience in programming for windows and almost no experience with "low level" Windows API.

I want to control OBS from a C# Windows Forms app. I want to be able to START and STOP recording my screen. My best bet was to assign hotkeys in OBS for starting and stopping recording and somehow call / transmit these hotkeys from my Forms App.

Like I said, I'm not really experienced in this area. I am able to send text to windows, but I am almost clueless about how to "transmit" a hotkey and let OBS pick it up. I just red a bit about keyboard input, and I'm guessing that I need to create a WM_HOTKEY message, with a window handle and a hotkey identifier. Or, possibly I need to create a WM_SYSCOMMAND specifying a SC_HOTKEY. I'm not sure. I messed around a bit with Spy++ (for the first time in my life), trying to find out what messages are transmitted to OBS, but I can't figure it out. I could however see SPY++ pick up WIN+R (run command), for example.

Currently, I want to use CTRL+1 to start a recording, and CTR+2 to stop recording.
BTW: OBS is running minimized in the system tray.

I'd really appreciate an example code and/or steps on how to achieve this. And possibly there is another method to do this?

Kind regards...


----------



## RytoEX (Aug 16, 2018)

You could just use obs-websocket with any one of a number of existing OBS control apps.  If none of the existing control apps suit you, you could write one that sends websocket messages to obs-websocket.


----------



## Fosforo (Jan 21, 2019)

Hi [U]Gerhard[/U]
I'm starting to study the OBS Api and i'm trying to make the same OBS control like you.
Have made something good?
Have some info for help me to use API with C#


----------

