One of the best features of Windows is the ability to Cut and Paste data within an application or from one application to another.  

 

You can alt-tab or click on the task bar to switch between actively running applications, like Word and Visual Studio. When you hit Alt-Tab, a window comes up.

 

This Task switcher window, by default has 3 rows of 7 icons. If you have more than 21 top level windows open, that dialog gets confusing.

 

Without tabbed browsing a few years ago (the ability of Internet Explorer to open multiple Tabs to view multiple web pages in a single top level IE Window), I had tons of these windows.  (Try Window Key Tab to switch applications on any machine with Aero enabled!)

 

(see also Create your own Flip Task Bar with live thumbnails using Vista Desktop Window Manager DWM and The VB version of the Flip Task Bar for Vista Desktop Window Manager)

 

In fact, sometimes I run so many I get confused when I Alt-Tab and see the behavior of the default 21 (3 row by 7 column) icon display. So, I just modify this to be 5 rows by 9 columns.

 

Open RegEdit and change these keys:

 

HKEY_CURRENT_USER\Control Panel\Desktop\CoolSwitchRows

HKEY_CURRENT_USER\Control Panel\Desktop\CoolSwitchColumns

 

See also CoolSwitchRows:  http://technet.microsoft.com/en-us/library/cc978607.aspx

 

 

In the old days (the late 70's to early 80's, when a 5 Meg hard disk was cool!), you could only run one application on your computer at a time. To transfer data from one program to another, you would open one application, save the information temporarily to a file on (floppy) disk, then open the other application, import the temporary file.

 

Then along came Borland's Sidekick and AutoDesq DesqView.  I think Sidekick had a way of storing text data: it was a TSR: a Terminate and Stay Resident program. That means it was always available even if you were running another application. Once you start it, it would “terminate” but still be running. It would always be in memory, reducing the memory available to other programs.

 

I remember writing various TSRs. One was a simple program that could flash on the screen any message at any time interval and duration:

 

                                Flashmsg  /m:"You're getting hungry" /t:200 /d:1

 

Another would monitor key strokes. Every 100th keystroke it could double a keystroke, substitute another, record, or suppress one.  I didn't circulate these evil programs. (do you believe me? J)

 

A more useful one came about because a fellow ice hockey teammate and client heard I knew something about computers and wanted his business's Contact List to be instantly available at any time. So I wrote a TSR that would display a simple database of names and phone numbers around 1982. Over the years, I migrated the database maintenance to FoxBase and eventually FoxPro (1990?). So while the client was using WordPerfect, he could hit a key combination to bring up his Contact List instantly.

 

A TSR can monitor various interrupts, such as the keyboard,  by just replacing the interrupt vector with its own. The interrupt vector was just a pointer to the code to run if the keyboard is hit. My TSR would just forward most requests to the original ISR (Interrupt Service Routine). Back in those DOS days, it was easy to replace system memory. “Protected mode” was unheard of.

 

DesqView was another TSR, but it allowed you to run multiple applications "simultaneously". If I remember right, it "paged" out one app for another, writing to disk the 256K that one was using for the other. This was an immense boost in productivity.

 

In those days, I was using a really great text editor called PC-Write (one of the first "shareware" programs)  from Bob Wallace (Microsoft Employee #9). (It was around this time that dBase, FoxBase were born.)

 

 

When Windows 3.1 came out around the early 90's, you could use OLE (Object Linking and Embedding, which sort of got renamed to ActiveX later) and DDE (Dynamic Data Exchange) to have applications communicate with each other. The big demo was a Word Document or Fox database embedding an Excel spreadsheet or a photograph.

 

You can still embed a photo or spreadsheet in Foxpro using a General field (on XP, Vista and Windows Server08 R2(which is Win7 under the hood)):

 

CREATE CURSOR temp (name c(10), gen g)

INSERT INTO temp (name) VALUES ("Photo")

APPEND GENERAL gen FROM d:\kids.jpg

MODIFY GENERAL gen

INSERT INTO temp (name) VALUES ("Excel")

APPEND GENERAL gen FROM d:\2008.07.xlsx

BROWSE

 

You can double click the image or Excel spreadsheet to see or edit it within Fox. You can also use the Edit->Insert Special menu to insert other kinds of objects.

 

For fun, try this:  

      x=DDEINITIATE("visualfoxpro","")

or

      _cliptext="This text goes on the clipboard"

 

Or notice the intellisense when you try this from the Fox Command window

x=CREATEOBJECT("Excel.Application")

x.Visible=1

x.Workbooks.Add

x.Cells(1,1).Value="Hi"

 

 

Try starting Visual Studio and choose File->Open->File-> navigate to a photo or spreadsheet!

 

Create or open an existing VB project which has no build errors and then

       Dim x=CREATEOBJECT("Excel.Application")

       Stop

 

F5 to hit the breakpoint, Debug->Window->Immediate to open the immediate window.

 

Then resize VS so you can see Excel,  type

x.Visible=1

x.Workbooks.Add

x.Cells(1,1).Value="Hi"

 

 

 

Try something similar in C# (add a reference to Microsoft.VisualBasic.Dll)

 

            Object x = Microsoft.VisualBasic.Interaction.CreateObject("excel.application","");

            var z = "Put a bpt here";