|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to convert this code from C# to VB.NET?I think it is because I am not calling it correctly. The C# code that works: [DllImport("PerlinDLL.dll")] static extern unsafe void GeneratePerlinTexture(void *ARGB32_pixels, int w, int h); ....later... BitmapData bmData; Rectangle rect = new Rectangle(0,0,bmp_ARGB32.Width,bmp_ARGB32.Height); bmData = bmp_ARGB32.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); GeneratePerlinTexture(bmData.Scan0.ToPointer(), bmp_ARGB32.Width, bmp_ARGB32.Height); bmp_ARGB32.UnlockBits(bmData); What I've done in VB.NET: Declare Sub GeneratePerlinTexture Lib "Perlindll.dll" Alias "GeneratePerlinTexture" (ByVal ARGB32_pixels As System.IntPtr, ByVal x As Integer, ByVal y As Integer) ....later... Dim bmData As Drawing.Imaging.BitmapData Dim rect = New Rectangle(0, 0, my_bitmap.Width, my_bitmap.Height) bmData = my_bitmap.LockBits(rect, Imaging.ImageLockMode.ReadWrite, Imaging.PixelFormat.Format32bppArgb) GeneratePerlinTexture(bmData.Scan0, my_bitmap.Width, my_bitmap.Height) 'Hangs here my_bitmap.UnlockBits(bmData) I have the source code for the DLL if needed. I cannot figure it out! Thank you if you can help. Chris Chris
On this site somewhere is a list of C# to VB.NET convertors Crouchie1998 BA (HONS) MCP MCSE "Crouchie1998" <crouchie1998@spamcop.net> schrieb: ?!?> On this site somewhere is a list of C# to VB.NET convertors The OP already supplied VB.NET code... -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> I've tried some converters, they do not work. Some just spit out the same
c# code with no explanation. Thank you! Chris Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:u4$LpSbfFHA.3936@tk2msftngp13.phx.gbl... > "Crouchie1998" <crouchie1998@spamcop.net> schrieb: >> On this site somewhere is a list of C# to VB.NET convertors > > ?!? > > The OP already supplied VB.NET code... > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> I would just make sure that you values being passed to the
GeneratePerlinTexture are correct. ie Make sure that my_bitmap.Width contains the actual width of the rect. Show quoteHide quote "Chris" <j**@shmoe.com> wrote in message news:u1bOVgbfFHA.2152@TK2MSFTNGP14.phx.gbl... > I've tried some converters, they do not work. Some just spit out the same > c# code with no explanation. > Thank you! > Chris > > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message > news:u4$LpSbfFHA.3936@tk2msftngp13.phx.gbl... >> "Crouchie1998" <crouchie1998@spamcop.net> schrieb: >>> On this site somewhere is a list of C# to VB.NET convertors >> >> ?!? >> >> The OP already supplied VB.NET code... >> >> -- >> M S Herfried K. Wagner >> M V P <URL:http://dotnet.mvps.org/> >> V B <URL:http://classicvb.org/petition/> > > The on-line converters have a lot of issues - try our Instant VB C# to VB.NET
converter, downloadable from www.instantvb.com David Anton www.tangiblesoftwaresolutions.com Home of: Instant C#: VB.NET to C# Converter Instant VB: C# to VB.NET Converter Instant J#: VB.NET to J# Converter Show quoteHide quote "Chris" wrote: > I've tried some converters, they do not work. Some just spit out the same > c# code with no explanation. > Thank you! > Chris > > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message > news:u4$LpSbfFHA.3936@tk2msftngp13.phx.gbl... > > "Crouchie1998" <crouchie1998@spamcop.net> schrieb: > >> On this site somewhere is a list of C# to VB.NET convertors > > > > ?!? > > > > The OP already supplied VB.NET code... > > > > -- > > M S Herfried K. Wagner > > M V P <URL:http://dotnet.mvps.org/> > > V B <URL:http://classicvb.org/petition/> > > > just a stab here, but the c# code has an unsafe void - i didnt think that
vb.net supported unsafe code. might that be the problem? aware of my ignorance, gabe Show quoteHide quote "Chris" wrote: > When I run this code in VB.NET, it hangs on the GeneratePerlinTexture call. > I think it is because I am not calling it correctly. > > The C# code that works: > > [DllImport("PerlinDLL.dll")] > static extern unsafe void GeneratePerlinTexture(void *ARGB32_pixels, int w, > int h); > > ....later... > > BitmapData bmData; > Rectangle rect = new Rectangle(0,0,bmp_ARGB32.Width,bmp_ARGB32.Height); > bmData = bmp_ARGB32.LockBits(rect, ImageLockMode.ReadWrite, > PixelFormat.Format32bppArgb); > GeneratePerlinTexture(bmData.Scan0.ToPointer(), bmp_ARGB32.Width, > bmp_ARGB32.Height); > bmp_ARGB32.UnlockBits(bmData); > > > > What I've done in VB.NET: > > Declare Sub GeneratePerlinTexture Lib "Perlindll.dll" Alias > "GeneratePerlinTexture" (ByVal ARGB32_pixels As System.IntPtr, ByVal x As > Integer, ByVal y As Integer) > > ....later... > > Dim bmData As Drawing.Imaging.BitmapData > Dim rect = New Rectangle(0, 0, my_bitmap.Width, my_bitmap.Height) > bmData = my_bitmap.LockBits(rect, Imaging.ImageLockMode.ReadWrite, > Imaging.PixelFormat.Format32bppArgb) > GeneratePerlinTexture(bmData.Scan0, my_bitmap.Width, my_bitmap.Height) > 'Hangs here > my_bitmap.UnlockBits(bmData) > > > > I have the source code for the DLL if needed. > I cannot figure it out! > Thank you if you can help. > > Chris > > >
System.Web.Mail.Smtp namespace
INI or XML Get names of opened windows and their process name manged alternative to get the complete text from each open window Adding desktop shortcuts and start program entries ApplicationDomains Intellisense question reference dependency warnings during build is there way to send email throught outlook express without mapi controls ? user control and events |
|||||||||||||||||||||||