I am trying to take a screenshot on OSX with C / C ++. So far what I found:
#import & lt; ApplicationServices / ApplicationServices.h & gt; Int main (int argc, char ** argv) {CGImageRef screenshot = CGWWO LIST CREATIVE IMAGE (CGRTINFIN, KCGVandolist OceanOnScreen Only, KCG NewWondoide, KCGWondo IMAGE Default); CFStringRef file = CFR ("/ user / adah / desktop / lala.jpg"); CFStringRef Type = CFR ("public.jpeg"); Seaflerff urlRef = CFRCriteWithString (zero, file, tap); CGImageDestinationRef idst = CGImageDestinationCreateWithURL (urlRef, type, 1, faucet); CGImageDestinationAddImage (idst, screenshot, NULL); CGImageDestinationFinalize (idst);}
It compiles properly but nothing really does happen I'm probably just doing a stupid mistake, if someone can point me in the right direction That would be great!
As the man mentioned above, it can be fixed in such a way, if I also use C ++:
CFLRF URLRF = CfLCrittfilefile systempath (KCFAALocator default, file, KCFRPPOSXXTPSTE, false);
Comments
Post a Comment