Sunday, April 18, 2010

Is Silverlight 4 able to call Win32 API functions when running Out of Browser (OOB)?

With the new relaxed security model of Silverlight 4, I was curious if  would finally be possible for Silverlight to directly call Win32 API functions, particularly when running out of browser.  You could argue that it shouldn’t, as an application with such capabilities could certainly invoke unwanted behavior.  But regardless of whether it would be a good thing or not, I was still curious if it could.

After much testing it appears the answer is no. I get an error like the following when attempting to access various Win32 API functions out of browser, even after signing the assembly.

“Attempt by security transparent method 'Button1Click' to call native code through method 'Win32APIMethod' failed. Methods must be security critical or security safe-critical to call native code.”

It may be possible to use the new COM Interop capability to access these functions indirectly, but I have not tested that.

If you have any more information on this, or can show it working by providing an example, I would greatly appreciate your comments.

Hope this helps.

Joe Kunk
Microsoft MVP Visual Basic
Okemos, MI USA

Visual Studio 2010 Keyboard Shortcut posters available

The VS 2010 Keyboard Shortcut posters are now available for download. Lisa Feigenbaum has posted the download info here:

http://blogs.msdn.com/lisa/archive/2010/04/16/vs-2010-keyboard-shortcut-posters-now-available-for-vb-c-f-c.aspx

 

Hope that helps.

Joe Kunk
Microsoft MVP Visual Basic
Okemos, MI USA

Friday, April 02, 2010

Co-authoring the "On VB" column in Visual Studio Magazine

 

I am very pleased to announce that I have just signed on to be one of the authors of the "On VB" column in Visual Studio Magazine.  My first print article is currently scheduled to appear in the June issue.  One or more web-only articles may appear as early as May.

I have been using Visual Basic since its initial release many years ago, and DOS versions of BASIC well before that.  I am very excited to have the opportunity to make a contribution to the success of the Visual Basic language and to those that use it to develop great applications, be they personal or professional applications.

I want to thank Bill Wagner of SRT Solutions and co-author of the C# Corner column for his recommendation to join the Visual Studio Magazine writing team.  I also want to thank Michael Desmond, editor in chief of Visual Studio Magazine, for giving me this tremendous opportunity.

As Michael Desmond said when I accepted his invitation, "Game On!".

Joe Kunk
Microsoft MVP Visual Basic
Okemos, MI  USA