Click here to Skip to main content
15,905,614 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Precision Timing? Sleep(1)=15 millisecs !! Pin
Zac Howland31-May-06 9:23
Zac Howland31-May-06 9:23 
QuestionThreads Pin
Anthony988731-May-06 8:56
Anthony988731-May-06 8:56 
AnswerRe: Threads Pin
valikac31-May-06 10:04
valikac31-May-06 10:04 
GeneralRe: Threads Pin
Anthony988731-May-06 14:42
Anthony988731-May-06 14:42 
GeneralRe: Threads Pin
valikac31-May-06 14:46
valikac31-May-06 14:46 
QuestionGetting screen coordinated from a window [modified] Pin
Ista31-May-06 8:50
Ista31-May-06 8:50 
QuestionRe: Getting screen coordinated from a window [modified] Pin
David Crow31-May-06 9:13
David Crow31-May-06 9:13 
AnswerRe: Getting screen coordinated from a window [modified] Pin
Ista31-May-06 9:18
Ista31-May-06 9:18 
heres what i have. and yes its ugly.

( this is c# callung user32.dll ) I asked in here, think the C++ gurus would have an easier time with this.

RECT myRect2 = new RECT();
GetWindowRect(hwnd, out myRect2);

int posx = (myRect2.right - myRect2.left) / 2;
int posy = (myRect2.bottom - myRect2.top) / 2;
MOUSEINPUT mi = new MOUSEINPUT();
mi.dx = posx + myRect2.left;
mi.dy = posy + myRect2.top;
mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
mi.mouseData = INPUT_MOUSE;

int cb = Marshal.SizeOf(mi);

SendInput(INPUT_MOUSE, ref mi, cb);

This window is a button I have created in another application.

SO what I want is to click the left button of the mouse anywhere in the button.

But when I run it, I don't think its working because the button event isn't firing. Although if I use PostMessage, it works fine.

I think im just getting coords relative to the window and not the screen.

Please help.
Thanks, Nick

1 line of code equals many bugs. So don't write any!!

-- modified at 15:21 Wednesday 31st May, 2006
GeneralRe: Getting screen coordinated from a window [modified] Pin
Zac Howland31-May-06 10:01
Zac Howland31-May-06 10:01 
QuestionArray of images [modified] Pin
sclore31-May-06 8:35
sclore31-May-06 8:35 
Questionhow to connect to a database like postgresql or mysql? Pin
ThinkingPrometheus31-May-06 8:00
ThinkingPrometheus31-May-06 8:00 
AnswerRe: how to connect to a database like postgresql or mysql? Pin
David Crow31-May-06 8:38
David Crow31-May-06 8:38 
GeneralRe: how to connect to a database like postgresql or mysql? Pin
ThinkingPrometheus31-May-06 8:58
ThinkingPrometheus31-May-06 8:58 
GeneralRe: how to connect to a database like postgresql or mysql? Pin
David Crow31-May-06 9:09
David Crow31-May-06 9:09 
AnswerRe: how to connect to a database like postgresql or mysql? Pin
Eric Dahlvang31-May-06 10:11
Eric Dahlvang31-May-06 10:11 
AnswerRe: how to connect to a database like postgresql or mysql? Pin
markkuk31-May-06 12:54
markkuk31-May-06 12:54 
GeneralPOP3 SERVER [modified] Pin
hahayk31-May-06 7:05
hahayk31-May-06 7:05 
AnswerRe: POP3 SERVER Pin
leppie31-May-06 7:13
leppie31-May-06 7:13 
GeneralRe: POP3 SERVER Pin
Nish Nishant31-May-06 7:16
sitebuilderNish Nishant31-May-06 7:16 
GeneralRe: POP3 SERVER Pin
ThatsAlok31-May-06 22:16
ThatsAlok31-May-06 22:16 
GeneralRe: POP3 SERVER Pin
toxcct31-May-06 7:16
toxcct31-May-06 7:16 
GeneralRe: POP3 SERVER Pin
Nish Nishant31-May-06 7:22
sitebuilderNish Nishant31-May-06 7:22 
GeneralRe: POP3 SERVER Pin
Zac Howland31-May-06 7:23
Zac Howland31-May-06 7:23 
GeneralRe: POP3 SERVER Pin
Jon Sagara31-May-06 7:33
Jon Sagara31-May-06 7:33 
GeneralRe: POP3 SERVER Pin
S Douglas31-May-06 7:40
professionalS Douglas31-May-06 7:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.