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

Re: tab function C++ beginner 80 80

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;
  return 0;

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

Re: tab function C++ beginner 80 80

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.

Re: tab function C++ beginner 80 80

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.

Re: tab function C++ beginner 80 80

what might be a possible google search to get around

Re: tab function C++ beginner 80 80

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.