title: VB.net: Showing the File Properties window from a 64-bit application?
body: <p>I am trying to build an application similar to the Windows File Explorer, in VB.net. I want do use the the same window that is displayed when right clicking a file in the File Explorer, clicking Properties in the meny. The thing is, this is very easy to solve, but it only works if my application is compiled as a 32-bit application, when I compile it as 64-bit, this doesn't work.</p>
  <p>There are two kinds of answer that I would like:</p>
  <ol>
  <li>The best would be to show this file Properties window from a 64-bit application.</li>
  <li>The second best would be to create a 32-bit application as a wrapper, that just have the purpose to show the file Properties window. I was almost able to fix this, but I do not know how to trace when the OK or Cancel button is clicked.</li>
  </ol>
  <p>Here below is the code I use, that works fine in 32-bit VB.net:</p>
  <pre><code>  Private Declare Function ShellExecuteEX Lib &quot;shell32.dll&quot; Alias &quot;ShellExecuteEx&quot; (ByRef SEI As SHELLEXECUTEINFO) As Integer
  
    Private Structure SHELLEXECUTEINFO
      Dim cbSize As Integer
      Dim fMask As Integer
      Dim hwnd As Integer
      Dim lpVerb As String
      Dim lpFile As String
      Dim lpParameters As String
      Dim lpDirectory As String
      Dim nShow As Integer
      Dim hInstApp As Integer
      Dim lpIDList As Integer
      Dim lpClass As String
      Dim hkeyClass As Integer
      Dim dwHotKey As Integer
      Dim hIcon As Integer
      Dim hProcess As Integer
    End Structure
  
    Private Const SEE_MASK_INVOKEIDLIST As Short = &amp;HCS
    Private Const SEE_MASK_NOCLOSEPROCESS As Short = &amp;H40S
    Private Const SEE_MASK_FLAG_NO_UI As Short = &amp;H400S
    Private Const SW_SHOWNORMAL As Integer = 1
  
  Public Function ShowProps(ByVal FileName As String, ByVal OwnerhWnd As Integer) As Boolean
      Dim SEI As SHELLEXECUTEINFO = Nothing
      Dim r As Integer
      With SEI
        .cbSize = Len(SEI)
        .fMask = SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_INVOKEIDLIST Or SEE_MASK_FLAG_NO_UI
        .hwnd = OwnerhWnd
        .lpVerb = &quot;properties&quot;
        .lpFile = FileName
        .lpParameters = vbNullChar
        .lpDirectory = vbNullChar
        .nShow = 0
        .hInstApp = 0
        .lpIDList = 0
      End With
      r = ShellExecuteEX(SEI)
      If r &lt;= 0 Then
        Return False
      End If
  
      Return True
    End Function
  </code></pre>