HTML解析ヘルパー(仮) https://gist.github.com/kumatti1/96e89ff9e4100381d4d8 VBS版 https://gist.github.com/kumatti1/93cf607ba19d1f89ca5e
Last active
December 10, 2015 01:18
-
-
Save kumatti1/4356793 to your computer and use it in GitHub Desktop.
タグ名を得るの巻
This file contains hidden or 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 | |
#include <windows.h> | |
#include <stdio.h> | |
#include <Mshtml.h> | |
#include <Oleacc.h> | |
#include <Shlwapi.h> | |
#include <OleAuto.h> | |
VOID CALLBACK TimerProc( | |
_In_ HWND hwnd, | |
_In_ UINT uMsg, | |
_In_ UINT_PTR idEvent, | |
_In_ DWORD dwTime | |
); | |
int CALLBACK WinMain( | |
_In_ HINSTANCE hInstance, | |
_In_ HINSTANCE hPrevInstance, | |
_In_ LPSTR lpCmdLine, | |
_In_ int nCmdShow | |
) | |
{ | |
CoInitialize(NULL); | |
SetTimer(0,0,5000,&TimerProc); | |
MessageBox(nullptr,nullptr,nullptr,MB_OK); | |
CoUninitialize(); | |
return 0; | |
} | |
VOID CALLBACK TimerProc( | |
HWND hwnd, // ウィンドウのハンドル | |
UINT uMsg, // WM_TIMER メッセージ | |
UINT_PTR idEvent, // タイマの識別子 | |
DWORD dwTime // 現在のシステム時刻 | |
) | |
{ | |
POINT point; | |
VARIANT varItem; | |
IAccessible* pAcc; | |
KillTimer(0,idEvent); | |
GetCursorPos(&point); | |
HRESULT hr = AccessibleObjectFromPoint(point, &pAcc, &varItem); | |
if ((hr == S_OK)) | |
{ | |
IHTMLElement* pElements; | |
IUnknown_QueryService(pAcc, | |
__uuidof(pElements), | |
IID_PPV_ARGS(&pElements)); | |
if(pElements) | |
{ | |
BSTR bstr; | |
pElements->get_tagName(&bstr); | |
MessageBox(nullptr,(LPCWSTR)bstr,nullptr,MB_OK); | |
SysFreeString(bstr); | |
pElements->Release(); | |
} | |
VariantClear(&varItem); | |
pAcc->Release(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment