How do I control the media keys of my Mac with my own program? - objective-c

I would like to write a program that controls the media buttons. Or their function: volume up / down, next, previous, mute, play / pause
where can I find something about it?

This link should help you with the volume control, as for the play/pause/forward/previous, you might look into just executing an applescript script to do those things.
Hope this helps

Related

Is there a way to take an ingame high res screenshot in UE4?

So I am developing a VR app in Unreal and I'd like to give the user the ability to take a screenshot in game through the click of a button.
I am currently taking a screenshot through a console command but, it doesn't allow me to change the file location of where it goes. I don't think it will be intuitive enough to users to look into the AppData folder.
Is there a way to change this file location?
Does anyone know of any other ways to take a screenshot in game in Unreal Engine and save it to a folder or something similar?
Is there a function library or anything I can utilize?
Check this thread out:
Unreal Engine 4 In-game Screenshot
You should continue to use the console command; it's the easiest way to do this in my opinion. In C++, you can expose your screenshot default folder with ProjectSavedDir(). That being said, you can get references of your screenshots and move them to another FPath location. For a bit of a better translation, take a look at these macros: https://docs.unrealengine.com/en-US/API/Runtime/Core/Misc/FPaths/index.html
I found a really easy way to change where the screenshot gets saved at. I was really surprised how easy it was actually. Essentially, all you have to do is add an argument to the console command.
HighResShot 1920x1080 filename="D:/Screenshots/screenshot.png"
However, you need to ensure that the file name is unique, otherwise it will just overwrite the screenshot every time.
I ended up just grabbing Time Now and appending the date inside of the screenshot name. So that it ended up looking something like this:
HighResShot 1920x1080 filename="D:/Screenshots/screenshot_2020-6-5-8-40-01.png"

How to simulate mouse clicks?

I was wondering how to create a sort of auto clicker using VB.NET.
I would basicly have the click coordinates pre-defined and the clicks, which would have to be separated by delays I guess since I want more than one to happen periodically, would happen outside of the application window (I read this envolves extra system hooks?).
The only code I have been able to find is related to clicks on the application window, which is not what I am looking for.
In short: I want to click a button on the app window, which would initiate a number of clicks on certain pre-defined screen coordinates.
Thanks in advance :)
See this discussion on social.msdn: Simulate a mouse click in a program.
Uses winapi: SetCursorPos, GetCursorPos and mouse_event.
I believe you need to P/Invoke into Windows to accomplish this.
Have a look at the SendInput function.
If you are using automate the program,that program have some tabindex in order to relevant control.then you can use;
SendKeys.Send("{TAB}");
SendKeys.Send("{ENTER}");
it is more accurate on desktop application

Detect screen capture in vb.net

Is there a way to detect screen capture or recording is processing.
Atleast a way to know the process behind screen capturing?
i guess something has to be done with Kernal side of the system but not sure.
Thanks in advance..
You could look at using something like Deviare. I haven't used it personally, but it does let you hook some of the win32 APIs including GDI32, which is probably what you would have to use.
You could capture a [print scrn] button press from the keyboard, but there are so many different ways to record video and capture screens, you couldn't possibly create a solution to scan all the different types of applications that can capture this information.

vb.net Display/Focus/Show Form on top of PC Game

What I am trying to accomplish is this: I want to be able to press the F5 key on my keyboard, while playing a PC game, to show (bring forward, focus, etc.) my program. My 3 attempts so far have failed. Any idea on how I could accomplish my goal? Similar posts on other forums say to set the form's key preview to true and use on keyPress... which failed.
Thank you,
Anonymous
Here is the question about capturing global mouse / keyboard, you can try using it in VB.NET and test it, though I guess you only don't want to be caught while playing games during work. ;)
Also I definitely suggest this link from it. :)

How does "Cinch App" do it?

If you aren't familiar with Cinch, its an application on Mac App Store that allows you to resize ANY window to half/full screen size if you drag the window to the edge of the screen. Exactly like the functionality in windows 7.
Now my question is, how is it done? I have looked all over cocoa apis looking for notifications/delegate methods for whenever a window is being dragged (ALL windows, not just windows owned by the app from which code is running from) but can't find it. Looked in Core Graphics API...Quartz Display Services....but can't find it.
Any help will be greatly appreciated as I have been looking for the past week....Thanks!
Edit: Resize the window is easy since it can be done through applescript bridge..
Are you developer behind i-Snap or some other Mac App Store clone of Cinch?
I'm the developer behind Cinch, and while I try to maintain an "abundance mentality" which basically says "There's enough out there for everyone", I've been upset by the Mac App Store lowering the barrier for entry to this market which has produced a number of half-backed competitors.
I would be thrilled to see some real innovation around the work I have done, and not just clones looking to make a quick buck.
Anyway, you want to look at the Accessibility APIs. It's a Carbon C API. This is probably your best reference: http://developer.apple.com/library/mac/#samplecode/UIElementInspector/Introduction/Intro.html%23//apple_ref/doc/uid/DTS10000728
I've not used the Cinch app, but if I were to do this I'd expect to be using cocoa events. (Also see here) Specifically the mouse handling events, combined with where the mouse is currently on-screen. They probably set a variable when a window is grabbed and then track the mouse pointer until it hits an edge or until they release the mouse button.
Events are very powerful and provide very low level access to what is happening, but can also be very complex. Good luck!
I'm not sure. Maybe the developers combine apple script and carbon events. You can create carbon events to know when the mouse has been clicked or dragged