Saving a file to the local disk in Silverlight

All user code in Silverlight runs in a sandbox. Hence, for security reasons, there are no APIs to directly open local files from disk. However, there is a OpenFileDialog class which allows a Silverlight app to open files on disk. Human intervention is required to interact with the dialog box. This ensures that the user…

7

Late-binding and ByRef parameters

VB, VBA, and VBScript pass arguments by reference by default. A subroutine definition can explicitly override the default by specifying that a parameter should be passed by value. This does raise two issues in the face of late-binding: How are arbitrary expressions passed by reference? The answer is that expressions which cannot be the target…

0

Oleview hangs on Vista when run from elevated cmd prompt

Oleview has been hanging and taking up all the CPU when I tried to open a typelib on a Vista machine. I saw http://support.microsoft.com/kb/176938 and tried to follow the recommended solution (regsvr32 iviewers.dll), but that did not fix it either. It turns out the solution is to run oleview from a non-elevated cmd prompt. For example,…

0

Using IReflect to expose a type as IDispatch to COM

The CLR supports marshalling of objects that support the IReflect interface as IDispatch COM objects. Similarly, IExpando gets marshalled as IDispatchEx. Here is a sample of a managed type called ManagedIDispatch which is used from VBScript and used in a late-bound way. VBScript just deals with IDispatch, and under the hoods, the CLR routes the…

4