Status monitor query

Win32 Programming

    Next

  • 1. Finally got BitBlt working in vb.net - now have a SEVERE memory le
    I am executing the following code: Dim tilesLand As New Bitmap("tiles\tileset.png") Dim landTiles As Graphics = Graphics.FromImage(tilesLand) Dim mapMain As Graphics = picMain.CreateGraphics() Dim lDC As IntPtr = landTiles.GetHdc Dim mDC As IntPtr = mapMain.GetHdc Dim hOld As IntPtr = SelectObject(lDC, tilesLand.GetHbitmap) BitBlt(mDC, 0, 0, 32, 32, lDC, 0, 0, &HCC0020) 'srccopy SelectObject(lDC, hOld) landTiles.ReleaseHdc(lDC) mapMain.ReleaseHdc(mDC) landTiles.Dispose() mapMain.Dispose() While I'm thrilled that it's FINALLY doing BitBlt correctly with my in-memory image, I've noticed that it's creating a 1.2mb memory leak every time the routine is executed. I'm sure there's an object that I'm not deleting, but I can't figure out what's missing. Any help?
  • 2. Can metafiles represent structure?
    I have a GDI+ application that draws an image that has a structure I'd like to represent - for simplicity, let's say that the picture is a box containing three boxes, each containing text. I'd like to export this is as a metafile or enhanced metafile to MS Office or to a program like Adobe Illustrator. Additionally, I'd like to be able to manipulate the pictures inside those applications a bit - recoloring, changing fonts, etc. What I'd really like is to preserve the structure of the document - i.e. the whole drawing is a group, which when ungrouped is then composed of three groups (each group is a box containing its text). When these are ungrouped I'm down to individual drawing primitives. Ideally, I'd like to be able to build up more complex drawings in this manner as well. I tried using BeginContainer()/EndContainer(), but the Office suite doesn't seem to recognize these as grouping constructs. Is there a way to represent this using WMF or EMF? Thanks for your input! Andrew
  • 3. Gdi+, GraphichsPath.GetBounds() bug?
    I am getting confused about the GraphicsPath.GetBounds() method. It doesn return always the value, what you expect to be. Just a simple example: //--------------------------------------------------------------------------------------------- GraphicsPath path = new GraphicsPath(); path.AddEllipse(new Rectangle( 0,0,200,200));//Just a circle by radius 100 // Next returns Width = Height= 200 , That is OK! Rectangle bounds = Rectangle.Round(path.GetBounds()); Matrix m = new Matrix(); m.RotateAt( 45,new Point(100,100),MatrixOrder.Append); path.Transform(m); // Next returns Width = Height= 220, That is NOT OK! bounds = Rectangle.Round(path.GetBounds()) //--------------------------------------------------------------------------------------------- It is just a circle. When you rotate a circle, the width and height should never change. I mean, this was just a simple example. It happens in very different scenarios too. I am doing very complex mathematical calculations based on GraphicsPath.GetBounds() method, like scaling the figure after rotation based on the returned bound. In this case, the bounds of the scaled circle is not that, what I expect to be. Am I missing something or is this due a bug in .Net Framework? ERDAL

Status monitor query

Postby Nitin » Thu, 10 Feb 2005 21:44:14 GMT

Hi,
I am writing a printer driver and status monitor on Windows-XP. I tried to 
get the printer status through IBidiSpl and IBidiRequest Bidi interfaces. 
The BindDevice function is failing and the error message says "Printer name 
is invalid", but when I call OpenPrinter API with the same printer name, it 
returns the printer handle successfully.
If anybody have any idea why BindDevice API call fails, please let me know.

Thanks,
Nitin 




Return to Win32 Programming

 

Who is online

Users browsing this forum: No registered users and 20 guest