「Windowsのクリップボードを用いた選択コンテンツの取得」の版間の差分

Notion-MW
タグ: 差し戻し済み
Notion-MW
タグ: 手動差し戻し
47行目: 47行目:
コード例は以下である。
コード例は以下である。


<syntaxhighlight lang="python">
<syntaxhighlight lang="c#">class CBSample
 
c#
class CBSample
{
{
     static string[] unsupported_formats = new string[] {"Object Descriptor"};
     static string[] unsupported_formats = new string[] {"Object Descriptor"};
170行目: 167行目:
に従い、コンストラクタの冒頭に
に従い、コンストラクタの冒頭に


<syntaxhighlight lang="python">
<syntaxhighlight lang="vb.net">this.Visible = false;
 
vb.net
this.Visible = false;
this.WindowState = FormWindowState.Minimized;
this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;</syntaxhighlight>
this.ShowInTaskbar = false;</syntaxhighlight>
を入れると、一見消えているように見えるが、Alt+Tabなどをすると表示されているのが見えてしまうので、自分のHWNDを対象にSW_HIDEを指定してShowWindowをすると完全に消える。
を入れると、一見消えているように見えるが、Alt+Tabなどをすると表示されているのが見えてしまうので、自分のHWNDを対象にSW_HIDEを指定してShowWindowをすると完全に消える。


<syntaxhighlight lang="python">
<syntaxhighlight lang="vb.net">case WM_SHOWWINDOW:
 
vb.net
case WM_SHOWWINDOW:
                 this.CenterToScreen();
                 this.CenterToScreen();
                 if ((int)message.WParam == 1)
                 if ((int)message.WParam == 1)
224行目: 215行目:
C&#35;の<code>NamedPipeClientStream</code>ではパイプの名前を<code>&quot;.&quot;</code> <code>&quot;test&quot;</code>とコンピュータ名/パイプ名で分けているのに対して(AutoHotkeyで呼び出されている)Win32 APIの関数<code>CreateNamedPipe</code>では<code>&quot;\\.\</code><strong><code>pipe\</code></strong><code>test&quot;</code>と書く必要があるようなので注意。
C&#35;の<code>NamedPipeClientStream</code>ではパイプの名前を<code>&quot;.&quot;</code> <code>&quot;test&quot;</code>とコンピュータ名/パイプ名で分けているのに対して(AutoHotkeyで呼び出されている)Win32 APIの関数<code>CreateNamedPipe</code>では<code>&quot;\\.\</code><strong><code>pipe\</code></strong><code>test&quot;</code>と書く必要があるようなので注意。


<syntaxhighlight lang="python">
<syntaxhighlight lang="vb.net">using System;
 
vb.net
using System;
using System.IO.Pipes;
using System.IO.Pipes;


253行目: 241行目:
   }
   }
}</syntaxhighlight>
}</syntaxhighlight>
<syntaxhighlight lang="python">
<syntaxhighlight lang="vb.net">ptr := A_PtrSize ? "Ptr" : "UInt"
 
vb.net
ptr := A_PtrSize ? "Ptr" : "UInt"
char_size := A_IsUnicode ? 2 : 1
char_size := A_IsUnicode ? 2 : 1
pipe := DllCall("CreateNamedPipe", "str", "\\.\pipe\test", "uint", 3, "uint", 4, "uint", 10, "uint", 100, "uint", 100, "uint", 0, ptr, 0, ptr)
pipe := DllCall("CreateNamedPipe", "str", "\\.\pipe\test", "uint", 3, "uint", 4, "uint", 10, "uint", 100, "uint", 100, "uint", 0, ptr, 0, ptr)