Thursday, December 30, 2010

Jenna Jameson Pierced Tits

Create a shortcut with VB.NET

  • Inspired by a post appeared on the MSDN forum I would like to offer you a tip on how to create a shortcut using VB.NET. To create a shortcut we can proceed in two ways: either we study the structure of the file. Lnk and write a class that is able to recreate that structure or use Windows Scripting Host.
  • The first solution is feasible, but cumbersome because the structure of a lnk file is not trivial. Anyone interested to see how it is composed, internally, a lnk file can download the following reference guide ( link).
  • I would like to offer you the second street and will create a class that encapsulates the use of Windows Scripting Host. The object model of Windows Scripting Host is contained in IWshRuntimeLibrary dll that can be referenced in our project, using the COM tab of the window to add the reference:
  • Objects that are inside the library will use the WshShell class and the class WshShortcut. The first of these is the actual shell of Windows Scripting Host and, among the many methods available, the method has CreateShortcut () as an argument that provides the full name of the shortcut path and extension, and returns an object of WshShortcut WshUrlShortcut class or class (actually the method, since COM, returns an object but we can cast the result to the class or WshShortcut WshUrlShortcut at will). Calling CreateShortcut not physically create the link but the link is created using the object returned by the method. For more info on the class WshShell refer to the following link
    WshShortcut therefore represents a link (the WshUrlShortcut, in fact, a subset of properties WshShortcut and is designed for web link) and provides all the properties that we need to define the same link (eg icon, working directory, description, etc.. etc...) For more info on the class WshShortcut refer to the following link

    .

    The class that we want to bring down a number of properties for the shortcut of the definition and a method for rescuing the same (in a similar way as it does the WshShortcut) and encapsulate the use of the two previous classes of scripting.

    Imports

    IWshRuntimeLibrary

      image

    Public

    Class

    Shortcut

     

         Public

    Sub

    New
    (
    ByVal
    shortcutFullName
      As
    1. String )
    2.         
    3. Me
    4. .ShortcutFullName = shortcutFullName      End Sub
    5.  
    6.      Private _ShortcutFullName As String      Public Property ShortcutFullName
    7. As
    8. String
    9.          Get             
    10. Return
    11. _ShortcutFullName
    12.          End Get         
    13. Set
    14. ( ByVal value As String )             
    15. If
    16. String .IsNullOrWhiteSpace(value) Then
    17. Throw New ArgumentNullException
    18. ( "ShortcutFullName" ,
    19. "ShortcutFullName can not be empty!"
    20. ) _ShortcutFullName = value & # 160; End September
    21. End Property        Public Property TargetPath As String
    22.     
    23. Public
    24. Property WindowStyle As
    25. ShortcutWindowsStyle
    26. = ShortcutWindowsStyle .NormalFocus     
    27. Public
    28. Property
    29. Hotkey As String      Public
    30. Property
    31. IconPath As String      Public Property IconIndex
    32. As
    33. Int16 = 0      Public Property Description
    34. As
    35. String      Public Property WorkingDirectory
    36. As
    37. String      Public Property Arguments
    38. As
    39. String        Public
    40. Function
    41. Save() As Boolean          Dim retval =
    42. False
    43.          Dim shortCut As IWshShortcut =
    44. Nothing
    45.          Dim shell As WshShell = Nothing
    46.          Try             shell =
    47. New
    48. WshShell ()          Catch ex As
    49. Exception
    50.              Throw          End
    51. Try
    52.         
    53. If
    54. shell IsNot Nothing
    55. Then
    56.              Try                 shortCut =
    57. CType
    58. ( shell .CreateShortcut(
    59. Me
    60. .ShortcutFullName), IWshShortcut )             
    61. Catch
    62. ex As Exception                  Throw
    63.              End
    64. Try
    65.              If shortCut IsNot Nothing
    66. Then
    67.                  shortCut .TargetPath = Me .TargetPath
    68.                  shortCut .WindowStyle =
    69. CInt
    70. ( Me .WindowStyle)                 
    71. shortCut
    72. .Description = Me .Description                  ShortCut . working directory = Me . WorkingDirectory
    73. & # 160;.. shortcut IconLocation = String format (
    74. "{0}, {1}"
    75. , Me . IconPath, Me . IconIndex) & # 160;
    76. shortCut
    77. .Arguments = Me .Arguments                 
    78. If
    79. Not String .IsNullOrWhiteSpace(
    80. Me
    81. .Hotkey) Then                      shortCut .Hotkey = Me .Hotkey                 
    82. End
    83. If  
    84.                  Try                      shortCut .Save()                     retval = System.IO. File .Exists(
    85. Me
    86. .ShortcutFullName)                  Catch ex
    87. As
    88. Exception                     
    89. Throw
    90.                  End
    91. Try
    92.             
    93. End
    94. If         
    95. End
    96. If          Return retVal
    97.      End
    98. Function End Class
    99. As we can see, the method Save () (which, compared to the amount of WshShortcut returns a result) perform the following steps: 1) Create a instance of the WshShell:
    100. Dim shell As WshShell = Nothing
    101. Try
    shell = New
    WshShell

    ()

    Catch ex As
    Exception
    1. Throw End Try
    2. 2) If the instance of the shell has been created creates an instance of the class WshShortcut:
    3. Try shortcut = CType
    4. ( shell. CreateShortcut (
    5. Me
    6. . ShortcutFullName) IWshShortcut )
    Catch ex As
    Exception

    Throw
    1. End Try
    2. 3) If the instance of the shortcut was created, are valued properties:
    3. shortcut. TargetPath = Me . TargetPath
    4. shortcut. WindowStyle = CInt
    5. ( Me . WindowStyle)
    shortcut.
    Description = Me
    .
    Description

    shortcut. WorkingDirectory =
    Me
    . WorkingDirectory
    1. shortcut. IconLocation String = . Format (
    2. "{0}, {1}"
    3. , Me . IconPath, Me . IconIndex)
    4. shortcut. Arguments = Me . Arguments
    5. If
    6. Not String . IsNullOrWhiteSpace (
    7. Me
    8. . Hotkey) Then shortcut. Hotkey = Me . Hotkey
    9. End If
    10. 4) method is called Save () WshShortcut class and checked the lnk file is actually created: Try
    11. shortcut. Save () retval = System.IO. File
    12. . Exists ( Me . ShortcutFullName)
    Catch ex As

    Exception Throw End
    1. Try
    2. Un possibile utilizzo della classe è il seguente:
    3. Dim desktop = Environment .GetFolderPath(
    4. Environment
    5. . SpecialFolder .DesktopDirectory)
    6. Dim shortcutFullname = System.IO. Path .Combine(desktop,
    7. "Doc.lnk"
    )
    Dim

    shortcut =

    New
    Shortcut
    (shortcutFullname)
    1. shortcut .WindowStyle = ShortcutWindowsStyle .NormalNoFocus shortcut .Description =
    2. "I miei documenti"
    3. shortcut. TargetPath = Environment . GetFolderPath (
    4. Environment
    5. . SpecialFolder . MyDocuments) shortcut. Save ()
    6. This example creates a link called Doc lnk user's desktop that allows you to open documents.
    7. Finally we note that one of the properties of the class we created is the Shortcut enumeration:
    8. Public Enum ShortcutWindowsStyle
    9. NormalFocus =
    10. WshWindowStyle . WshNormalFocus
    11. NormalNoFocus =
    WshWindowStyle
    . WshNormalNoFocus
    MaximizedFocus =

    WshWindowStyle

    . WshMaximizedFocus

    MinimizeFocus =

    WshWindowStyle

    . WshMinimizedFocus
    MinimizedNoFocus =
      WshWindowStyle
    1. . WshMinimizedNoFocus Hide = WshWindowStyle . WshHide
    2. End Enum
    3. that defines the possible values \u200b\u200bof the style of the shortcut window encapsulating the similar enumeration of WshWindowStyle IWshRuntimeLibrary.
    4. Technorati tags: IWshRuntimeLibrary
    5. ,
    6. WshShell , WskShortcut
    7. ,
    8. WshUrlShortcut , Shortcut
    9. ,
    10. Link , . lnk, VB.NET

    Wednesday, December 29, 2010

    Do Minnetonka Moccasins Run Big Or Small?

    We pull the amounts for 2010 Merry Christmas 2010

    The 2010 draws to a close and it's time to take stock of my work as a blogger.

    In quest’anno ho scrito 153 post (decisamente più prolifico rispetto all’anno precedente) e la classifica assoluta (contemplando anche quelli scritti negli anni precedenti) dei migliori 5 è la seguente:

    Appunti di WPF – Dodicesima Puntata – Le figure geometriche

    Se analizziamo la classifica of the best posts written in 2010 we get:

      Clipboard WPF - Seventh Episode - The Layout
    1. Clipboard WPF - Twelfth Episode - The geometric figures
    2. Crumbs of WPF: non-rectangular windows, WPF vs Windows Forms
    3. Clipboard WPF - Fourth Episode - XAML, bases
    4. crumbs WPF - SplashScreen in Visual Studio 2010

    1. The latter demonstrates the interest in WPF but also ' interest in the tutorial.
    2. For this reason, during 2011 I will try to concentrate on writing tutorials for those who approach the world. NET.
    3. the end of this year I was satisfied with the views obtained on the blog (with more than 13K total and an average of about 1K per month). Last year I stopped at about 3k of total visits (it is true that the blog was opened in late April, but in any case the number is significantly increased). It must be said, to tell the truth, that I have to thank the community DomusDotNet
    4. and, before that, the deceased
    5. DotNetRomaCestà because I have given visibility.
    6. All this spurs me to work even during 2011 to provide more material and quantity.

    Saturday, December 25, 2010

    Wher Dose Starch Dissolve?



  • Tuesday, December 21, 2010

    How Long Before You Lose Weight Doing Zumba

    WP7 WebBrowser control and target = "_blank"

    The WebBrowser control development tools in the WP7 not digest well with anchor target = "_blank".
    If you try to view a page with links that have specified the target set to "_blank", these will not work.
    However, if the link has target "_top", "_parent" or "_self" (or no target), the web browser allows you to surf safely by following the link.

    This means that if you view web pages that open new pages, these will not work as you expect.

    If you are using the method NavigateToString () to display your own html, make sure you do not have the target in the anchor and you're done.

    Technorati tags:

    wp7

    ,

    , target natale_01_ani

    Wednesday, December 15, 2010

    Sore Knee From Tredmill

    Connect to TFS via DOM in a web service

    In a project I'm working, I happened to have access to TFS 2010/2008 using the DOM available to the Team Explorer.

    We are dealing with a web service that lets you manage calls from a non-Microsoft platforms by analyzing the traffic and doing some work on the data but at the end della fiera, scrive dei workitem all’interno di TFS e non abbiamo scelto di utilizzare la integration platform di TFS.

    Lato client, il Team Explore utilizza una serie di cartelle di cache per “cachare” i dati in modo da ottimizzare l’accesso alla piattaforma TFS.

    La cartella solitamente utilizzata è nel seguente percorso:

    C:\Documents and Settings\Default User\Local Settings\Application Data\Microsoft\Team Foundation\3.0\Cache

    In particolare, questa cartella viene creata dal Team Explorer nel momento in cui un utente si connette. ) you can set the

    Obviously the folder should have the appropriate privileges so that the web service can write into it.

    The same property can be used by a Windows client or a standard window.

    Technorati tags:

    tfs

    , tfs dom ,

    team foundation server

    ,

    team explorer

    ,

    tfsconnection

    , tfsprojectcollection , clientsettingsdirectory , tfsconfigurationserver

    Shoul Eat Ramen Noodles Stomach Flu

    Everything changes ... .. also the birth! ! Feature CTP5

    Wednesday, December 8, 2010

    Widespread Osseous Metastatic Disease

    released to EF-

    E’ stato annunciato (vedi il post) il rilascio della Feature CTP5 di EF per lo sviluppo di classi di accesso alla banca dati di tipo Code First. Sul blog di ADO.NET sono disponibili anche dei post per cominciare a capire il funzionamento del framework: Model & Database First with DbContext

    Code First Walkthrough

    Code First Fluent API Samples Questa è l’ultima CTP prima del rilascio definitivo che avverrà nel primo quadrimestre del 2011. Per scaricare la CTP utilizzare il
    link

    . Tag di Technorati:

    Feature CTP5 EF

    ,

    EF

    ,

    Wednesday, December 1, 2010

    Template For Fondant Boat Cake

    IE9 Create an image without the jumplist

    IE9 allows developers to define the activities within the jumplist a site attached to the task bar of Windows 7 (see
  • post for details).
  • activity is nothing but a quick access to a functionality of an application that, in the case of a web site, which is a page.

    activities are defined through the meta tags of the form:


    \u0026lt;META name = "msapplication-task"
    & # 160; content = "name = News; action-uri = url of the page icon in the task image-uri ="

    >

    where the content consists of three distinct parts:
    1. name: name that appears in the list of tasks. It can also be empty (although it makes little sense because the user would see an activity without any names and would not know what's the use); action-uri: page address that corresponds to the task. It can also be empty (in this case opens the root directory) or an external link to our site;
    2. icon-uri: image to be used in the task list to the left of the name. This field can not be empty and must point to an image in ICO format.
    3. The three parties must be present if, and action-used name may be empty. The part relating to the image, however, can not remain empty, otherwise the tag is not recognized (as if there was). If we deploy we just insert an image without any value rather than leave it blank, for example, the string "null".
    The following tag, for example, implements activities without News Image:

    • \u0026lt;META
    • name = "msapplication-task"
    • & # 160;
    content = "name = News; action-uri = news.html; icon-uri = null"

    >

    Technorati tags:
      IE9
    1. , msapplication -task, meta tag, activities, task