掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
VB .netのexeからVC++ 6.0で作成したDLLに含まれる関数をコールするときのエラーをなくすには? (ID:77047)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
当方では、以下のコードが動作しましたが、そちらでは如何でしょうか? '======== Form1.vb ======== Option Explicit On Option Strict On Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows フォーム デザイナで生成されたコード " ' (中略) #End Region Private Sub Button1_Click( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click MessageBox.Show(GetDesktopWindow().ToString("x")) End Sub End Class '======== Module1.vb ======== Option Explicit On Option Strict On Module Module1 Friend Declare Function GetDesktopWindow Lib "USER32" () As Integer End Module もし、上記の「GetDesktopWindow」の部分を、自作のアンマネージDLLに 置き換えてみて動かないようであれば、そのDLLが StdCall規約に なっているか否かを確認してみてください。 ****別の書き方 '======== Module1.vb ======== Option Explicit On Option Strict On Module Module1 <System.Runtime.InteropServices.DllImport("USER32.DLL", _ EntryPoint:="GetDesktopWindow", _ CallingConvention:=System.Runtime.InteropServices.CallingConvention.StdCall)> _ Friend Function GetDesktopWindow() As Integer End Function End Module
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.