Skip to content

Instantly share code, notes, and snippets.

@kumatti1
Created July 24, 2014 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kumatti1/e1d93cfa766d00334253 to your computer and use it in GitHub Desktop.
Save kumatti1/e1d93cfa766d00334253 to your computer and use it in GitHub Desktop.
COM氏
//#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