C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[60053] Re:Re:염치없이 다시 질문을 올립니다...
Nibble [gameover] 1011 읽음    2010-01-29 17:20
mouse_event 를 치시고 F1을 눌러보시면

dx

Specifies the mouse's absolute position along the x-axis or its amount of motion since the last mouse event was generated, depending on the setting of MOUSEEVENTF_ABSOLUTE. Absolute data is given as the mouse's actual x-coordinate; relative data is given as the number of mickeys moved.

dy

Specifies the mouse's absolute position along the y-axis or its amount of motion since the last mouse event was generated, depending on the setting of MOUSEEVENTF_ABSOLUTE. Absolute data is given as the mouse's actual y-coordinate; relative data is given as the number of mickeys moved.

라고 설명이 나오죠.

그리고

If MOUSEEVENTF_ABSOLUTE value is specified, dx and dy contain normalized absolute coordinates between 0 and 65,535. The event procedure maps these coordinates onto the display surface. Coordinate (0,0) maps onto the upper-left corner of the display surface, (65535,65535) maps onto the lower-right corner.

If the MOUSEEVENTF_ABSOLUTE value is not specified, dx and dy specify relative motions from when the last mouse event was generated (the last reported position). Positive values mean the mouse moved right (or down); negative values mean the mouse moved left (or up).

라고 덧붙여져 있어요.

즉, 화면을 절대 좌표계로 움직이고 싶을땐, dwFlags 에 MOUSEEVENTF_ABSOLUTE 옵션을 거셔야 하는데
이때, 화면을 가로 0 ~ 65535, 세로 0 ~ 65535 로 입력해주셔야 한다는거죠.
모니터가 1280 * 960 이면, 0 ~ 1279, 0 ~ 959 좌표일텐데,
1279, 959 로 보내기 위해선 65535, 65535 를 주셔야 한다는거죠

이걸 계산식으로 하면

dx = 보내고 싶은 가로 좌표 * 65535 / (모니터의 가로 해상도 - 1)
dy = 보내고 싶은 세로 좌표 * 65535 / (모니터의 세로 해상도 - 1)

이란 소리가 되겠죠?

40, 80 으로 보내고 싶을땐

dx = 40 * 65535 / (Screen->Width - 1);
dy = 80 * 65535 / (Screen->Height - 1);

처럼 하시면 됩니다.

ㅎㅎ 님이 쓰신 글 :
: 네
:
: 김민준 님이 쓰신 글 :
: : "둘리"님과 "장성호" 님께서 답변해주신 글들 보고 마우스 이벤트를 테스트 하려는데요
: :
: : 여기서 또 하나의 궁금증이 생깁니다
: :
: : VOID mouse_event(          DWORD dwFlags,
: :     DWORD dx,
: :     DWORD dy,
: :     DWORD dwData,
: :     ULONG_PTR dwExtraInfo
: : );
: :
: : 이 과정은 "둘리"님 께서 링크로 올려주신 부분인데요 
: :
: : 질문1. x,y 값은  컴퓨터의 크기 (ex : 1280x960) 에 비례하는건가요 아니면 c++빌더의 from 에 비례하는건가요
: :
: : 질문2. mouse_event(MOUSEEVENTF_LEFTDOWN, 0,0, 0, 0); 여기서 첫번째 숫자부터 x,y,dwData,dwExtralmfo 이 순서가 맞나요?
: :
: : 질문3. 테스트 할때 버튼1을 누르면 1->2->1->2->1->2 반복적으로 클릭하게 하고싶은데
: : dwData와 dwExtralnfo 의 용도는 무엇인가요...  그리고 마우스 이벤트 이외의 소스를 넣어야 하나요?

+ -

관련 글 리스트
60045 염치없이 다시 질문을 올립니다... 김민준 978 2010/01/29
60053         Re:Re:염치없이 다시 질문을 올립니다... Nibble 1011 2010/01/29
60174             Re:Re:Re:염치없이 다시 질문을 올립니다... 김민준 837 2010/02/06
60175                 Re:Re:Re:Re:염치없이 다시 질문을 올립니다... 남병철.레조 977 2010/02/07
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.