By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,557 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,557 IT Pros & Developers. It's quick & easy.

Uint data type in VB.NET when calling a DLL

P: n/a
I have converted the code shown below from C#. My problem involves the uint
data type. When converted to VB.NET it becomes: Uint32 and causes two
compile errors. The error message in VB.NET involves not being able to
convert between Uint32 and Integer. The error messages occur in the two Dim
statements in the VB.NET GetRtfImage() method.

I can make the code compile by changing Uint32 to Int32 but will this
conversion make the dll not respond properly? Is there another solution? I
am not sure how important an unsigned integer is to the referenced dll.

partial C# code:
[DllImportAttribute("gdiplus.dll")]
private static extern uint GdipEmfToWmfBits (IntPtr _hEmf, uint _bufferSize,
byte[] _buffer, int _mappingMode, EmfToWmfBitsFlags _flags);

When converted to VB.NET and stripped of non essential code, I end up with:

Private Shared Function GdipEmfToWmfBits(ByVal bufferSize As System.UInt32)
As System.UInt32
End Function

Private Sub GetRtfImage(ByVal image As Image)
Dim bufferSize As System.UInt32 = GdipEmfToWmfBits(0)
Dim buffer(bufferSize) As Byte
End Sub
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"genojoe" <ge*****@discussions.microsoft.com> schrieb:
I can make the code compile by changing Uint32 to Int32 but will this
conversion make the dll not respond properly? Is there another solution?
I
am not sure how important an unsigned integer is to the referenced dll.

partial C# code:
[DllImportAttribute("gdiplus.dll")]
private static extern uint GdipEmfToWmfBits (IntPtr _hEmf, uint
_bufferSize,
byte[] _buffer, int _mappingMode, EmfToWmfBitsFlags _flags);

When converted to VB.NET and stripped of non essential code, I end up
with:

Private Shared Function GdipEmfToWmfBits(
Your declare is wrong. Take a look at the code in the following post:

<URL:http://www.google.es/groups?selm=O83X1zVgEHA.704%40TK2MSFTNGP12.phx.gbl >
Private Sub GetRtfImage(ByVal image As Image)
Dim bufferSize As System.UInt32 = GdipEmfToWmfBits(0)

Dim buffer(bufferSize) As Byte


'Dim buffer(Convert.ToInt32(bufferSize)) As Byte'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.