Get live screenshot of window in objective-c - objective-c

I'm trying to find a way to get a live view of a specific window. In the same way that Mission Control and Exposé will show you live views of windows that are currently obscured by other windows (this is also done by Hyperdock, so I'm pretty certain that its not a private API).
What is the functionality called? And so where is the documentation on it?

You want the Quartz Window Services API. Basically, you want to create a window list with the windows you're interested in and use CGWindowListCreateImage to get a picture of the window's contents.

Related

display a popup inside external application

I'm developing an application in which, if I press a combination of keys shows me a popup inside the form of another external application, I mean something like the "windows game menu", but I have no idea how to show the popup in the external application. I leave you an image to make you understand what I mean as a popup. sorry for my english but I do not speak.
Thanks in advance
You cannot control one application form of another application without having access to its code or knowing if a queue messaging command has been set for doing it.
It is possible to program a window of your application to be shown over any other , likely this will not be working over a Directx - OpenGL full-area, i.e. when you are playing a videogame that is using the same functionality because the last one is winning.
In this case your popup will be visible barely as a flick, but considering standard form application you can make it to stand over by working with userd32.dll method
"SetWindowPos" with the flag HWND_TOPMOST.
You will need first to detect the position of the application window, or if it is a fullscreen one you can simply detect the size of the screen and consider to place it in the center, then you can set the position of your application form "pop-up".
Details about the SetWindowPos , which is among windwows base dll but can be invoked from .net here below:
https://learn.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setwindowpos
Make a window topmost using a window handle

Reveal (or Snap) Windows 8 App when system receives push notification

Can anyone enlighten me as to how one would be able to trigger a "non standard" realtime notification on a Windows 8 machine? My objective here was simply to find a slick method through which the end user is presented with an enhanced notification slide displayed via a slide in/5 second fade out dialog box.
Best example I can think of to illustrate what I am trying to achieve would be thinking of it like when the charms bar is presented which can automatically fade away. I simply require that this enhanced notification layer is somewhat customizable in order for me to provide summary content along with 3-4 buttons a user can press directly. This notifications needs to be triggered automatically upon the system receiving a push notification.
I have loomed into various "notification" methods such as default windows notifications, offline Google Apps notifications,... problem however is that they all seem not to allow me to customize the notification window to meet my needs.
Any suggestions / examples would be very helpful.
BTW - as an alternative solution - is there simply a way that I might be able to have Windows automatically load and "snap" into view the contents of a specific Windows app containing my content to the left or right side of the screen (upon receiving a push notification vs displaying the standard toast bubble?
Are you looking for something like growl?

Programmatically synchronize(camera-link) multiple intersection windows

Ocean2013.1 provides a sample(WheelerViewer) for using cameras(OpenInventor features) for 3D Windows, but is it possible to synchronize(equivalent of clicking the camera link toolbar option) multiple intersection windows in Ocean/Petrel programmatically?
Camera linking is available as a Petrel feature but not as a Ocean API for developer to access programmatically
You need to be mode specific on what you are trying to synchronize and why.
The Window3D exposes enough camera API that one can write his own camera view synchronization.
If all you want is to be able to click the "Synchronize camera" button via API, it's a different issue. Why do you need this? Often users ask to be able to link all windows with one mouse button click. This, I believe, might be coming in 2015 as a user feature.

Is it possible to attach my window to a window of another application?

On Windows we can find the window handle of running process and attach our window onto it as a child window, so the two different processes look like the same one.
I wonder if there is a similar way to implement this requirement in cocoa.
This is possible using code injection. Have a look at mach inject framework and PorcShark Finder.
Or
Find position of another window using CGWindow methods and display your window over it.
Have a look at Son of Grab sample project.
Son of Grab shows how to use the new CGWindow API to get images of arbitrary sets
of windows, including images of the current contents of the screen.

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