C++ (Qt)LIBS += -framework CoreFoundation -framework Carbon -framework Carbon/Frameworks/HIToolbox LIBS += -framework ApplicationServices
C++ (Qt)Include <CGWindow.h>
C++ (Qt)#include </System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Headers/CGWindow.h>
LIBS += -framework CoreGraphics
C++ (Qt) CGWindowListOption option; CGWindowID relativeToWindow; CGWindowListCreate(option,relativeToWindow); CFDictionaryRef array = CGWindowListCreateDescriptionFromArray(relativeToWindow); // здесь не проходит
C++ (Qt) ошибка: invalid conversion from 'CGWindowID' to 'const __CFArray*' ошибка: cannot convert 'const __CFArray*' to 'const __CFDictionary*' in initialization
C++ (Qt)void MacAPIWindows::GetListWindow(){ CGWindowListOption option; CGWindowID relativeToWindow; CFArrayRef array = CGWindowListCreate(option,relativeToWindow); /// ???????? ?? ??????? CFArrayRef CFIndex cfiLen = CFArrayGetCount(array); int WID; for (CFIndex cfiI = 0; cfiI < cfiLen; cfiI++){ CFArrayGetValueAtIndex(array, cfiI); WID = (int)cfiI; qDebug()<<WID; } /// ??????? ?????????? ?? ?????? ???? CFAllocatorRef alloc; CFArrayRef arrayInform = CFArrayCreateCopy(alloc, CGWindowListCreateDescriptionFromArray(array)); /// ???????? ?? ??????? CFArrayRef CFIndex cfiLen = CFArrayGetCount(arrayInform); CFDictionaryRef dictionary; for (CFIndex cfiI = 0; cfiI < cfiLen; cfiI++){ CFArrayGetValueAtIndex(arrayInform, cfiI); dictionary = (CFDictionaryRef)cfiI; // а как со словарем работать ? } }
C++ (Qt) CFIndex cfiLen = CFArrayGetCount(array); int WID; for (CFIndex cfiI = 0; cfiI < cfiLen; cfiI++){ WID = CFArrayGetValueAtIndex(array, cfiI); // хотя тут даже скорее хранятся CFNumber или что-то такое, а не простые инты qDebug()<<WID; }
C++ (Qt)/// ???????? ?? ??????? CFArrayRef cfiLen = CFArrayGetCount(arrayInform); CFDictionaryRef dictionary; for (CFIndex cfiI = 0; cfiI < cfiLen; cfiI++){ CFArrayGetValueAtIndex(arrayInform, cfiI); dictionary = (CFDictionaryRef)cfiI; CFDictionaryGetValue(dictionary,kCGWindowOwnerName); //qDebug()<<WID; }
C++ (Qt) CFDictionaryRef dictionary; for (CFIndex cfiI = 0; cfiI < cfiLen; cfiI++){ dictionary = (CFDictionaryRef) CFArrayGetValueAtIndex(arrayInform, cfiI); CFStringRef name = (CFStringRef)CFDictionaryGetValue(dictionary,kCGWindowOwnerName); qDebug()<<uniCFStrToQStr(name); // моя фун-я }