This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this code for .NET 6 | |
using System; | |
using System.Runtime.InteropServices; | |
using System.Runtime.InteropServices.ComTypes; | |
if (OperatingSystem.IsWindows()) | |
{ | |
// VS2022=17.0, VS2019=16.0, VS2017=15.0, VS2015=14.0, VS2013=12.0, VS2012=11.0, VS2010=10.0, VS2008=9.0, VS2005=8.0, VS2003=7.1, VS2002=7 | |
foreach (var v in new []{ "", ".17.0", ".16.0", ".15.0", ".14.0", ".12.0", "11.0", ".10.0", ".9.0"}) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Form に Button1, Button2 および ListView を貼って実行します | |
' | |
'下記のアセンブリを参照設定する必要があります | |
' UIAutomationClient | |
' UIAutomationType | |
' | |
'⚠ このコードを Visual Studio からデバッグ実行する場合には | |
'[デバッグ] - [ウィンドウ] - [例外設定] から | |
' [Managed Debugging Assistants] - [NonComVisibleBaseClass] | |
'のチェックを Off にしておく必要があります |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Strict On | |
Imports System.ComponentModel | |
Imports System.Runtime.InteropServices | |
Imports System.Windows.Forms | |
'<DefaultEvent(NameOf(TreeViewEx.Scroll))> | |
<DefaultEvent("Scroll")> | |
Public Class TreeViewEx | |
Inherits TreeView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
' | |
' Excel VBA 向けのサンプル | |
' 下記の参照設定が必要です | |
' Microsoft Scripting Runtime (scrrun.dll) | |
' UIAutomationClient (UIAutomationCore.dll) | |
' | |
' UserForm1 に、下記のコントロールが必要です | |
' CommandButton1 | |
' OptionButton1 , OptionButton2 , OptionButton3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit On | |
Option Strict On | |
Imports SHDocVw '参照設定(COM):Microsoft Internet Controls | |
Imports Shell32 '参照設定(COM):Microsoft Shell Controls And Automation | |
'Imports mshtml '参照設定(COM):Microsoft HTML Object Library | |
Imports System.IO | |
Imports System.Runtime.InteropServices | |
'コントロールを 2 つ貼っておく | |
' Button1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Private Declare PtrSafe Function CLSIDFromString Lib "ole32" (ByVal pString As LongPtr, ByRef pCLSID As Currency) As Long | |
Private Declare PtrSafe Function RegisterWindowMessageW Lib "user32" (ByVal lpString As LongPtr) As Long | |
Private Declare PtrSafe Function SendMessageTimeoutW Lib "user32" (ByVal hWnd As LongPtr, ByVal msg As Long, ByVal wParam As LongPtr, ByRef lParam As LongPtr, ByVal fuFlags As Long, ByVal uTimeout As Long, ByRef lpdwResult As Long) As LongPtr | |
Private Declare PtrSafe Function ObjectFromLresult Lib "oleacc" (ByVal lResult As Long, ByRef riid As Currency, ByVal wParam As LongPtr, ppvObject As Any) As Long | |
Private Enum SMTO | |
NORMAL = 0 | |
BLOCK = 1 | |
ABORTIFHUNG = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Private Declare PtrSafe Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As Long) As Long | |
Private Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hWnd As LongPtr) As Long | |
Private Declare PtrSafe Function GetClipboardData Lib "user32" (ByVal wFormat As Long) As LongPtr | |
Private Declare PtrSafe Function CloseClipboard Lib "user32" () As Long | |
Private Declare PtrSafe Function OleCreatePictureIndirect Lib "oleaut32" (ByRef lpPictDesc As PICTDESC_BITMAP, ByRef RefIID As Any, ByVal fPictureOwnsHandle As Long, ByRef IPic As IPicture) As Long | |
Private Const PtrNull As LongPtr = 0 | |
Private Type PICTDESC_BITMAP | |
cbSizeofStruct As Long |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Guid は固有の値を指定する必要があります | |
Imports System.Runtime.InteropServices | |
Imports System.Net.Http | |
Imports System.Text | |
<ComVisible(True)> | |
<CoClass(GetType(ClassLibraryNet5))> | |
<Guid("E001C99F-F4BC-4A40-8C4C-3CF4D8E701EE")> | |
<InterfaceType(ComInterfaceType.InterfaceIsDual)> | |
Public Interface IClassLibraryNet5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Strict On | |
Imports System.ComponentModel | |
Imports System.IO | |
Imports System.Runtime.CompilerServices | |
Imports System.Runtime.InteropServices | |
Module FileInfoExtention | |
''' <summary> | |
''' ドライブのクラスターサイズを返します。 | |
''' </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Partial Public Class RecordingForm | |
Inherits System.Windows.Forms.Form | |
Private recordingData As System.IO.MemoryStream '録音データ | |
' NuGet で NAudio パッケージを組み込んでおくこと | |
Private WithEvents waveIn As NAudio.Wave.WaveInEvent | |
Private writer As System.IO.Stream | |
Private Sub waveIn_DataAvailable(sender As Object, e As NAudio.Wave.WaveInEventArgs) Handles waveIn.DataAvailable | |
writer?.Write(e.Buffer, 0, e.BytesRecorded) |