Tracking Clipboard Paste

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 3
Reputation: perito is an unknown quantity at this point 
Solved Threads: 0
perito perito is offline Offline
Newbie Poster

Tracking Clipboard Paste

 
0
  #1
Jun 18th, 2008
ok here is exactly what Im trying to do,

I have to insert 10 strings in 10 different textboxes in the shortest possible time (half a second counts), so I thought the best way is to store them all in a program before the timer starts and then simply press TAB 10 times when the timer starts, and my application would paste them each in a separate text box...
so I want it to paste it on the old focused control then move to the other control ...
After help of some friends, I got this code
  1. #include <windows.h>
  2. #include <stdio.h>
  3. int WINAPI WinMain (HINSTANCE hThisInstance,
  4. HINSTANCE hPrevInstance,
  5. LPSTR lpszArgument,
  6. int nFunsterStil)
  7.  
  8. {
  9. HWND hWnd;
  10. for(;;)
  11. {
  12. MSG Msg;
  13. while(GetMessage(&Msg, NULL, 0, 0)){
  14. if(Msg.message == WM_KEYUP && Msg.wParam == VK_TAB){
  15. PostMessage(Msg.hwnd, WM_PASTE, 0, 0);
  16. printf("K\n"); //Never shows this == not entering the if statment ... why ?
  17. // you might need to try GetFocus() instead of Msg.hwnd
  18. }
  19. if(!IsDialogMessage(hWnd, &Msg)){
  20. TranslateMessage(&Msg);
  21. DispatchMessage(&Msg);
  22. }
  23. }
  24. }
  25. return 0;
  26. }
the code is never entering the If statment, even when I press TAB
I tried adding printf("test\n"); to check, it never shows

why is it not entering the If Statment ?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,363
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1464
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning

Re: Tracking Clipboard Paste

 
0
  #2
Jun 18th, 2008
printf() can not be used to display text in a MS-Windows GUI program because there is no console window. Depending on your compiler the simplest way to test it is to compile for debug then set a breakpoint on the printf() line. Another alternative is to create a console window then output text to it (see the console win32 api functions).
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 3
Reputation: perito is an unknown quantity at this point 
Solved Threads: 0
perito perito is offline Offline
Newbie Poster

Re: Tracking Clipboard Paste

 
0
  #3
Jun 19th, 2008
no only printf is not working, but PostMessage is also not working ...
do you have any idea why ?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,363
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1464
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning

Re: Tracking Clipboard Paste

 
0
  #4
Jun 19th, 2008
Is the code you posted only a tiny part of some much larger windows gui program ? According to the code you posted PostMessage() doesn't work because there is no window.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 978
Reputation: mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice 
Solved Threads: 208
mitrmkar mitrmkar is offline Offline
Posting Shark

Re: Tracking Clipboard Paste

 
0
  #5
Jun 20th, 2008
Post the complete code you have. If it is large, zip it and attach the zipped file.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 3
Reputation: perito is an unknown quantity at this point 
Solved Threads: 0
perito perito is offline Offline
Newbie Poster

Re: Tracking Clipboard Paste

 
0
  #6
Jun 20th, 2008
no, this is the code, and I need help completing it...
how can I make a window? and why do i need it,
I dont want to create any text box ... I want to capture the tab press where ever it is pressed (my case on a website running by firefox) and when the tab is pressed I want to paste the clipboard and move to the next text box...

how can I do this?
Last edited by perito; Jun 20th, 2008 at 10:44 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC