|
Alan Chambers wrote: I've also looked at GetKeyboardState(..) but that only retrieves the keyboard state in the thread that is handling the windows messages, so calling it from the main thread does not work (but calling it from the window thread does).
Not sure because I have not used this function much, but anyway MSDN says this...
The status does not change as keyboard messages are posted to the thread's message queue, nor does it change as keyboard messages are posted to or retrieved from message queues of other threads. (Exception: Threads that are connected through AttachThreadInput share the same keyboard state.)
Does that help?
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi thanks for the reply, but it doesn't really help me. I've read the MSDN articles pretty thoroughly and that function basically only works on threads which have created a window using CreateWindow or CreateWindowEx and have a message pump. Since I've created the window on a separate thread, GetKeyboardState() only actually works if it's called within that threads loop, but it won't work on another thread unless AttachThreadInput() is used to share the message processing. However, AttachThreadInput() cannot be attached from or to the system thread (which is the one i'm using for my app) and in any case it would need to be a thread that has created a window and uses a windows message pump as well, which it does not.
Looks like what I'm after is quite low-level, raw device state reading functionality but all I'm seeing is Windows event driven solutions. There's got to be a way to bypass all this windows guff and read directly from whatever hardware is present..surely..?
Cheers for trying tho
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
hi
iam doing a project where it has 2 different apps
1. bluetooth app
2. device driver app.
both in c++.
now can i implement a shared memeory concept in (c++) windows where both the process should access a single place for the data.
if possible how to do it.
|
|
|
|
|
manju23reddy wrote: shared memeory concepts
Actually, the jargon is IPC[^].
There are several ways mechanisms supported by windows to achieve IPC, one of which would be to use WM_COPYDATA[^]. Look up MSDN[^] for more details. You may also search for articles on individual topics at CP and Google. There are plenty of examples around.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
If you are trying to exchange data between a device driver and a windows application, then this article[^] will be helpful.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi all,
I have made a c# dll and i want to call that dll in my vc++ project.
I have copied my dll in debug folder and written these lines in my stdafx.h file
.\Debug\test.dll
using namespace test.lib
now when i am compiling my project its giving error
fatal error C1083: Cannot open type library file: '.\Debug\internet_connection.dll': Error loading type library/DLL.
How can i remove this?
tanks in advance
|
|
|
|
|
|
Hi friends
I havnt knowledge with Client-server program i want to get the server system date to display in the client side ..please help me
Thanks and regards
nisha
|
|
|
|
|
I dont think there is a direct function to get server time
So you have to implement a command to get time from the server.
User defined protocol.
modified on Thursday, August 28, 2008 7:37 AM
|
|
|
|
|
Use Winsock to establish connection between your client and server machine so that you can exchange data between then. Design the server application to get current date and send it to client as data. This winsock tutorial[^] will be helpful.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
Hi...i have a small problem and im finding difficult to figure proper algorithm for it, plse help me out.The probelm is explained below:
I have a data of a boundary formed by set of 3d(X,Y,Z) points in an array (each point has x,y,z cordinates) and I also have a new point data (x1,y1,z1).My problem is i have to find out if this new point falls with in the boundary of set of points.
I am not able to figure out proper logic for this.Can somebody help me out?
Plse do help me.
Thnx in advance.
|
|
|
|
|
raesa wrote: I have a data of a boundary formed by set of 3d(X,Y,Z) points in an array
Does it have any specific shape ? Because if not, this will probably be very difficult because if you have a 'random'cloud of points, it is quite impossible to make a boundary out of that.
|
|
|
|
|
Thnx for the reply.As you said these points are scattered all over the space and the boundary formed by these points might not be closed a one.i want to find out if my new point lies with in this point cloud or not.Is it possible?? Plse do help me out.
|
|
|
|
|
Well it depends a lot of your requirements. You can maybe simply check the min/max values for the X, Y and Z axis and so have a 3D rectangle which is the boundary of your points cloud. That should be easy to do (walk over all the points and take the min/max for the 3 dimensions). Then checking if a new point is inside that is quite easy.
But does that work with your requirement ? What do you need to do exactly ?
|
|
|
|
|
I thank you very much, once again.Well, i need to find out if my point lies inside or outside the boundary (or point cloud) formed by the availables set of points.
If i take the min/max of all the three dimesnsions(x,y&z) i might get 6 different points (3points for minimum values of x/y/z and 3 for maximum values of x/y/z), right?
Do you suggest me that i will have to compare and find out if my new point cordinates(x1, y1, z1) is either greater or less than the any of the (x,y,z)values of the 6 points? Which means that if any one value (either x1/y1/z1) is greater than the (x/y/z) of the 6 points, the new point lies outside the point cloud.
Plse do tell me if i my understanding of the method you suggested is right.
Thank You.
|
|
|
|
|
raesa wrote: If i take the min/max of all the three dimesnsions(x,y&z) i might get 6 different points (3points for minimum values of x/y/z and 3 for maximum values of x/y/z), right?
Do you suggest me that i will have to compare and find out if my new point cordinates(x1, y1, z1) is either greater or less than the any of the (x,y,z)values of the 6 points? Which means that if any one value (either x1/y1/z1) is greater than the (x/y/z) of the 6 points, the new point lies outside the point cloud.
What I understood, is that Cedric suggested to test if the point p(x,y,z) is in the bounding box of this set of points. And you do this by just comparing if((x>=XMIN)&&(x<=XMAX)&&(y>=YMIN)&&(y<=YMAX)&&(z>=ZMIN)&&(z<=ZMAX)) . So, if by the word "cloud" you mean bounding box, it's ok. If you mean "convex hull" it's a quite different problem. And although the 2d version of this problem is a common topic for an introductive to algorithms class, I don’t know much about the 3d case. Definitely this question belongs in an algorithms forum. Meanwhile search for “convex hull from set of 3d points”, and “point in convex hull of 3d points” algorithms.
my intuition: linear programming problem
modified on Thursday, August 28, 2008 1:56 PM
|
|
|
|
|
Thnx for the help.I'll check out the logic you suggested but i have doubt if it will work fine if the point is very close to the point cloud.Thnx anyways and i'll get back if i am stuck up somewhere.Thnx again.
|
|
|
|
|
My requirement is somewhat in following way
int nStartTime = GetCurrentTime();
// Call the required Function
Function();
int nEndTime = GetCurrentTime();
int nTimeTaken = nEndTime - nStartTime;
please provide som sample code if possible to fulfill above requirement.
i.e. how to get current time in integer domain.
|
|
|
|
|
kapardhi wrote: please provide som sample code if possible to fulfill above requirement.
i.e. how to get current time in integer domain.
Following functions are used frequently, ranked according to their importance...
QueryPerformanceCounter
GetTickCount
clock (haven't seen usage of this but anyway just for your information)
Does these[^] help?
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Use GetTickCount() instead of GetCurrentTime() .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi,
For Vista 64 we are using signed driver.
Before installing the driver we have to set the testsigning ON through command prompt.
for enabling the testsigning type the following command on cmd:
bcdedit.exe /set /TESTSIGNING ON and then restart the machine.
my concern is that if some one forgot this step and he is trying to install the driver then how could he know that TESTSIGNING is not ON.
Is there way in MFC through which we can get the status of TESTSIGNING.
Thanks
--Minakshi
Minakshi
|
|
|
|
|
Hi All
How can i call function with parameter in vc++.Function is BOOL CPopDlg::MoveFile(CString source, CString destination) And i want to call these function in
BOOL CTestDlg::OnInitDialog()<br />
{} .
Right now i am geting error..
error C2275: 'CString' : illegal use of this type as an expression<br />
1><br />
error C2146: syntax error : missing ')' before identifier 'source'<br />
error C2059: syntax error : ')'
Plz help me
|
|
|
|
|
you would need to pass a pointer of class CPopDlg in CTestDlg through some function and then call MoveFile.
If there is a parent child relationship between these two classes, you can use GetParent() to obtain a pointer to the parent and call functions of parents.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
What statement is the compiler complaining about?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|