• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 497
  • Last Modified:

sendinput this:???? that i can`t send.........NEED HELP C/C++

hi,

i want to send the ? symbol....
but it does not work......
can someone please help me?

Thanx.
void Send_q()
{
INPUT *key;
 
key = new INPUT;
key->type = INPUT_KEYBOARD;
key->ki.wVk = 0x3f; //63;  // the ? symbol
key->ki.dwFlags = 0;
key->ki.time = 0;
key->ki.wScan = 0;
key->ki.dwExtraInfo = 0;
SendInput(1,key,sizeof(INPUT));
key->ki.dwExtraInfo = KEYEVENTF_KEYUP;
SendInput(1,key,sizeof(INPUT));
 
 
 
 
}

Open in new window

0
marco_coder
Asked:
marco_coder
  • 7
  • 3
  • 2
1 Solution
 
abelCommented:
The SendInput might not work on a Vista system because of the User Interface Privilege Isolation settings. If it fails as such, it will not raise an error, it just does nothing.

In all other cases, it should just send the keystrokes. What is the context wherein it is used? Is there a focus on a certain window or input element before you try this? And have you tried other characters besides the question mark? May the receiving function block certain characters, i.e., is it different if you just type the question mark?
0
 
thehagmanCommented:
1)  What does your call to SendInput return? (should be the number of events that it successfully inserted)

2)  I think the KEYEVENTF_KEYUP belongs into the dwFlags, not dwExtarInfo (?)

3)  Just to make sure, check the contents of windows.h if a corresponding VK_... for '?' is really defined using its ASCII code.
0
 
abelCommented:
Good points.

@thehagman: he uses the correct code. windows.h does not provide a constant for it, but it is the correct code regardless because in that range, the US-ASCII is equal to the code.

The dwFlags is well-noted. It should indeed go into dwFlags and not dwExtraInfo. I wonder if you do not have a corresponding KEY_DOWN event whether the receiving application will do something with it if it's only a KEYUP.

You can use GetLastError immediately after the call SendInput to find out whether any error is set.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
abelCommented:
Note that, if the dwFlags is zero, as in the first SendInput, it should mean a KEYDOWN event. The code above then effectively sends two KEYDOWN messages...
0
 
marco_coderAuthor Commented:
Its used to send query`s to google......
so i can submit more then 100,000 sites at once.....
sitemaps.............

only this gives me trouble......
the ? sign.

Thanx
0
 
abelCommented:
Thanks for clarifying. But we will have to delve deeper to find this problem. SendInput sends your question mark (if you want to be sure, send the question mark to another application or download and install an API viewer which can show you what API calls are being made).

Might the problem be on Google's side? The question mark has a specific meaning in the URL HTTP scheme. It starts the query string. If you do not escape it as "%3F" it cannot be used inside an URL (unless it starts the querypart, meaning, only one question mark allowed that does so). So, in short, if your string is part of Google's query string and contains a question mark, it has to be escaped, otherwise Google cannot process it.

If you still have problems, please explain in more detail what your code does, what the tool or program is it sends keystrokes to and what the reaction is when you do it by hand and when you do it through code, if necessary, with screenshots.
0
 
thehagmanCommented:
Alternative: In fact if you want to submit lots of pages within the same site, use the google sitemap API, i.e. in principle a textfie containing the page urls.
If you really want to submit lots of sites, I wonder why '?' would play a role in the starting anchor. Moreover, it seems likely that such a big bunch of sites might consist of many identical sites (e.g. domains with different spellings and same content); this is discouraged by google, i.e. will probably not lead to better ranking.
0
 
marco_coderAuthor Commented:
Well i have coded a nice php DYNAMIC database driven meta tag generator.
And my content: 7 million unique products.

And i use tor onion to change ip.
With setcoords i set my mouse at tor onion
right click, move down, left click
sleep 30 seconds...
then i execut cmd ping google.com >online.txt

if the network is up my string compare will find certain words....
then i can submit sites + sitemaps

Its just a part of a solution........ thats why i need to send the ? sign.
Then everything works.
Thanx.







0
 
abelCommented:
> thats why i need to send the ? sign.

though I don't see why that is necessary, esp. since Google has many APIs you can use transparently and since once they've received a sitemap, will automatically read it in almost daily, I'm not here to judge your approach. Have you read and tried what I said in my last comment? You didn't come back at it, so I assumed everything was fine: http://www.experts-exchange.com/Programming/Algorithms/Q_24166349.html?cid=238#23724348.
0
 
abelCommented:
That link didn't go well. Should be: #23724348
0
 
abelCommented:
Do note so far that your question was about the SendInput function. The SendInput function (win32 API) does not have any problem with the question mark, or any other key. So the problem must be elsewhere.
0
 
marco_coderAuthor Commented:
Lets explain again, i have a database with over 70.000 urls......
and i have a uniq databank of ip`s....

But for the submission software i wrote i need to send the ? sign.
Look at this code...
[code]
void Send_q()
{
INPUT *key;
 
key = new INPUT;
key->type = INPUT_KEYBOARD;
key->ki.wVk = 0x3f; //63;  // the ? symbol
key->ki.dwFlags = 0;
key->ki.time = 0;
key->ki.wScan = 0;
key->ki.dwExtraInfo = 0;
SendInput(1,key,sizeof(INPUT));
key->ki.dwExtraInfo = KEYEVENTF_KEYUP;
SendInput(1,key,sizeof(INPUT));
 
 
}
[/code]

I dont understand why it does not send the ?

Other letters no problem........
But ?  big problem.



0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 7
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now