Feeds:
Posts
Comments

 

Working on SharpStyle Neutron I very often need to open the Visual Studio IDE under as named experimental hive. MSDN describes the concept of Visual Studio Experimental Build in following way:


To safeguard Visual Studio from applications you develop that might change it, the Visual Studio SDK provides an experimental build of Visual Studio. You develop new applications by using Visual Studio as usual, but run them with the experimental build.

The experimental build is nothing more than Visual Studio with another registry hive called the experimental hive. Having two side-by-side registrations of Visual Studio helps protect your Visual Studio installation from any harm that the experimental software could cause.

To start Visual Studio by using the experimental registry hive, run the following command from the Visual Studio command prompt:

“<Visual_Studio_Install_Path>\Common7\IDE\devenv.exe” /RootSuffix Exp


As you can see every time I need to run the Visual Studio in experimental hive I have to execute the command above or use the shortcut located in Start -> Programs -> Visual Studio 2005 SDK -> 2007.02 -> Tools -> Start Visual Studio 2005 under Experimental hive.

One day I spent a lot of time to do such procedure many and many times. And the first improvement was an assigning the shortcut key for the shortcut.

Well, it works much better that going through the Start->Programs… every time. I used this solution but problem was not solved.

To open the solution in normal registry hive you can just double click on .sln file or select from context menu item ‘Open’ or item ‘Open With’ and then select the program you want the file be opened with. I prefer the last way because I often edit the files in different editors.

So the common case is following. I navigate to the folder where .sln file located, right click on it to open in… yes … in experimental build of Visual Studio! So now I have to press the CTRL+SHIFT+E to run the experimental build of Visual Studio and then I have to use File->Open and navigate to the folder I was again. Not very comfortable scenario.

I start thinking and have found the simple and going solution – add a new subitem  to ‘Send To’ context menu item. To add new command in ‘SendTo’ menu all of you need is to create the shortcut to command you want in this path:

C:\Documents and Settings\<Your_Account>\SendTo\

I just copied the shortcut from “Start -> Programs -> Visual Studio 2005 SDK -> <VSSDK_Version> -> Tools -> Start Visual Studio 2005 under Experimental hive” and renamed it to “Devenv Exp”. Now to open the solution in experimental hive I just right click on .sln file and select Send To -> Devenv Exp.

Enjoy!

 

~Dmitry

Advertisements

As I was preparing for tutorial of using SharpStyle Neutron to develop an ActionScript project and Windows Forms within one solution, I ran into the following issue: while there are a number of references on the web on how to use Flash OCX within Visual Studio 2003, there are only a handful of results related to Visual Studio 2005 and most of them document the problems that people are having.

Following the steps from this article (Macromedia – Developer Center Embedding Macromedia Flash Player in a C# Application) produce the following errors:

  • There is a popup stating that VS “Failed to import the ActiveX control.  Please ensure it is properly registered
  • If you examine Error List, under Warnings, you will see the following

Could not resolve dependent COM reference “stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.  

Failed to create the wrapper assembly for type library “AxShockwaveFlashObjects”. Exception of type ‘Microsoft.Build.Tasks.ComReferenceResolutionException’ was thrown.

The referenced component ‘AxShockwaveFlashObjects’ could not be found. Failed to create the wrapper assembly for type library “AxShockwaveFlashObjects”. Exception of type ‘Microsoft.Build.Tasks.ComReferenceResolutionException’ was thrown. 

I found the following Unable to add Flash 8 control in VS2005 – Tentative workaround blog post from 2005-12-07, but the instructions there didn’t work. After doing a few more searches I found the following forum page in French (translated page / original page)

Here is what needs to be done:

  • Open Visual Studio 2005 command prompt and execute the following:
    • aximp.exe -source “C:\WINDOWS\system32\Macromed\Flash\Flash9b.ocx”
  • This will generate the following files. Items in bold are the important ones:
    • AxShockwaveFlashObjects.dll
    • AxShockwaveFlashObjects.pdb
    • ShockwaveFlashObjects.dll
    • AxShockwaveFlashObjects.cs

  • In Visual Studio, add the references to the 2 dlls generated by aximp (I copied them from “C:\Program FIles\Microsoft Visual Studio 8\VC” to the root of the project): 

  • Add namespaces to the imports section

using AxShockwaveFlashObjects;
using ShockwaveFlashObjects;

  • And here is some sample code to display SWF
AxShockwaveFlash axShockwaveFlash = new AxShockwaveFlash();
axShockwaveFlash.Location = new System.Drawing.Point(50, 50);   

this.Controls.Add (axShockwaveFlash);
//this.Show(); // Avoids InvalidActiveXStateException.

axShockwaveFlash.Movie = "D:\\test.swf";
//* it is important to set Size after specifying Movie property
//* if Size is specified before, it is ignored
axShockwaveFlash.Size = new System.Drawing.Size(20, 20);
axShockwaveFlash.Play();
 
References:

~Mike

This tutorial will demonstrate how to setup a project in order to easily trace your code.

We will be using Powerflasher SOS.

Powerflasher SOS (SocketOutputServer) is an XML Socket server with a graphic user interface. Connected clients can send messages to SOS. These messages are shown in SOS. Further on commands from SOS to Client can be sent. These are freely configurable.

It requires JavaVM starting from 1.3: http://java.com/en/download/index.jsp

This tutorial will demonstrate the following steps:

  • Download and run Powerflasher SOS
  • Create new ActionScript Application
  • Write code that will allow our application to “trace” to Powerflasher SOS using XMLSocket
  • Specify additional compilation parameter: -trace “Main.myTrace”. Compiler will replace all “trace()” statements with a call to Main.myTrace which will send messages over XMLSocket to SOS
  • We will then add
    • new ActionScript Class
    • two SWF files that will serve as ON/OFF states
  • We will then show the following
    • Loading resources
    • MovieClip.onRollOver, MovieClip.onRollOut events

Source code is here.

Click the image below to launch:

 

Here is the code for your reference:

class Main
{
    private static var sock : XMLSocket;
    static function main()
    {
        Stage.align = "TL";
        Stage.scaleMode = "noScale";
        
        if (_root.enableTrace == "true")
        {
            enableTrace();
        }
        trace("main() called");
        var app : App = new App();
        app.Start();
    }
    private static function enableTrace() : Void
    {
        sock = new XMLSocket();
        sock.connect("localhost", 4444);
        trace("connected");
    }
    public static function myTrace(obj : Object, fullclass : String, file : String, line : Number) : Void
    {
        sock.send("msg: " + obj + " (class: " + fullclass + ", line: " + line + ")\n");
    }
}
 
 
class App
{
    public function App()
    {
        
    }
    public function Start() : Void
    {
        var button : MovieClip = _root.createEmptyMovieClip("button", _root.getNextHighestDepth());
        button._x = 20;
        button._y = 20;
        
        var imageOn : MovieClip = button.createEmptyMovieClip("imageOn", button.getNextHighestDepth());
        imageOn.loadMovie("smiley_happy.swf");
        
        var imageOff : MovieClip = button.createEmptyMovieClip("imageOff", button.getNextHighestDepth());
        imageOff.loadMovie("smiley_sad.swf");
        
        button.onRollOver = function()
        {
            trace("");
            this.imageOff._visible = false;
        }
        
        button.onRollOut = function()
        {
            trace("");
            this.imageOff._visible = true;
        }
    }
}

~Mike

This tutorial will demonstrate how to create “resources” SWF that might contain required UI elements and then load them into your ActionScript application.

This tutorial will demonstrate the following steps:

  • Create new Flash Document using Macromedia Flash Professional 8
  • Create new Movie Clip (Linkage: Export for ActionScript, Export in first frame)

  • Add an image and create a simple motion tween
  • Publish to produce SWF
  • Create new ActionScript Application
  • Specify “input SWF” pointing to the produced SWF
  • Show code required to load needed Movie Clip

Source code is here.

Click image below to launch:

Clearing Visual Studio recent projects list

Clearing Flash 8 Recent Items list

This tutorial will build upon our previous “Hello World ActionScript Application” tutorial.

A few concepts:

  • Please review our previous post for information about swfobject.js and _SwfHtmlTemplate.htm: Files included in default project (Neutron)
  • You might also find the following post useful: SharpStyle Neutron Project Properties
  • This tutorial starts with an existing ActionScript project
  • We will add to the solution an ASP.NET Web Application
  • We will then configure “output path” of the ActionScript project to output compiled SWF into a subfolder of the Web Application
  • We will copy necessary HTML code from _SwfHtmlTemplate.htm into Default.aspx. This will allow us to display SWF

Source files are here.

Click the image below to launch:

 

~Mike

AjaxWorld 2007

We attended AjaxWorld 2007 in NY. You can find our posts here:

~Mike