Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VBScript Win32
Is it possible to call a VBscript from within a Win32 executable
Posted 9-May-11 1:09am
Comments
Steven J Jowett at 9-May-11 6:39am
   
Yes it is possible. You would need to tell us what you trying to do and what language your problem is written in. Also be aware that x64 Windows operating systems do not support the embedding of VBScript into programs.
S Mewara at 9-May-11 6:57am
   
5!
Member 7873102 at 9-May-11 8:28am
   
I created a VBScript to move some of the files into a particular folder . I am trying to create a Win32 exe using C++ , so that whenever the user runs the exe , it will automatically call the script .
How do we call the VBScript within the exe .
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If your goal is moving around some files, writing some pure C++ code will be much easier. Even if your goal is making the code easy to configure, you can use some plug-in techniques. Well, you want to allow your user to modify the code of moving files and similar stuff, yes using some scripting may make some sense.
 
You need to invoke and use Windows Scripting Host (WSH). Please see http://en.wikipedia.org/wiki/Windows_Script_Host[^] and the references to MSDN with API and full documentation.
 
—SA
  Permalink  
Comments
Espen Harlinn at 9-May-11 15:47pm
   
Good answer, my 5 :)
SAKryukov at 9-May-11 20:36pm
   
Thank you, Espen.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You could execute your VBS source file using a system call
 
Example:
 
system("myfile.vbs");
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 9 May 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100