   [.net] Hoping to upgrade a project to .NET, but... [SOLVED]
  Yesterday I downloaded VB.NET 2005 Express from MS and was wondering how it would like opening my VB6 project. It tried to convert it but ended up with a number of errors.The problem I have is that VB.NET doesn't seem to support hDC like VB6 did, so the hundreds of places I relied on Me.hDC received errors. So, without rewriting my project from scratch, is there any way to use a function like BitBlt with VB.NET (or what would .NET use)? Eventually I'm going to port it over to C#, but I wanted to handle a few of the bugs and get it running first.Thanks and your suggestions are much appreciated![Edited by - nprz on December 14, 2005 12:03:47 AM]
  What object were you getting the hDC from?   ;  You can get a hDC from the Graphics of a WinForms object (C#):Graphics g = this.CreateGraphics();IntPtr hDC = g.GetHdc();Just FYI, the new GDI+ stuff might be fast enough that BitBlt isn't necessary. I'm not sure though.   ;  I was getting the hDC from the Form. I also got it from PictureBox on a couple.I will have to look up this new GDI+ stuff. If it can do everything BitBlt could (transparencies and everything) then I'm all for it.   ;  As promit said, Graphics.GetHdc should work - it's a framework object.   ;  VB.NET is completely different then VB6, you're bound to get loads of errors.  What exactly are you doing with hDCs?  It might even be better to look at an alternative like the GDI+ or SDL.NET.   ;Quote:Original post by Rob LoachVB.NET is completely different then VB6, you're bound to get loads of errors.  What exactly are you doing with hDCs?  It might even be better to look at an alternative like the GDI+ or SDL.NET.It had an automatic conversion which converted the different function names, etc. The only things it couldn't fix were those that were not supported in VB.NET.I was using BitBlt with the hDC to manipulate my sprites (the method used before DirectX was popular [smile]).I started using GDI+, but it started generating "Out of Memory" errors and I don't know if it is reallocating memory each time I make a call to draw it or what.After I find a job and get settled down, I plan on just rewriting the code for C# or maybe C++ and using OpenGL just because I did very inefficient code (reallocate memory each time I added 1, but now I'd just use something like a vector or map).Something was fishy just creating a graphic and calling GetHDC though. I'll take another stab at it Friday or Saturday.   ;  To my knowledge, the Tao Framework implements a Tao.Platform.Windows which holds .NET bindings to methods like BitBlt for you.My recommendation, though, would be against BitBlt-ing and to use SDL.NET.  So much easier then dealing with IntPtrs. [wink]   