Question:
For C++ Programmers that know about VBScript: Take a look at a previous Yahoo Answer's Question of mine below?
Joe WB
2011-09-17 18:36:30 UTC
and scroll all the way down to see the answer i got and let me know if you agree with the answer and how i would go about learning what the answer suggests...I'm new to C++ code so treat me as beginner. And let me know if implemented as the question and answer suggest, could C++ used in this way be better that VBScript and Windows Scripting Host..and if so How?..Pls cite as many Online Resources as possible as to your answer...
Thank You

Question:
Is there c++ code that can do what this vbs script does ....pls cite online resource?
which is open notepad and type some text -like can i just write a simple c++ program that could open a windows program and type text into it without the c++ program having a user interface of its own and can that c++ program activate itself when i press a hotkey because of code i incorporated into the program...pls don't tell me to get hotkey software...i'd like to learn to do it my self with c++...here is the vbs script code:Option Explicit
Dim wshShell
Dim intCount

'Open notepad
Set wshShell= CreateObject("WScript.Shell")
wshShell.Run "notepad"

'Wait a second before we do anything
WScript.sleep 1000

intCount=0

'Send the keys to notepad application
Do While intCount <= 10
wshShell.SendKeys "Line No: "
wshShell.SendKeys intCount
wshShell.SendKeys "{ENTER}"

intCount = intCount + 1
Loop

'Quit
WScript.Quit



Answer:
Yes you could write a c++ program to do that.
Yes it can be activated by a hot key but only if you write it as a windows service or some other terminate and stay resident (TSR) type application.
Three answers:
Shingetsu Kurai
2011-09-17 18:46:16 UTC
C++ can do everything VBscript can do... and more.



VBScript is actually pretty limited as a language.



btw the system function (in the NOCOMM region of windows.h) is quite usefull for external resources



example:



//code

#define NOCOMM //trim all that you dont need

#include //include system(string)

//...

system("notepad.exe");

// /code



will open a notepad as a seperate process.
arai
2016-11-09 05:33:25 UTC
i do no longer think of the customary of the programmers is the undertaking. this is the two the quantity of funds yahoo is waiting/in a position to pay, or perhaps there merely aren;t sufficient programmers around for all the artwork there is in the internet-field
mdigitale
2011-09-17 18:40:09 UTC
Of course C++ can do it. Look at the the Win32 API -- ShellExecute, SendKeys, etc.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...