掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
GetObjectでのbiSizeImageの値が出ない (ID:91140)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
長文ですみません。 どこに問題があるのかわからないので、全部書かせてください。 GetObjectでbmpファイルのbiSizeImageが0になるのです。 どこに問題があるのかわかりません。 どなたかご教授願います。 環境はWindowsXP、VisualBasic.NET2003、Microsoft.NET Frameworks 1.1です。 よろしくお願いします。 ---プログラム--- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim file = "C:\image.bmp" Dim hbmp As IntPtr = win32.LoadImage(IntPtr.Zero, file, win32.IMAGE_BITMAP, 0, 0, win32.LR_LOADFROMFILE) Dim bmi As win32.BITMAPINFO Dim res As Integer = win32.GetObject(hbmp, Marshal.SizeOf(bmi), bmi) MsgBox(bmi.bmiHeader.biSizeImage) Application.Exit() End Sub Class win32 <DllImport("user32.dll", EntryPoint:="LoadImageA", SetLastError:=True)> _ Public Shared Function LoadImage( _ ByVal hinst As IntPtr, _ ByVal lpszName As String, _ ByVal uType As Integer, _ ByVal cxDesired As Integer, _ ByVal cyDesired As Integer, _ ByVal fuLoad As Integer _ ) As IntPtr End Function <DllImport("gdi32.dll", SetLastError:=True)> _ Public Shared Function GetObject( _ ByVal hgdiobj As IntPtr, _ ByVal cbBuffer As Integer, _ ByRef lpvObject As BITMAPINFO _ ) As Integer End Function Public Const IMAGE_BITMAP = 0 Public Const LR_LOADFROMFILE = &H10 <StructLayout(LayoutKind.Sequential)> _ Public Structure BITMAPINFOHEADER Dim biSize As Integer Dim biWidth As Integer Dim biHeight As Integer Dim biPlanes As Short Dim biBitCount As Short Dim biCompression As Integer Dim biSizeImage As Integer Dim biXPelsPerMeter As Integer Dim biYPelsPerMeter As Integer Dim biClrUsed As Integer Dim biClrImportant As Integer End Structure <StructLayout(LayoutKind.Sequential)> _ Public Structure RGBQUAD Dim rgbBlue As Byte Dim rgbGreen As Byte Dim rgbRed As Byte Dim rgbReserved As Byte End Structure <StructLayout(LayoutKind.Sequential)> _ Public Structure BITMAPINFO Dim bmiHeader As BITMAPINFOHEADER Dim bmiColors As RGBQUAD End Structure End Class
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.