- Korea times
- 끌리면 오라...BGM 광고음악 라이브러리
- KartOO visual meta search engi…
- E-Book
- Channel9
- MSDN
- 여리의 작업실
- 유경상의 .NET 블로그
- window 쪼물딱 거리기
- 블루 홈(소현이 누님)
- IT 관련 전반 내용(정환이네)
- 비너스의 정보 공유(유틸리티들)
- 형기의 자료공간(디지털ERA에서 콘텐츠ERA로)
- EzineArticles (여러 분야의 글들이 올라옴)
- Relationship을 보여주는 라이브러리
- OpenRCE
- 젠틀의 블로그(무선 통신의 모든것)
- 헐랭이와 IT보안
- 워니. 추억ㅇㅔ ㅂㅣ추ㅇㅓ.
- Computer Forensics
- 토익 광장(YBM)
- Korea Times 이용하기
- Larkware Software
- TCP/UDP
- Black Hat
- DEF CON
- Slashdot
- ReallyUsefulEbooks.com Update
- 실리콘밸리 뉴스
- Application Development Trends
- Visual Studio Hacks
- MIT OCW
- Redmond Developer News
- SecurityFocus
- Microsoft Window Hacking Porta…
- Darknet - Don't Learn to Hack …
- Windows Tips, Tricks and Hacks
- Hack In the Box
- (IN)SECURE Magazine
- SuperSite Windows Vista
- Government Security
- Life is Still Talking (Good)
- PHRACK
- Found+Read(resource for startu…
- Jonathan Boutelle
- Venture Hacks
- 스마트플레이스
- All about Intellipedia
- Undocumented Windows 2000 Secr…
- HexBlog (Decompiler)
- TED (Ideas worth spreading)
- Crash Dump Analysis and Debugg…
- Rootkit
- DDK Developers(MS)
- 미친 감자의 블로그
- The Art of Assembly Language
- Chpie (키보드 후킹)
- Drivers Online
- (음악) Delicate SONG
- Reverse Engineering Community
- Software Best Practices
- Sara Ford's WebLog
- Cheat Happens
- Debugging,Unpacking,Assembling…
- 윤석찬님 블로그
- OK 괜찮아 다 잘 될거야
- RingBlog
- Art Life :: 하늘소
- IT's Paradise
- John Robbins!
- Wintellect
- Hacked Gadgets
- 소프트웨어 이야기
- Ryan Naraine's Zero Day
- VULN
- Stay Secure
- EBS 영어 공부(블루워터)
- 101BLoG : "Bright Size Life" o…
- Hacker Challenge
- Hackers Center
- White Hat, Chicago Con
- Ethical Hacker Network
- ChaseNet (Security)
- TechTarget
- Entrepreneur
- Infopackets
- Popular Science
- Dark Reading - The Business of…
- How Stuff Works
- codeDriver - Crack (역공학)
- Gadget (Windows)
- Serious Code
- Iguacu Blog(블루문)
- SecurityProof
- Power of Community(Hacker)
- Crack ?
- Security Freak
- Data Network Resource
- FoundStone - Security Consulti…
- Google Online Security Blog
- (BOOK) Cool DogBooks
- SachaBarber (좋은 개발자)
- System Software Incorporation
- 스카이 벤처
- NewsTorrent
- 글로벌 IT 네트워크
- Ethical Hacking and Infosec
- Realms of Hacking tricks
- CodeBreakers Journal
- Anti Rootkit Blog
- The Reverse Code Engineering C…
- Anti-Debug Tools
- Reverse Code Engineering Video…
- Damn Vulnerable linux
- Security Problems
- French Reverse Engineering Tea…
- Monac
- Open Source Vulnerability Data…
- Viruschaser 검사(바이러스)
- Windows Tips
- 보안 대처 연습
- [Download] Kartz CD
- [Download] FlMS Download
- [Download] DDL2
- 중국 해킹 사이트(안전중국)
- 바이러스 분석
- Javascript 전문가
- Virus Alert Zone (바이러스 분석)
- Computer World
- 문스랩닷컴(보안)
- Unpack China
- Black Storm Reverse Engineerin…
- 역공학 Reverser
- 문화 망명지 - 시, 소설
- WPF MVP
- Research Channel
- The Problem Solver - C# MVP
- Reversing - 리버스 엔지니어링
- Nigel Spencer's Blog (.NET)
- Kirill Osenkov (.NET C# IDE Te…
- H33T (BitTorrnet 검색 사이트)
- ITL (해킹, 보안)
- ITL (Invisible Things Lab) Blo…
- ebook, pdf, chm
- 주식 - 멘토클리닉
- CherryLove - 바이러스, 백신, 악성코드
- PMP
- 영원한 해커, hacker
- 리버싱, PE
- 신호철 - dsphome
- TechEd 2009
- SHOUT
- [도서] 오디오북
- [도서] 전자책
- [도서] 국내도서요약
- [도서] 해외도서요약
- TopCorder - 프로그래밍 연습
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
- Microsoft
- 구글
- .net framework 4
- VSTS 2010
- Windows
- visual studio 2010
- 디버깅
- 마이크로소프트
- hacking
- 역공학
- WPF
- english
- 책
- Visual Studio
- MVP
- .net
- VSTS
- .NET Framework
- 비주얼 스튜디오
- 해킹
- Windows 7
- 보안
- C#
- debugging
- 닷넷
- 디버그랩
- security
- 비주얼스튜디오
- Today
- Total
NaggingMachine
마우스 커서 아래에 있는 텍스트 가져오기 본문
다음은 The Old New Thing에서 소개한 글이다.
[예제 프로젝트]
----------------------------
How to retrieve text under the cursor (mouse pointer)
Microsoft Active Accessibilty is the technology that exposes information about objects on the screen to accessibility aids such as screen readers. But that doesn't mean that only screen readers can use it.
Here's a program that illustrates the use of Active Accessibility at the most rudimentary level: Reading text. There's much more to Active Accessibility than this. You can navigate the objects on the screen, read various properties, even invoke commands on them, all programmatically.
Start with our scratch program and change these two functions:
BOOL
OnCreate(HWND hwnd, LPCREATESTRUCT lpcs)
{
SetTimer(hwnd, 1, 1000, RecalcText);
return TRUE;
}
void
PaintContent(HWND hwnd, PAINTSTRUCT *pps)
{
if (g_pszText) {
RECT rc;
GetClientRect(hwnd, &rc);
DrawText(pps->hdc, g_pszText, lstrlen(g_pszText),
&rc, DT_NOPREFIX | DT_WORDBREAK);
}
}
Of course, the fun part is the function RecalcText
, which retrieves the text from beneath the cursor:
#include <oleacc.h>
POINT g_pt;
LPTSTR g_pszText;
void CALLBACK RecalcText(HWND hwnd, UINT, UINT_PTR, DWORD)
{
POINT pt;
if (GetCursorPos(&pt) &&
(pt.x != g_pt.x || pt.y != g_pt.y)) {
g_pt = pt;
IAccessible *pacc;
VARIANT vtChild;
if (SUCCEEDED(AccessibleObjectFromPoint(pt, &pacc, &vtChild))) {
BSTR bsName = NULL;
BSTR bsValue = NULL;
pacc->get_accName(vtChild, &bsName);
pacc->get_accValue(vtChild, &bsValue);
LPTSTR pszResult;
DWORD_PTR args[2] = { (DWORD_PTR)(bsName ? bsName : L""),
(DWORD_PTR)(bsValue ? bsValue : L"") };
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_STRING |
FORMAT_MESSAGE_ARGUMENT_ARRAY,
TEXT("Name: %1!ws!\r\n\r\nValue: %2!ws!"),
0, 0, (LPTSTR)&pszResult, 0, (va_list*)args)) {
LocalFree(g_pszText);
g_pszText = pszResult;
InvalidateRect(hwnd, NULL, TRUE);
}
SysFreeString(bsName);
SysFreeString(bsValue);
VariantClear(&vtChild);
pacc->Release();
}
}
}
Let's take a look at this function. We start by grabbing the cursor position and seeing if it changed since the last time we checked. If so, then we ask AccessibleObjectFromPoint
to identify the object at those coordinates and give us an IAccessible
pointer plus a child identifier. These two pieces of information together represent the object under the cursor.
Now it's a simple matter of asking for the name (get_accName
) and value (get_accValue
) of the object and format it nicely.
Note that we handled the NULL case of the BSTR in accordance with Eric's Complete Guide to BSTR Semantics.
For more information about accessibility, check out Sara Ford's WebLog, in particular the bit titled What is Assistive Technology Compatibility.
-----------------------이외에도 다음 글을 살펴보면 많은 도움이 될 것이다.
Accessibility is not just for people with disabilities
When the topic of accessibility comes up, most people think it's all about people with disabilities. While it's true that people with disabilities were the original target audience for accessibility, more recent developments have highlighted the value of accessible technologies to everyone.
For one thing, making your program accessible means that test automation can manipulate your program in a uniform manner. They can enumerate the buttons, get text for them, press a button programmatically, and so on. Even if you don't use a standard button control but instead opt to go windowless, as long as you expose your controls via accessibility, test automation can find them.
Also, we saw how programs can use accessibility to retrieve text from the screen. I use this in my English/Chinese dictionary program to "pluck" text off the screen and paste it into the "translate this" box, where I can arrow through the sentence and have the program translate each word or phrase on the fly. (Rats, now you know where I'm going with the program.) And once I started using this feature, I discovered to my dismay how many of the programs that I use on a regular or semi-regular basis simply fail to support this simple task. Microsoft products have a much higher success rate, but even there the support is not 100%.
Finally, check out this screencast showing off Vista's speech recognition system. The "Say what you see" feature which Chris discusses at time code 8:52 needs to get the name of every element on the screen so it can take what you say and look for it on the screen. If your program doesn't expose these names, the "Say what you see" feature won't know what the user needs to say to click on your button, and users will say, "Harumph, why doesn't this program work with voice recognition? All my other programs do."
My secret hope is that "Say what you see" will finally be enough to prod people into taking accessibility seriously. Because it's not just for people with disabilities.
'TechnoBabbler' 카테고리의 다른 글
MDbg + MDbg GUI 설치하기 (0) | 2006.08.21 |
---|---|
마이크로소프트의 SE 비법 공개 (0) | 2006.08.21 |
ACE 프로그래밍 (0) | 2006.08.20 |
BOINC 설치 방법 (0) | 2006.08.20 |
개발자들이 선호하는 폰트 조사 결과 (0) | 2006.08.19 |