|
Hi all,
I want to write a little tool which reads some characters from the serial port
and puts them directly into the keyboard buffer, so that they appear in the
currently active application at the current cursor position.
Handling of the seral port isn't a problem, but can anyone give me a hint how
to emulate a keystroke from within a program (C/C++, WinXp)
Thanks!
Reinhard
|
|
|
|
|
|
You can use the SendInput function for that purpose but I don't think this is a great idea. What kind of application are you using ? Console app or windows app ?
In both cases this won't work as expected. In the console app, you can only see text appear if the program reaqire some entry (cin for example) and for the window application, the control inside which you want to display the text needs to have the focus.
Why don't you choose an easier solution: read the data from the serial port yourself and print it yourself. It is much more simple !
|
|
|
|
|
What about:
SendMessage(hwnd, WM_CHAR, <char>, 0);
|
|
|
|
|
Hello,
This[^] will be helpfull.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Many thanks to all of you!!!
I've tried some of the hints and esp. the SendKeys object helped a lot.
You've saved my day...
Reinhard
|
|
|
|
|
reinhard_jd wrote: I've tried some of the hints and esp. the SendKeys object helped a lot.
you can try keybd_event Function tooo
"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
|
|
|
|
|
Anyone give me some hints or source code how capture video from usb device and get pixels values to memory.
9ine
|
|
|
|
|
You need to install DirectX SDK,
SDK includes a lot of Multimedia sample codes
There you can find video capture source codes with DirectShow
|
|
|
|
|
In the following code snippet which delete should I use??
char *ptr1=new char[100];
char arr[10]="abcdefghi";
strcpy(ptr1,arr);
//delete ptr1;
delete []ptr1;
Should I use delete ptr1; or delete []ptr1;
|
|
|
|
|
delete[]
but they get to the same place anyway..
|
|
|
|
|
__yb wrote: but they get to the same place anyway..
What do you mean by going to the same place ? If you mean that you can use one instead of the other, it's not true. Check this link[^]
|
|
|
|
|
They in fact do not. However, it is common for POD arrays to both compile down to a call to free. But you should never rely on that since it is implementation specific.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
u're right, its per implementation, I was refering to mine - VC6
|
|
|
|
|
delete[] because the memory has been allocated with new[].
The rule is simple: if memory is allocated with new[], then use delete[]. If memory is allocated with new, use delete.
|
|
|
|
|
if u r allocating an array of data
say
*ptr=new [100]
then go for delete[]
complier will know an array of data has to be deleted.Otherwise if u dont do this only the first block of data (depending upon data type say char only first byte in case of char will be deleted this memory leak!)
remember this combination
new-->delete
new[]-->delete[]
|
|
|
|
|
new ------> delete
new [] ---> delete[]
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hallo, I must copy/save every file my program find.
There are files from Access, Windows and so on...
SHFileOperation or other standard-Routines cant work so.
Have any an idea? Thanks.
|
|
|
|
|
I have h2200,i wish run ,my application at startup ,windows ce.
please help me.
|
|
|
|
|
doesn't Windows CE have a registry too ?!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
No,No.i wish use function cerunappatevent().
where do write this function?
|
|
|
|
|
Why Virtual constructors are not allowed in C++??
|
|
|
|
|
Because virtual constructor are simply useless ! When constructing an object, the compiler knows exactly which object it needs to create (as opposed to the destructors). Take the following example (CChild1 and CChild2 both derive from CBase):
CBase* pData = new CChild1;<br />
CBase* pData2 = new CChild2;<br />
delete pData;<br />
delete pData2;
If you look at the above example, when creating pData and pData2, the compiler knows explicitly the type of the object being created (new CChild1 or new CChild2). But when you delete the object, the compiler doesn't know it explicitly, thus requiring a virtual destructor.
|
|
|
|
|
Hello,
The virtual keyword is used to say to the compiler that a pointer to an object might be a pointer to the base class instead of the class that was instantiated. This way the code looks in a virtual function pointer table for the right function to call. Since this mechanism is used to determine which member function should be called for the instance of a class, constructors cannot be virtual, since they create instances of classes.
If virtual constructors would be allowed, I figure that it would never be possible to instantiate a class with a virtual constructor, once a class has been derived from it. This would be far from nice.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
powerful explaination bob
this worthes '5' !
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|