dd
This commit is contained in:
@@ -25,7 +25,6 @@ Public Class ManagedPipeServer : Inherits ManagedPipe
|
|||||||
Dim strm = New NamedPipeServerStream(pipeName, PipeDirection.InOut, maxNumbersOfServerInstances, PipeTransmissionMode.Byte, PipeOptions.Asynchronous)
|
Dim strm = New NamedPipeServerStream(pipeName, PipeDirection.InOut, maxNumbersOfServerInstances, PipeTransmissionMode.Byte, PipeOptions.Asynchronous)
|
||||||
numberOfStartedServerInstances += 1
|
numberOfStartedServerInstances += 1
|
||||||
strm.BeginWaitForConnection(AddressOf EndAccept, strm)
|
strm.BeginWaitForConnection(AddressOf EndAccept, strm)
|
||||||
Console.WriteLine("Start Waiting for new Connection ...")
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -46,8 +45,6 @@ Public Class ManagedPipeServer : Inherits ManagedPipe
|
|||||||
.AddTo(_Clients)
|
.AddTo(_Clients)
|
||||||
End With
|
End With
|
||||||
|
|
||||||
Console.WriteLine("Client accepted!")
|
|
||||||
|
|
||||||
CreateWaitingStream()
|
CreateWaitingStream()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
38
Pilz.Win32/Internals/IconExtractor.vb
Normal file
38
Pilz.Win32/Internals/IconExtractor.vb
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
Imports System.Drawing
|
||||||
|
Imports System.Runtime.InteropServices
|
||||||
|
Imports Pilz.Win32.Native
|
||||||
|
|
||||||
|
Namespace Internals
|
||||||
|
|
||||||
|
Public Class IconExtractor
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Extrahiert das Icon aus einer Datei oder aus einem Ordner.
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="FilePath">Hier übergeben Sie den Pfad der Datei von dem das Icon extrahiert werden soll.</param>
|
||||||
|
''' <param name="Small">Bei übergabe von true wird ein kleines und bei false ein großes Icon zurück gegeben.</param>
|
||||||
|
Public Shared Function ExtractIcon(ByVal FilePath As String, ByVal Small As Boolean) As Icon
|
||||||
|
Dim hImgSmall As IntPtr
|
||||||
|
Dim hImgLarge As IntPtr
|
||||||
|
Dim shinfo As New SHFILEINFO
|
||||||
|
|
||||||
|
If Small Then
|
||||||
|
hImgSmall = LibShell32.SHGetFileInfo(FilePath, 0, shinfo, CUInt(Math.Truncate(Marshal.SizeOf(shinfo))), SHFILEINFO.SHGFI_ICON Or SHFILEINFO.SHGFI_SMALLICON)
|
||||||
|
Else
|
||||||
|
hImgLarge = LibShell32.SHGetFileInfo(FilePath, 0, shinfo, CUInt(Math.Truncate(Marshal.SizeOf(shinfo))), SHFILEINFO.SHGFI_ICON Or SHFILEINFO.SHGFI_LARGEICON)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim icon As Icon
|
||||||
|
|
||||||
|
Try
|
||||||
|
icon = Icon.FromHandle(shinfo.hIcon)
|
||||||
|
Catch ex As Exception
|
||||||
|
icon = Nothing
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return icon
|
||||||
|
End Function
|
||||||
|
|
||||||
|
End Class
|
||||||
|
|
||||||
|
End Namespace
|
||||||
@@ -3,14 +3,14 @@ Imports Pilz.Win32.Native
|
|||||||
|
|
||||||
Namespace Mapped
|
Namespace Mapped
|
||||||
|
|
||||||
Public Class FileInfo
|
Public Class NativeFileInfo
|
||||||
|
|
||||||
Public ReadOnly Property Icon As Icon
|
Public ReadOnly Property Icon As Icon
|
||||||
Public ReadOnly Property SystemIconIndex As Integer
|
Public ReadOnly Property SystemIconIndex As Integer
|
||||||
Public ReadOnly Property Displayname As String
|
Public ReadOnly Property Displayname As String
|
||||||
Public ReadOnly Property Typename As String
|
Public ReadOnly Property Typename As String
|
||||||
|
|
||||||
Friend Sub New(info As SHFILEINFO)
|
Public Sub New(info As SHFILEINFO)
|
||||||
Icon = Icon.FromHandle(info.hIcon)
|
Icon = Icon.FromHandle(info.hIcon)
|
||||||
SystemIconIndex = info.iIcon
|
SystemIconIndex = info.iIcon
|
||||||
Displayname = info.szDisplayName
|
Displayname = info.szDisplayName
|
||||||
9
Pilz.Win32/Native/LibShell32.vb
Normal file
9
Pilz.Win32/Native/LibShell32.vb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
Namespace Native
|
||||||
|
|
||||||
|
Public Class LibShell32
|
||||||
|
|
||||||
|
Public Declare Auto Function SHGetFileInfo Lib "shell32.dll" (ByVal pszPath As String, ByVal dwFileAttributes As UInteger, ByRef psfi As SHFILEINFO, ByVal cbSizeFileInfo As UInteger, ByVal uFlags As UInteger) As IntPtr
|
||||||
|
|
||||||
|
End Class
|
||||||
|
|
||||||
|
End Namespace
|
||||||
@@ -2,14 +2,21 @@
|
|||||||
|
|
||||||
Namespace Native
|
Namespace Native
|
||||||
|
|
||||||
Friend Structure SHFILEINFO
|
<StructLayout(LayoutKind.Sequential)>
|
||||||
|
Public Structure SHFILEINFO
|
||||||
|
|
||||||
|
Public Const SHGFI_ICON As UInteger = &H100
|
||||||
|
Public Const SHGFI_LARGEICON As UInteger = &H0
|
||||||
|
Public Const SHGFI_SMALLICON As UInteger = &H1
|
||||||
|
|
||||||
Public hIcon As IntPtr
|
Public hIcon As IntPtr
|
||||||
Public iIcon As Integer
|
Public iIcon As IntPtr
|
||||||
Public dwAttributes As UInteger
|
Public dwAttributes As UInteger
|
||||||
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)>
|
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)>
|
||||||
Public szDisplayName As String
|
Public szDisplayName As String
|
||||||
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)>
|
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)>
|
||||||
Public szTypeName As String
|
Public szTypeName As String
|
||||||
|
|
||||||
End Structure
|
End Structure
|
||||||
|
|
||||||
End Namespace
|
End Namespace
|
||||||
|
|||||||
@@ -66,7 +66,8 @@
|
|||||||
<Import Include="System.Threading.Tasks" />
|
<Import Include="System.Threading.Tasks" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Mapped\FileInfo.vb" />
|
<Compile Include="Internals\IconExtractor.vb" />
|
||||||
|
<Compile Include="Mapped\NativeFileInfo.vb" />
|
||||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||||
<Compile Include="My Project\Application.Designer.vb">
|
<Compile Include="My Project\Application.Designer.vb">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
@@ -82,6 +83,7 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Native\LibShell32.vb" />
|
||||||
<Compile Include="Native\SHFILEINFO.vb" />
|
<Compile Include="Native\SHFILEINFO.vb" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user