tagCANDY CGI VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
[ツリー表示へ]  [ワード検索]  [Home]

タイトル Re^2: VB6.0で使用したDLLをVB.NETで使用したい
投稿日: 2007/07/31(Tue) 09:07
投稿者まいど
> > ソースは"declare"を使用しています。
> > 何か必要な設定等があるのでしょうか?
> > ソース自体はほぼVB6.0からコピーする形でコーディングしました。
>
> VB6とVB.NETでは結構変わっていますので、VB6のソースそのままでは問題があることがほとんどです。
> Declareで宣言して使用している外部DLLの場合、
> Declare文、および、それを使用している箇所のコードの見直しが必要です。
>
> 例えば、VB6のLong(32bit)はVB.NETのLong(64bit)と型のサイズが異なります。
> こういった場合にVB.NETではInteger(32bit)を使う必要のある場合が多いです。
> #より適切な型を利用するにはそのDLLのC言語などでの宣言をみないとわからない場合もあります。
>
> > よろしくお願いします。
>
> Declareを使う場合に関係する変更点はいくつかありますので、
> Declareで宣言している箇所とその関数を利用している箇所付近の関連ソースを
> みないとこれくらいしか言えないですね。

ありがとうございます。色々勉強になります。
ソースの方を掲載します。(DLLはオリジナルなので、名称等は記載できません。申し訳ない)。他の名称で何のソースか分かるかもしれませんが…
************************************************************Mojule@
    Structure SIDE_STATUS
        Dim mem0 As Long        
        Dim mem1 As Long              
        Dim mem2 As Long              
        Dim mem3 As Long              
        Dim mem4 As Long              
        Dim mem5 As Long              
    End Structure

    Structure CARD_STATUS
        Dim status As Long                
        Dim state() As Long                  
        Dim ScannerName() As Byte    
        Dim ScannerVer() As Byte      
        Dim SerialNumber() As Byte    
        Dim FirmVer() As Byte        
        Dim Ri10_1Ver() As Byte      
        Dim Ri10_2Ver() As Byte      
        Dim FPGA_Ver() As Byte        
        Dim side() As SIDE_STATUS      )
    End Structure

    Structure CARD_STATUS_OCR
        Dim CARDSTATUS As CARD_STATUS                        
        Dim fullname() As Byte
        Dim birthday() As Byte
        Dim domicile() As Byte
        Dim address() As Byte
        Dim grantday() As Byte
        Dim validity() As Byte
        Dim license() As Byte
        Dim acquisition1() As Byte
        Dim acquisition2() As Byte
        Dim acquisition3() As Byte
        Dim condition() As Byte
    End Structure

    Public Structure BITMAPFILEHEADER
        Dim bfType As Integer
        Dim bfSize As Long
        Dim bfReserved1 As Integer
        Dim bfReserved2 As Integer
        Dim bfOffBits As Long
    End Structure

    Public Structure BITMAPINFOHEADER
        Dim biSize As Long
        Dim biWidth As Long
        Dim biHeight As Long
        Dim biPlanes As Integer
        Dim biBitCount As Integer
        Dim biCompression As Long
        Dim biSizeImage As Long
        Dim biXPelsPerMeter As Long
        Dim biYPelsPerMeter As Long
        Dim biClrUsed As Long
        Dim biClrImportant As Long
    End Structure
    Public Structure RGBQUAD
        Dim rgbBlue As Byte
        Dim rgbGreen As Byte
        Dim rgbRed As Byte
        Dim rgbReserved As Byte
    End Structure
    Public Structure BITMAPINFO
        Dim bmiHeader As BITMAPINFOHEADER
        Dim bmiColors() As RGBQUAD
    End Structure

    Declare Function CardScanStart Lib "aaaaa" (ByVal crdSts As CARD_STATUS_OCR) As Long
************************************************************Form@
    Dim lngRst As Long
    Dim crdStsOcr As CARD_STATUS_OCR
    Private Sub RD_Timer_Tick(ByVal sender As System.Object,
        _ByVal e As System.EventArgs) Handles RD_Timer.Tick
        lngRst = CardScanStart(crdStsOcr) ←実行時のエラー発生箇所
    End Sub
************************************************************

こんな感じなのですが…VB6.0のコードをほぼそのままで、.NETに移行した感じです。よろしくお願いします。

- 関連一覧ツリー をクリックするとツリー全体を一括表示します)

古いスレッドにレスはつけられません。