I am using VS2008, OS win vista. i am in the process of coding an application that would tab automatically (this is just an example, not the code i am intending to do).

So basically, what i expect is to write a C++ code that could press the 'tab' button twice from the code it it self. Can someone point me the correct google search terms or a tutorial to get familiar with these.

Thank you

Recommended Answers

All 5 Replies

What do you mean by "press the 'tab' button twice"?

If you want to use a tab to push console output to the right a few lines, use the '\t' escape character.

#include <iostream>

using namespace std;

int main() {
  cout << "\t\tThis output is tabbed over..." << endl;
  cout << "This output is not..." << endl;
  cin.get();
  return 0;
}

If you're trying to move through a GUI with the TAB, I'm afraid I can't help you.

No you got me wrong. For example. when we click the 'tab' button on the keyboard, it sets focus to the next tab index, right ?? so what i need to do is to enter these tabs from the code instead of using the keyboard to set focus to the next tab index.

hope i made it clear.

So you're trying to move around a GUI. As I mentioned before, I can't help you with that one... I don't do GUIs.

I know there is a way to set the default focus. Is that what you are trying to do is automatically set the focus? I believe you have to set the "tabstop" (or whatever the proper property name is) to 0 to make that the default focus. But that's all I can offer you.

what might be a possible google search to get around

I know there is a series of constants that can be used to identify the keys on the keyboard, you'll probably have to use one of those.

Try searching for "Windows Keyboard Codes" and similar. Then, if there is a way to send (rather than receive) the constant/code for a key, send the appropriate one for TAB.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.