Thursday, November 8, 2007

Pattern For Papoose Carrier

How to open files from the application

Hello

windows

Something interesting is the fact 2 clicks with the mouse on a file and this will open the corresponding program, the certainty it from our windows applications is quite easy, really boils down to a single line of code is:

Shell ( "rundll32.exe url.dll, FileProtocolHandler" & ( "c: \\ windows \\ system32 \\ calc.exe" ))

Shell ( "rundll32.exe url.dll, FileProtocolHandler" & ( "c: \\ Milibro. xls " ))

In the 2 examples above there were 2 cases the first to open the windows calculator and the second opens the excel and load it to the book by name MiLibro.xls

This code only have it be placed in a delegate and ready, such as the click event handler of a button as forexample.

Private Sub Button1_Click (ByVal sender As System.Object, ByVal and As System.EventArgs) Handles

Button1.Click Shell (

"rundll32.exe url.dll, FileProtocolHandler " & ( " c: \\ windows \\ system32 \\ calc.exe " ))

End Sub

Salu2
Sergio

0 comments:

Post a Comment