C# と VB.NET の質問掲示板

ASP.NET、C++/CLI、Java 何でもどうぞ

ログ内検索
  • キーワードを複数指定する場合は 半角スペース で区切ってください。
  • 検索条件は、(AND)=[A かつ B] (OR)=[A または B] となっています。
  • [返信]をクリックすると返信ページへ移動します。
キーワード/ 検索条件 /
検索範囲/ 強調表示/ ON (自動リンクOFF)
結果表示件数/ 記事No検索/ ON
大文字と小文字を区別する

全過去ログを検索

<< 0 >>
■18785  Re[4]: 排他処理
□投稿者/ なちゃ -(2008/05/16(Fri) 11:35:11)
    何か理由が書かれてませんでしたか?
    使い方、状況によっては望ましくないもしくはそれだけでは不十分なこともありえます。

    どっちかというと正しく使えてない事も多いですが。
記事No.18767 のレス /過去ログ37より / 関連記事表示
削除チェック/

■58536  Re[1]: iTextSharpでpdfのしおりの階層作成
□投稿者/ ボルト -(2011/04/12(Tue) 15:42:11)
    またまた自己レスです。
    iTextSharpで階層しおりのあるpdfを開き、PdfReaderのSimpleBookmarkの中身を調べてみたら、
    階層上位のしおりのDictionaryに、キーが"Kids"で値がIList(Of Dictionary(Of String, Object))のものがあったので、
    試しに以下のようにしたらうまくいきました。

    Dim pw As PdfWriter
    Dim lstOutlineTop As New List(Of Dictionary(Of String, Object))
    Dim lstOutline As New List(Of Dictionary(Of String, Object))
    Dim dic As Dictionary(Of String, Object)

    (途中略)

    dic = New Dictionary(Of String, Object)
    dic.Add("Title", "最初のページ")
    dic.Add("Action", "GoTo")
    dic.Add("Page", "1 FitH")
    lstOutline.Add(dic)

    dic = New Dictionary(Of String, Object)
    dic.Add("Title", "分類1")
    dic.Add("Kids", lstOutline)
    lstOutlineTop.Add(dic)

    pw.Outlines = lstOutlineTop

    これにて解決とします。
記事No.58528 のレス / END /過去ログ98より / 関連記事表示
削除チェック/

■90531  Re[7]: AddHandler Eventの別スレッドについて
□投稿者/ TanuTanu -(2019/03/18(Mon) 16:52:42)
    !!

    魔界の仮面弁士 様

    このような未熟者にここまで親切にして頂いて何てお礼を申せばよいやら・・・
    あれから何とかならないかと試行錯誤致しまして、TabThumbnailWindowではなくて
    IEFRAMEを取得出来ました。
    しかし、VBAではInternet Explorer_Serverまで辿り付いたのですが
    VB.NETで子ウィンドウを列挙することが出来ません。
    何卒、ご教授のほど宜しくお願いいたします。

    又、■90511で教わった件は順次取り組んでまいります。


    コードは下記の通りです。

    Public Function EnumWindowCallBack(hWnd As IntPtr, lparam As IntPtr) As Boolean

    Dim textLen As Integer = GetWindowTextLength(hWnd)
    Dim tsb As New StringBuilder(textLen + 1)
    Dim csb As New StringBuilder(256)

    If 0 < textLen Then
    GetWindowText(hWnd, tsb, tsb.Capacity)
    GetClassName(hWnd, csb, csb.Capacity)

    If tsb.ToString() = "JavaScript テスト - Internet Explorer" Then
    If csb.ToString() = "IEFrame" Then
    Debug.WriteLine(tsb.ToString())
    Debug.WriteLine(csb.ToString())
    Debug.WriteLine(hWnd)
    hWnd_IEFRAME = hWnd

              EnumChildWindows(hWnd_IEFRAME, AddressOf EnumChildWindowsProc, IntPtr.Zero) ’IEFrame下のInternet Explorer_Serverを取得したいがここでエラーになります。

    ■エラー内容
    BC31143 メソッド 'Public Function EnumChildWindowsProc(hWnd As IntPtr, lparam As IntPtr) As IntPtr' に、デリゲート 'Delegate Function API.EnumChildProc(hWnd As IntPtr, ByRef lParam As IntPtr) As Boolean' と互換性があるシグネチャがありません。


    End If
    End If

    End If

    Return True
    End Function

    Public Function EnumChildWindowsProc(hWnd As IntPtr, lparam As IntPtr) As Integer

    Dim textLen As Integer = GetWindowTextLength(hWnd)
    Dim tsb As New StringBuilder(textLen + 1)
    Dim csb As New StringBuilder(256)

    ' クラス名取得
    GetClassName(hWnd, csb, csb.Capacity)

    Debug.WriteLine(csb.ToString())

    ' リターン
    EnumChildWindowsProc = 1
    End Function

    <DllImport("user32")>
    Function EnumChildWindows(
    <[In]()> ByVal hWndParent As IntPtr,
    <[In]()> ByVal lpEnumFunc As EnumChildProc,
    <[In]()> ByRef lParam As IntPtr
    ) As Boolean
    End Function

記事No.90434 のレス /過去ログ156より / 関連記事表示
削除チェック/

■90533  Re[8]: AddHandler Eventの別スレッドについて
□投稿者/ 魔界の仮面弁士 -(2019/03/18(Mon) 18:18:44)
    No90531 (TanuTanu さん) に返信
    > しかし、VBAではInternet Explorer_Serverまで辿り付いたのですが
    > VB.NETで子ウィンドウを列挙することが出来ません。

    VBA のコードを移植している、ということでしょうか。

    それでは、VBA の API 宣言と VB2017 の API 宣言の
    【両方】を見せてもらえますか?

    提示をお願いする理由は、特に「ByVal」と「ByRef」の違いが重要だからです。


    引数に ByVal も ByRef も書かなかった場合、
    VBA では ByRef として解釈され、
    .NET では ByVal として解釈される仕様であることにご注意ください。


    > <DllImport("user32")>
    > Function EnumChildWindows(
    >  <[In]()> ByVal hWndParent As IntPtr,
    >  <[In]()> ByVal lpEnumFunc As EnumChildProc,
    >  <[In]()> ByRef lParam As IntPtr
    >  ) As Boolean
    > End Function


    第4引数を ByRef IntPtr にしたのですね。
    では、EnumChildProc の Delegate 宣言も見せてください。

    AddressOf で指定した側が ByVal で、Delegate 定義が ByRef になっていて不整合を引き起こしていると思います。



    ' 参考資料1: https://dobon.net/vb/dotnet/process/enumwindows.html
     Public Delegate Function EnumWindowsDelegate(hWnd As IntPtr, lparam As IntPtr) As Boolean
     <DllImport("user32.dll")> _
     Public Function EnumWindows(lpEnumFunc As EnumWindowsDelegate, lparam As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
     End Function


    ' 参考資料2: https://smdn.jp/programming/tips/enumwindows/
     Private Delegate Function WNDENUMPROC(ByVal hWnd As IntPtr, ByVal lParam As IntPtr) As Boolean
     <DllImport("user32")> _
     Private Function EnumWindows(ByVal lpEnumFunc As WNDENUMPROC, ByVal lParam As IntPtr) As Boolean
     End Function


    ' 参考資料3: http://mt-soft.sakura.ne.jp/web_dl/vb-parts/enum_window/
     Private Delegate Function EnumerateWindowsCallback(ByVal hWnd As IntPtr, ByVal lParam As Integer) As Integer
     <DllImport("user32", EntryPoint:="EnumWindows")> _
     Private Shared Function EnumWindows(ByVal lpEnumFunc As EnumerateWindowsCallback, ByVal lParam As Integer) As Integer
     End Function


    ' 参考資料4: http://nonsoft.la.coocan.jp/SoftSample/VB.NET/SampleEnumWindows.html
     Private Delegate Function D_EnumWindowsProc(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer
     Private Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As D_EnumWindowsProc, ByVal lParam As Integer) As Integer
記事No.90434 のレス /過去ログ156より / 関連記事表示
削除チェック/



<< 0 >>

パスワード/

- Child Tree -