|
I have two notepad windows,I want to replicate the behaviour of one window to another.Using hooks i trap the keyboard events of first notepad window and send these keystrokes to second window with keybd_event function,it is working fine.
Similarly I have trapped mouse events ,Probably you cannot use sendMessage or post but since hooks code is wriiten in Dll i can force second window to map the dll into its address space and then send messages.Please comment..
Second solution could probably be, as suggested by "argus" to use mouse_event and sendinput,I am working on it ,but currently unable to locate parameter for destination handle.
Thankyou for your concern
Vineet
|
|
|
|
|
Check in MSDN:
mouse_event
SendInput
Argus
|
|
|
|
|
I am opening a serial com port and writing huge packets. How do I know how many bytes can I write into the port when the other computer reading it?
is something like open()
write()
select()?
Anybody has a sample?
Thanks
Al
|
|
|
|
|
Do the select() before you write() . Something like
fdSerial = open(...);
fd_set wfds;
struct timeval tv;
memset(&tv, 0, sizeof(struct timeval));
FD_ZERO(&wfds);
FD_SET(fdSerial, &wfds);
int retval = select(1, NULL, &wfds, NULL, &tv);
if (retval) {
write(...);
}
|
|
|
|
|
Niklas,
Thanks, is any way to know how many characters can I write into the serial port without overwriting bytes?
Thanks again
Al
|
|
|
|
|
hey im pretty new to c++ and need some help.
is there any way to turn off the little blinking white cursor in the c++ console?
i need to turn it off for a game
thx
|
|
|
|
|
SetConsoleCursorInfo
Set the bVisible member of CONSOLE_CURSOR_INFO to false
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
alright thx for the reply, but do u think u can give me a little help on how to use it? i get a buncha errors, im probably putting it all in wrong
|
|
|
|
|
Ryan2845 wrote:
alright thx for the reply, but do u think u can give me a little help on how to use it? i get a buncha errors, im probably putting it all in wrong
Okay. I just put together a small program. The cursor did vanish
char abc[128];
int main(int argc, char* argv[])
{
HANDLE h;
h= CreateConsoleScreenBuffer(GENERIC_WRITE|GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,CONSOLE_TEXTMODE_BUFFER,NULL);
SetConsoleActiveScreenBuffer(h);
CONSOLE_CURSOR_INFO cci;
cci.dwSize = 90;
cci.bVisible=false;
SetConsoleCursorInfo(h,&cci);
cin >> abc;
return 0;
}
Hope this helps you,
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
hmm thats what im goin for but how can i get it to work in this sort of program:
i'm making sort of a space invaders style game, i have a loop that outputs a ship made from text <-0-> in an array, when i put that code u gave me in it doesn't show the ship, is there any way to get the ship to show and still have no cursor?
Is there maybe a way to just make the cursors color be black?
thx agian
|
|
|
|
|
Ryan2845 wrote:
when i put that code u gave me in it doesn't show the ship, is there any way to get the ship to show and still have no cursor?
I really don't think that hiding the cursor will rsult in the hiding of the ship too. I think the problem must be elsewhere.
Ryan2845 wrote:
Is there maybe a way to just make the cursors color be black?
The cursor is usually the same color as the forground text. I am not sure whether it's color can be changed.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
alright, ill keep messin with it, thx a million!
if u have the time/desire, i can email u the code.
|
|
|
|
|
Ryan2845 wrote:
alright, ill keep messin with it, thx a million!
Good luck Ryan
Ryan2845 wrote:
if u have the time/desire, i can email u the code.
Thanks, if you figure out what went wrong, lemme know too
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Hello,
I am using CDatabase from within a service. The CDatabase is used from within multiple worker threads. So far I haven't run into trouble, but I don't want to go ahead and then have to come back and debug my base code. Has anyone else used CDatabase in a multithreaded service program?
Regards
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
I have and you should be ok.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Tom Archer wrote:
I have and you should be ok.
Whew, that is a relief. I was getting a little apprehensive and the tension grew cause I got no replies even after a couple of hours.
Thanks Tom.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Well, isn't the MFC library thread safe altogether? Why CDatabase should be different?
Best regards,
Alexandru Savescu
|
|
|
|
|
Alexandru Savescu wrote:
Well, isn't the MFC library thread safe altogether?
Actually no! A good number of MFC classes are not thread safe
Glaring examples are CSocket and even CWnd. Try calling UpdateData on a CWnd derived class from a thread that didn't create the CWnd and you'll see how MFC is not thread-safe
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Well I do not know if calling UpdateData from another thread means that MFC is not thread-safe. The first thing you are told when writing multi threading apps is that you must not touch the GUI objects created by another thread.
Every thread has its message pump and all controls created by that thread receive notifications in that pump. Calling UpdateData from the second thread will post the messages in a different message pump (the second one) and your app will crash. This does not mean that MFC is not thread safe.
I don't know about CSocket though.
Best regards,
Alexandru Savescu
|
|
|
|
|
Sorry for such a lame question,
but I am creating a Modeless dialog from my CMainFrame class. The window is indeed modeless, but when I change the focus back to the main (parent), the modeless dialog remains on top.
How can I have my modeless dialog move to a lower level on the desktop whenever I change the focus to another window?
Thanks for answering my "common" question.
Humbly,
Johnny
|
|
|
|
|
make the modeless dialog's parent wnd NULL (ie. the desktop). that way, it can float anywhere it wants to.
-c
I don't care, and you can't make me.
|
|
|
|
|
This is because your dialog is a child of the frame window. Make it a child of the desktop.
This might also help:
http://www.codeproject.com/useritems/gettingmodeless.asp
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Or if you want to still make it a child of the Mainframe for some reason, you can in OnActivate check if it is being deactivated and just hide it at that point. This means that if you press the mouse outside the dialog box, it will hide.
|
|
|
|
|
Stan the man wrote:
This means that if you press the mouse outside the dialog box, it will hide.
This will mean that to bring it up again [make it visible], the user might have to be offered some button or menu item.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Very True. I guess I have always had a button to do this.
|
|
|
|