Click here to Skip to main content
15,885,546 members
Articles / Desktop Programming / MFC

Brainchild, A syntax coloring edit control

Rate me:
Please Sign up or sign in to vote.
4.85/5 (64 votes)
16 Jun 2005CPOL5 min read 704.6K   26.8K   263  
Syntax coloring, multi-level undo/redo editor control.
//-- Script 1
var winObj = FindWindow("", "Calculator");
if (winObj)
{
  //Display( winObj.GetText() + " was Found!" );
  winObj.SetForeground();
  winObj.SetFocus();
  var winBtn = winObj.FindChild("", "9");
  if (winBtn)
  {
    //Display( winBtn.GetText() + " was Found!" );
    winBtn.MouseHover();
    winBtn = null;
    winBtn = winObj.FindChild("", "0");
    winBtn.MouseHover();
  }
  winObj.MouseLClick(15, 51, true);
}
else
  Display( "Calculator was not found...");


//-- Script 2
var winObj = FindWindow("", "Calculator");
var ncount = 5;
if (winObj)
{
while ( ncount > 0)
{
  winObj.SetForeground();
  winObj.SetFocus();
  var winCE = winObj.FindChild("", "CE");
  var winEQ = winObj.FindChild("", "=");
  var winAdd = winObj.FindChild("", "+");
  var win0 = winObj.FindChild("", "0");
  var win1 = winObj.FindChild("", "1");
  var win2 = winObj.FindChild("", "2");
  var win3 = winObj.FindChild("", "3");
  var win4 = winObj.FindChild("", "4");
  var win5 = winObj.FindChild("", "5");
  var win6 = winObj.FindChild("", "6");
  var win7 = winObj.FindChild("", "7");
  var win8 = winObj.FindChild("", "8");
  var win9 = winObj.FindChild("", "9");

  winCE.MouseLClick(10, 10, true);
  win1.MouseLClick(10, 10, true); // 1
  win0.MouseLClick(10, 10, true); // 0
  winAdd.MouseLClick(10, 10, true); // +
  win9.MouseLClick(10, 10, true); // 9
  win5.MouseLClick(10, 10, true); // 5
  winEQ.MouseLClick(10, 10, true);
  ncount--;
}
}
else
  Display( "Calculator was not found...");


// script 3
var winObj = FindWindow("", "Calculator");
if (winObj)
{
  //Display( winObj.GetText() + " was Found!" );
  winObj.SetForeground();
  winObj.SetFocus();
  winObj.MouseLClick(430, 120, true);
  SendKeys("(120+230)-50=");
}


// script 4
var winObj = FindWindow("Notepad", "Untitled - Notepad");
if (winObj)
{
  winObj.SetForeground();
  winObj.SetFocus();
  SendKey(0x74); // F5
  SendKeys("Ernest Laurentin\r");
  SendKeys("1234567890-=\r");
  SendKeys("!@#$%^&*()_+\r");
  SendKeys("abcdefghijklmnopqrstuvwxyz\r");
  SendKeys("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r");
}
else
  Display("Untitled - Notepad window was not found...");

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer (Senior)
Netherlands Netherlands
I have been programming for a hobby since 1985. I have started programming on the C= 64. After that I migrated to the C= Amiga which I traded in for a PC back in 1997 I believe. Back in 2000 I decided to lose a hobby and start developing software for a living.

Currently I am working mainly in developing software for building security and access control systems.

Comments and Discussions