Created
July 24, 2014 22:24
-
-
Save kumatti1/e1d93cfa766d00334253 to your computer and use it in GitHub Desktop.
COM氏
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#define UNICODE | |
#import "igfxsrvc.exe" | |
#include <windows.h> | |
#include <stdio.h> | |
#include <comdef.h> | |
using namespace IGFXSRVCLib; | |
void GetName() | |
{ | |
try { | |
_bstr_t bstr; | |
IColorPtr pED; | |
HRESULT hr = pED.CreateInstance(__uuidof(Color)); | |
if (FAILED(hr)) _com_issue_error(hr); | |
DWORD dwDevice = 0x100; | |
long l = pED->IsSupported(dwDevice); | |
char tmp[50]; | |
sprintf(tmp,"%x", l); | |
MessageBoxA(0,tmp, "", MB_OK); | |
long a, b, c; | |
pED->GetMainScreenBrightNessValues(dwDevice, 3, &a, &b, &c); | |
sprintf(tmp,"%x %x %x",a,b,c); | |
MessageBoxA(0,tmp, "", MB_OK); | |
} | |
catch (_com_error& e) { | |
MessageBoxA(nullptr, e.ErrorMessage(), "err", MB_OK); | |
} | |
} | |
int CALLBACK WinMain( | |
_In_ HINSTANCE hInstance, | |
_In_ HINSTANCE hPrevInstance, | |
_In_ LPSTR lpCmdLine, | |
_In_ int nCmdShow | |
) | |
{ | |
::CoInitialize(NULL); | |
GetName(); | |
::CoUninitialize(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment