need to press some keys

when i start my computer i need to press ctrl+shift+alt+u to start a program.
how can i do this using a console c(or c++) program.
Read about the SendInput() function.
i tried to use SendInput() but my compiler says that
 
error: 'SendInput' was not declared in this scope


i included some header files windows.h, winuser.h but still i am getting this error.

am i missing something?

There are some tasks that C++ are perfect for, and there are others that are possible but will have you chasing your tail like a lost puppy. Your question falls into the later catagory. Instead of writing a program to press a bunch of keys, just create a startup entry.

If you want this application to start up when you log in then you'll drop the shortcut to the launcher in "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\". This will start the application for any user who logs into that PC.

EDIT: Sorry, this directory becomes "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" and is a hidden system folder in Windows 7.

If you want this to happen when the PC boots then you'll probably run into a few issues with application dependancies, also depending on what version of Windows you are running some methods are better then others. tl;dr I'll need more detail if this is what you are trying to do.
Last edited on
i know about that startup folder, msconfig and register entry thing i just want to learn how so send input commands without pressing any key using only a c or c++ console program.

and this is the task i want to do i want to create that program and put it on startup folder.

if you know about how to do things i mentioned above then please help me.

that SendInput() thing looks promising but i am facing some problem which i mentioned on my previous post.
You need #define _WIN32_WINNT 0x500 // or any other value higher than 403 before including windows.h
i defined that thing but still same error.
BTW compiler is now also giving me warning that _WIN32_WINNT is redefined.
What compiler do you use ? For sure it has a "prepocessor definitions" setting, define here _WIN32_WINNT, WIN32_WINNT, WINVER and _WINVER also as 0x0501 or higher.
i am using codeblocks and my OS is windows 7.

Go to Project/Build options/#defines and add the line _WIN32_WINNT=0x500 there.
Topic archived. No new replies allowed.