|
Robert Palma Jr. wrote: Is there any way to make precision timing,
or sleep with true resulution at 1 millisec
or smaller?
Sleep relinquishes the processor from the current thread for at least the time you give it. It does NOT mean that it will regain CPU time in 1 ms if you call Sleep(1); it does mean that you will not regain CPU time in less than 1 ms. You are basically telling the OS that you don't need to work for at least a certain amount of time so it can let someone else work.
Windows does have a high resolution timer, but it has been a while since I even bothered with it. Check out this book.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi,
I have a client application that is calling a method from an ActiveX control. Inside the ActiveX control I have a worker thread doing some additional processing. However, the ActiveX method that is called from the client application is blocking my worker thread. I need to verify a global value from the worker thread while inside that ActiveX method call? Any ideas on how to this?
Thanks
|
|
|
|
|
what inside activex is block thread?
Kuphryn
|
|
|
|
|
The ActiveX method is blocking the worker thread inside the ActiveX control!
|
|
|
|
|
control resides inside thread?
Kuphryn
|
|
|
|
|
Using spy++ I find a window.
But, I need to get the screen coords for the window so I can place a the mouse there. Can anyone tell me how or what API function I can use to get the actual screen coordinates of the window.
Please
this is what I currently have
RECT myRect2 = new RECT();
GetWindowRect(hwnd, out myRect2);
int posx = (myRect2.right - myRect2.left) / 2;
int posy = (myRect2.bottom - myRect2.top) / 2;
where hwnd is the handle of the wind returned from EnumChildWindows
Is this right or wrong? My SendInput doesn't appear to be working correctly.
1 line of code equals many bugs. So don't write any!!
-- modified at 14:50 Wednesday 31st May, 2006
|
|
|
|
|
Ista wrote: Is this right or wrong?
It's not the most efficient, nor is it syntactically correct. Try:
RECT myRect2;
GetWindowRect(hwnd, &myRect2);
Ista wrote: int posx = (myRect2.right - myRect2.left) / 2;
int posy = (myRect2.bottom - myRect2.top) / 2;
This finds the center of the window. Is this what you want?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
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
|
|
|
|
|
If you are just trying to cause the message handler for your button click to get called, just use Send/PostMessage with your window handle for the button (which you will still have to obtain, but you already have the app window handle, so it won't be too hard from there).
If you actually want to move the mouse there, try setting the focus to either the app or to the button before calling SendInput. You will also have to call SendInput 2 different times: once to move the mouse to the correct position and once to simulate the button press.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I'm trying to write a program with an interface similar to a disc defrag. It needs to show 10,000 boxs, 100x100 pixs each. The boxs will show a sequence of colors 1 at a time. I'm switching from VB6 to VC++ and I can't figure out how to create 10,000 images that I can access individually with a index. I'm so lost, can anyone help me?
Overwelmed++
-- modified at 15:49 Wednesday 31st May, 2006
|
|
|
|
|
hiho
cause i'm much more working on unix systems
i just don't know how i can connect and do some SQL statements to a database like postgresql or mysql?
for example, using linux i use libpq API with funktions like PQconnectdb or PQexec to connect or execute a query
but how does this work under windows?
can i use the same API on windows systems?
i'm sure there are many guys here who know how this stuff works, but since i work most time with linux i just have no idea on how to do database programming on windows
any articles or hints would be great
thx@ll
|
|
|
|
|
ThinkingPrometheus wrote: but how does this work under windows?
See here.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
that seems a good resource
but, just cause of interest:
is there only odbc on windows?
and for better understanding:
is odbc just a API which is able to "talk" to databases?
or can odbc do much more than just manage sql and its results? (i'm not sure about what i'm expecting, that's why i ask )
|
|
|
|
|
ThinkingPrometheus wrote: is there only odbc on windows?
No. See here.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
|
|
Hi, everybody
I need a POP3 server code in C or C++. Could you please suggest me where I can find such code?
Thanks in advance
-- modified at 14:33 Wednesday 31st May, 2006
|
|
|
|
|
hahayk wrote: Could you please suggest me where I can find such code?
In a file ending with .c or .cpp.
|
|
|
|
|
leppie wrote: In a file ending with .c or .cpp.
These days even .cs, .vb
Regards,
Nish
|
|
|
|
|
leppie wrote: In a file ending with .c or .cpp.
opps, i have seen same code in hpp file
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
|
Check sourceforge.net.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
Jon Sagara wrote: You tool.[^]
He has posted the same question twice in the lounge. Clearly he didn't suffer enough abuse the first time.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|