FontDialog.HookProc メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > FontDialog.HookProc メソッドの意味・解説 

FontDialog.HookProc メソッド

コモン ダイアログ ボックス特定の機能追加するためにオーバーライドされる、コモン ダイアログ ボックスフック プロシージャ指定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Protected Overrides Function
 HookProc ( _
    hWnd As IntPtr, _
    msg As Integer, _
    wparam As IntPtr, _
    lparam As IntPtr _
) As IntPtr
Dim hWnd As IntPtr
Dim msg As Integer
Dim wparam As IntPtr
Dim lparam As IntPtr
Dim returnValue As IntPtr

returnValue = Me.HookProc(hWnd, msg, wparam, lparam)
protected override IntPtr HookProc (
    IntPtr hWnd,
    int msg,
    IntPtr wparam,
    IntPtr lparam
)
protected:
virtual IntPtr HookProc (
    IntPtr hWnd, 
    int msg, 
    IntPtr wparam, 
    IntPtr lparam
) override
protected IntPtr HookProc (
    IntPtr hWnd, 
    int msg, 
    IntPtr wparam, 
    IntPtr lparam
)
protected override function HookProc (
    hWnd : IntPtr, 
    msg : int, 
    wparam : IntPtr, 
    lparam : IntPtr
) : IntPtr

パラメータ

hWnd

ダイアログ ボックス ウィンドウ識別するハンドル

msg

受信しているメッセージ

wparam

メッセージについての追加情報

lparam

メッセージについての追加情報

戻り値
既定ダイアログ ボックス プロシージャメッセージ処理する場合は 0。既定ダイアログ ボックス プロシージャではメッセージ無視する場合は 0 以外。

解説解説
使用例使用例

HookProc メソッドオーバーライドする方法次のコード例示します。この例は FontDialog クラス継承するクラスから構成されています。また、クラスHookProc オーバーライドで、msg パラメータWindows メッセージ定数に対して評価してます。msg パラメータ指定した定数等し場合HookProc メソッド渡されWindows メッセージ識別するトレース出力書き込みます。この例では、HookProc メソッド宣言されているクラスFontDialog継承クラスである必要があります

    ' Defines the constants for Windows messages.

    Const WM_SETFOCUS = &H7
    Const WM_INITDIALOG = &H110
    Const WM_LBUTTONDOWN = &H201
    Const WM_RBUTTONDOWN = &H204
    Const WM_MOVE = &H3
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand,
 Name:="FullTrust")> _
    Protected Overrides Function
 HookProc(ByVal hWnd As IntPtr, ByVal
 msg As Integer, ByVal wParam As IntPtr, ByVal lParam As
 IntPtr) As IntPtr


        ' Evaluates the message parameter to determine the user action.

        Select Case msg

            Case WM_INITDIALOG
                System.Diagnostics.Trace.Write("The WM_INITDIALOG
 message was received.")
            Case WM_SETFOCUS
                System.Diagnostics.Trace.Write("The WM_SETFOCUS
 message was received.")
            Case WM_LBUTTONDOWN
                System.Diagnostics.Trace.Write("The WM_LBUTTONDOWN
 message was received.")
            Case WM_RBUTTONDOWN
                System.Diagnostics.Trace.Write("The WM_RBUTTONDOWN
 message was received.")
            Case WM_MOVE
                System.Diagnostics.Trace.Write("The WM_MOVE message
 was received.")

        End Select

        ' Always call the base class hook procedure.

        Return MyBase.HookProc(hWnd, msg, wParam,
 lParam)

    End Function
// Defines the constants for Windows messages.

const int WM_SETFOCUS = 0x0007;
const int WM_INITDIALOG = 0x0110;
const int WM_LBUTTONDOWN = 0x0201;
const int WM_RBUTTONDOWN = 0x0204;
const int WM_MOVE = 0x0003;

// Overrides the base class hook procedure...
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand,
 Name="FullTrust")] 
protected override IntPtr HookProc(IntPtr hWnd, int
 msg, IntPtr wParam, IntPtr lParam)
{

    // Evaluates the message parameter to determine the user action.

    switch(msg)
    {

        case WM_INITDIALOG:
            System.Diagnostics.Trace.Write("The WM_INITDIALOG message was received.");
            break;
        case WM_SETFOCUS:
            System.Diagnostics.Trace.Write("The WM_SETFOCUS message was received.");
            break;
        case WM_LBUTTONDOWN:
            System.Diagnostics.Trace.Write("The WM_LBUTTONDOWN message was received.");
            break;
        case WM_RBUTTONDOWN:
            System.Diagnostics.Trace.Write("The WM_RBUTTONDOWN message was received.");
            break;
        case WM_MOVE:
            System.Diagnostics.Trace.Write("The WM_MOVE message was received.");
            break;

    }

    // Always call the base class hook procedure.

    return base.HookProc(hWnd, msg, wParam,
 lParam);

}
   private:
      // Defines the constants for Windows messages.
      literal int WM_SETFOCUS = 0x0007;
      literal int WM_INITDIALOG = 0x0110;
      literal int WM_LBUTTONDOWN = 0x0201;
      literal int WM_RBUTTONDOWN = 0x0204;
      literal int WM_MOVE = 0x0003;

   protected:
      // Overrides the base class hook procedure...
//      [System::Security::Permissions::SecurityPermission(System::Security::Permissions::SecurityAction::Demand,
 Flags=SecurityPermissionFlag::UnmanagedCode)] 
      [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)]
 
      virtual IntPtr HookProc( IntPtr hWnd, int msg, IntPtr wParam,
 IntPtr lParam ) override
      {
         // Evaluates the message parameter to determine the user action.
         switch ( msg )
         {
            case WM_INITDIALOG:
               System::Diagnostics::Trace::Write( "The WM_INITDIALOG message
 was received." );
               break;
            case WM_SETFOCUS:
               System::Diagnostics::Trace::Write( "The WM_SETFOCUS message was
 received." );
               break;
            case WM_LBUTTONDOWN:
               System::Diagnostics::Trace::Write( "The WM_LBUTTONDOWN message
 was received." );
               break;
            case WM_RBUTTONDOWN:
               System::Diagnostics::Trace::Write( "The WM_RBUTTONDOWN message
 was received." );
               break;
            case WM_MOVE:
               System::Diagnostics::Trace::Write( "The WM_MOVE message was received."
 );
               break;
         }
         
         // Always call the base class hook procedure.
         return FontDialog::HookProc( hWnd, msg, wParam, lParam
 );
      }
    // Defines the constants for Windows messages.
    final int WM_SETFOCUS = 0x7;
    final int WM_INITDIALOG = 0x110;
    final int WM_LBUTTONDOWN = 0x201;
    final int WM_RBUTTONDOWN = 0x204;
    final int WM_MOVE = 0x3;

    // Overrides the base class hook procedure...
//    /** @attribute System.Security.Permissions.PermissionSet(System.Security.
//        Permissions.SecurityAction.Demand, Name = "FullTrust")
//     */
    /** @attribute SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)
     */
    protected IntPtr HookProc(IntPtr hWnd, int
 msg, IntPtr wParam, 
        IntPtr lParam)
    {
        // Evaluates the message parameter to determine the user action.
        switch (msg) {
            case WM_INITDIALOG :
                System.Diagnostics.Trace.Write(
                    "The WM_INITDIALOG message was received.");
                break;

            case WM_SETFOCUS :
                System.Diagnostics.Trace.Write(
                    "The WM_SETFOCUS message was received.");
                break;

            case WM_LBUTTONDOWN :
                System.Diagnostics.Trace.Write(
                    "The WM_LBUTTONDOWN message was received.");
                break;

            case WM_RBUTTONDOWN :
                System.Diagnostics.Trace.Write(
                    "The WM_RBUTTONDOWN message was received.");
                break;

            case WM_MOVE :
                System.Diagnostics.Trace.Write(
                    "The WM_MOVE message was received.");
                break;
        }

        // Always call the base class hook procedure.
        return super.HookProc(hWnd, msg, wParam, lParam);
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「FontDialog.HookProc メソッド」の関連用語

FontDialog.HookProc メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



FontDialog.HookProc メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS