Click here to Skip to main content
13,357,380 members (64,972 online)
Click here to Skip to main content
Add your own
alternative version


126 bookmarked
Posted 15 Jul 2003

Embeddable script editor for MFC applications

, 15 Jul 2003
Rate this:
Please Sign up or sign in to vote.
A library that allows you to embed scripting functionality to your C++ MFC application.

Objects Events Listing

Sample screenshot

Pop-Up Object properties and methods list

Sample screenshot

IntelliSense - like function parameters tooltips


I've been searching the net for a suitable and affordable solution that will allow me to embed scripting functionality in my C++ application. What I found was either not sufficient or cost a lot of money.

So I've decided to make one of my own. After about a month of work and testing I've come up with this embeddable scripter.

I made it a separate DLL , which is really easy to use.


  1. Download the source code, and compile it. Make sure to compile the correct version (Debug\Release) or both.
  2. Include ScriptEditor.h in your project and add the library ScriptEditor.lib to your additional libraries. Make sure to reference the correct version! Debug version for debugging and release version for release!
  3. Copy the DLL to the same folder as your executable.
  4. In your code create an instance of CScripter and initialize it.
  5. Add your objects to the script and optionally the script text.


In the header of your main application window add:

#include "..\ScriptEditor\Scripter.h"

Add member variable:

CScripter scripter;

Then when initializing add:


After that add your objects to the script:

scripter.AddObject("MPlayer",(IDispatch *)m_mediaPlayer.GetControlUnknown());
      (IDispatch *)m_commandButton.GetControlUnknown());
scripter.AddObject("TabStrip",(IDispatch *)m_tabStrip.GetControlUnknown());

And optionally set the script text:

scripter.scriptText = "MsgBox \"Test message\"";

After that the script is ready to run, you now may do one of the following:

// Run the script

// Stop the script execution


// Open the script editor window


// Reset the script (All added objects are removed and engine is recreated)



This is the first release so it's probably not bug free. I've done my best to track any bugs but there are always surprises. So I will post here any additions, patches and fixes that will follow.

  • 19/07/03 - The DLL source was updated to compile in VS.NET (read the messages below)


  • Gil Eizenburg for debugging and testing.
  • Smaller Animals Software, Inc. for ColorEditWnd class.
  • Daniel Madden for CTokenEx class.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Alex Hazanov
Software Developer (Senior) RDV Systems
Israel Israel
No Biography provided

You may also be interested in...


Comments and Discussions

AnswerRe: And what about Lua ? Pin
Alex Hazanov19-Feb-05 7:47
memberAlex Hazanov19-Feb-05 7:47 
GeneralBUG? Pin
cnmusic1-Aug-04 0:41
membercnmusic1-Aug-04 0:41 
GeneralProblem w/ events Pin
De Nardis Andrea20-Jul-04 1:01
memberDe Nardis Andrea20-Jul-04 1:01 
GeneralRe: Problem w/ events Pin
Alex Hazanov19-Feb-05 7:40
memberAlex Hazanov19-Feb-05 7:40 
GeneralRe: Problem w/ events Pin
De Nardis Andrea20-Feb-05 22:31
memberDe Nardis Andrea20-Feb-05 22:31 
GeneralRe: Problem w/ events Pin
Alex Hazanov21-Feb-05 1:06
memberAlex Hazanov21-Feb-05 1:06 
GeneralDebug assertion failed in debug version! Pin
TLFLY8-Apr-04 0:32
memberTLFLY8-Apr-04 0:32 
QuestionBuilds on VC 7.1? Pin
gofootn25-Feb-04 13:59
membergofootn25-Feb-04 13:59 
Are you able to build this on VC 7.1?

I get errors trying to build the demo app:
d:\code\scripttest\simpleobject.cpp(80) : error C2039: 'GetThisEventMap' : is not a member of 'CCmdTargetPlus'
d:\code\scripttest\cmdtargetplus.h(11) : see declaration of 'CCmdTargetPlus'

It seems to think the simple object is being built with _AFXDLL defined.

The dll itself builds fine.

AnswerRe: Builds on VC 7.1? Pin
touch_me_20207-Nov-04 22:06
membertouch_me_20207-Nov-04 22:06 
GeneralRe: Builds on VC 7.1? Pin
Alex Hazanov7-Nov-04 22:11
memberAlex Hazanov7-Nov-04 22:11 
AnswerRe: Builds on VC 7.1? Pin
Kim, YongChull13-Jul-05 17:37
memberKim, YongChull13-Jul-05 17:37 
AnswerRe: Builds on VC 7.1? Pin
Adrian Savage30-Aug-06 6:39
memberAdrian Savage30-Aug-06 6:39 
Questionhow can I use wscripter? Pin
daveice22-Feb-04 17:36
memberdaveice22-Feb-04 17:36 
AnswerRe: how can I use wscripter? Pin
Alex Hazanov23-Feb-04 21:30
memberAlex Hazanov23-Feb-04 21:30 
GeneralImplemation of IActiveDeubg Pin
daveice11-Jan-04 16:36
memberdaveice11-Jan-04 16:36 
GeneralRe: Implemation of IActiveDeubg Pin
Alex Hazanov15-Jan-04 0:16
memberAlex Hazanov15-Jan-04 0:16 
GeneralRe: Implemation of IActiveDeubg Pin
daveice16-Jan-04 15:50
memberdaveice16-Jan-04 15:50 
GeneralRe: Implemation of IActiveDeubg Pin
daveice16-Jan-04 16:06
memberdaveice16-Jan-04 16:06 
GeneralRe: Implemation of IActiveDeubg Pin
Alex Hazanov19-Jan-04 0:17
memberAlex Hazanov19-Jan-04 0:17 
GeneralQuestion about AddObject() Pin
J.G. Hattingh24-Dec-03 1:14
memberJ.G. Hattingh24-Dec-03 1:14 
GeneralRe: Question about AddObject() Pin
Alex Hazanov24-Dec-03 6:42
memberAlex Hazanov24-Dec-03 6:42 
GeneralRe: Question about AddObject() Pin
Jason Hattingh24-Dec-03 6:47
memberJason Hattingh24-Dec-03 6:47 
GeneralI would value this very much: Pin
J.G. Hattingh23-Dec-03 10:20
memberJ.G. Hattingh23-Dec-03 10:20 
GeneralI get "Permission Denied" error Pin
J.G. Hattingh23-Dec-03 7:25
memberJ.G. Hattingh23-Dec-03 7:25 
GeneralRe: I get "Permission Denied" error Pin
Alex Hazanov23-Dec-03 13:12
memberAlex Hazanov23-Dec-03 13:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180111.1 | Last Updated 16 Jul 2003
Article Copyright 2003 by Alex Hazanov
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid