Tuesday, March 07, 2006

I ran across an interesting KB article today.  I had never seen the "::" notation in JavaScript before, but here it is:

function ctrl::ClickEvent(a,b)
{
   alert("MyWindowControl_ClickEvent");
}

This function will handle the "ClickEvent" .NET event that is exposed to script through an object tag:

    <OBJECT id="ctrl" classid="YourDllName.dll#ActiveXSourcing.MyWindowControl">
    </OBJECT>

For more, read KB313891

Tuesday, March 07, 2006 5:35:44 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
 Monday, March 06, 2006

Note to self:  the January 2006 release of the MSDN library does not contain VS 2005 documentation.  You have to install "MSDN Library for Visual Studio 2005"!

Monday, March 06, 2006 11:21:36 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [1]  | 
 Thursday, January 19, 2006

David Hayden recently blogged about Asymmetric Accessor Accessibility in the CLR 2.0 version of C# and VB.NETIf you're not sure what it is, go read his post - it does a great job of explaining it.  Just glace at his first example and you'll know exactly what it is.  Anyway, this feature specifically caught my attention because (a) I had not heard of it before and (b) I just had a need for it yesterday but had no idea that it was possible in any language.  Unfortunately, we have not yet had the chance to convert our 1.1 code to 2.0, so it may be a while before I can get my hands on this functionality.

So in the interim, what's the next best solution?  I went with a public read-only property and a protected "setter" method.  What other ways could this be done?  Please comment!

    Private _busy As Boolean = False

    Public ReadOnly Property Busy() As Boolean

        Get

            Return _busy

        End Get

    End Property

    Protected Sub SetBusy(ByVal busy As Boolean)

        If busy <> _busy Then

            _busy = busy

            OnBusyChanged(EventArgs.Empty)

        End If

    End Sub

I would have preferred that the getter and the setter have the same name and be a part of the same property, but I guess I'll have to wait for 2.0 for that.

Thursday, January 19, 2006 3:56:54 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [3]  | 
 Tuesday, January 17, 2006

I recently setup my laptop to play with Avalon (yeah, yeah, "WPF" I know.)  It turned out to be a little more work than I would have liked.  Hopefully the following outline will make your life a little easier when you try to install it (or mine if I need to do it again.)

Step 0

Clean off old versions of WinFX/SDK CTPs using the directions provided on this page.  Note: Read the directions!

Step 1

Go the Windows Vista and WinFX Beta Page and read the intro... yes read the intro.  It is actually helpful (I must confess that I tend to "scan" - read "skip" - introductory and instructional content; this is a bad idea when installing beta software.)

Step 2

Download (2.4 MB) and install the WinFX Runtime Components (December CTP).  This enables the .NET framework to run WinFX "stuff" (Avalon, Indigo, Workflow.)  If all you want to do is run WinFX apps, you're done after this step.

Step 3

Download (1.1 GB) and install the Windows SDK (December CTP).  This installs, among other necessisary things, XAML Pad.

Notes:
Don't let the *.img extension fool you.  Treat it like it's an *.iso.  Also, notice that is says in the instructions that you "might be able to use the Virtual CD-ROM Control Panel for Windows XP."  Several people have reported trouble with this (I guess Microsoft wanted to make good on their use of "might".)  Using Daemon Tools seems to have fixed the problem for most.  Alternatively, you can burn the image to disk.

I actually ran into a problem even while using Daemon tools.  After using the command "msiexec /package WinSDK-x86.msi /quiet /lv c:\out.log" in the "E:\Setup" folder (via a forum posting) and examining the install log, I found that the installer was having trouble extracting one of the files from the downloaded archive.  I tried re-downloading the file and was finally able to complete the install... fifth try's a charm, right?

Step 4

Download (3.5 MB) and install the Visual Studio 2005 Extensions for WinFX.  This is what allows you to build WinFX applications, write XAML, and edit Avalon forms inside Visual Studio 2005.

All done!  Enjoy the bits!

Wednesday, January 18, 2006 6:10:48 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [2]  | 
 Monday, January 16, 2006
Many times when using the WebBrowser control, you may want to get the underlying cached file instead of using "document.innerHTML". Using this technique avoids the HTML/JavaScript markup that IE injects into the XML file for display. The key to doing this is using the function called GetUrlCacheEntryInfo. Following is how you would call it from managed code. [UPDATE] Using the cached file may be the best way in some cases, but another alternative is to access the "XMLDocument" expando property that IE attaches to the document element when browsing to XML documents. Read the "Straight to XML" section this MSDN page for more details.
Monday, January 16, 2006 7:52:14 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |