Ok. I copied all of my code from my aspx page and put it
into my simple .Net Windows app form. I have 1 picturebox
and one button the form. I cleaned the code up (getting
rid of Response.Writes and commenting out writing the
bitmap to a file, etc...) and directed everything to the
picturebox using your "Graphics.FromHwnd" suggestion. I
referenced my vb6 dll (the real one, not the simple one)
and ran the app. It worked! I got what I expected in the
picturebox.
Excellent! And more frustrating than ever...
I need this to happen on an ASPX page. Grrrr..
[color=blue]
>-----Original Message-----[color=green]
>> Is a GRAPHICS.getHdc.ToInt32 an integer representation[/color][/color]
of a[color=blue][color=green]
>> bitmap's hdc? One that VB6 can use...[/color]
>
>Yes, at least theoretically it is. And there are[/color]
some 'BUT's:[color=blue]
>
>1. A bitmap by itself cannot have HDC. In raw GDI terms,[/color]
it can be[color=blue]
>*selected* into some HDC, and then one can perform[/color]
drawing on it or blit it[color=blue]
>to another HDC. The .NET's representation of HDC is the[/color]
Graphics class.[color=blue]
>
>2. I suppose your problem is not related to HDC[/color]
correctness. The code[color=blue]
>snippet you have given in the latest post looks[/color]
absolutely fine - except[color=blue]
>that I'd recommend releasing the HDC *before* you attempt[/color]
to save the[color=blue]
>bitmap. I wonder if you could paste this snippet into a[/color]
simple Windows Forms[color=blue]
>application and test it there first. If it works that[/color]
way, the problem is[color=blue]
>obviously not with the HDC, but with threading I assume.
>
>3. Mind the color depth. The Bitmap instance you've[/color]
created has 32-bit color[color=blue]
>depth by default (unless requested otherwise in the[/color]
constructor) and make[color=blue]
>sure your VB6 DLL can handle such bitmaps right.
>
>--
>Dmitriy Lapshin [C# / .NET MVP]
>X-Unity Test Studio
>
http://x-unity.miik.com.ua/teststudio.aspx
>Bring the power of unit testing to VS .NET IDE
>
>"Metallicraft" <anonymous@discussions.microsoft.com>[/color]
wrote in message[color=blue]
>news:0a5601c3a53d$5f9b57b0$a601280a@phx.gbl...[color=green]
>> Let me start off by saying thank you for sticking with[/color][/color]
me[color=blue][color=green]
>> for the last few days, I really appreciate your time.
>>
>> On to your last post....that's great. Now I know how to
>> draw to form and control objects in .net using a gdi32[/color][/color]
api.[color=blue][color=green]
>>
>> However, I tried tweaking what you sent to get a usable
>> hdc from a bitmap and I couldn't.
>>
>> Based on my previous question (and the first thing you
>> responded to in your last post)... Is a
>> GRAPHICS.getHdc.ToInt32 an integer representation of a
>> bitmap's hdc? One that VB6 can use... Remember my
>> original problem:
>>
>> Dim bm As Bitmap = New Bitmap(728, 312)
>> Dim gfx As Graphics = Graphics.FromImage(bm)
>> gfx.Clear(Color.White)
>> Dim gfxhDC As IntPtr = gfx.GetHdc()
>> prt.hdc = gfxhDC.ToInt32
>> prt.Draw
>> bm.Save(sTempFile,
>> System.Drawing.Imaging.ImageFormat.Bmp)
>> bm.Dispose()
>> gfx.ReleaseHdc(gfxhDC)
>>
>> Where prt.hdc is the property in my vb6 dll that holds[/color][/color]
the[color=blue][color=green]
>> device context to draw to and prt.Draw tells the vb6 dll
>> to go ahead and draw its data to the given hdc.
>>[color=darkred]
>> >-----Original Message-----
>> >> where Handle.ToInt32 is the integer representation of[/color]
>> the[color=darkred]
>> >> handle...which is the object's hDc, is this not true?
>> >
>> >Handle.ToInt32 _IS_ the integer representation of a[/color]
>> handle, but Form.Handle[color=darkred]
>> >is a window handle (HWND),
>> >not a GDI device context handle (HDC). To obtain an HDC[/color]
>> for a form or a[color=darkred]
>> >control, you should employ
>> >the Graphics class and contruct it by using the static[/color]
>> FromHwnd method:[color=darkred]
>> >
>> >Dim g AsGraphics = Graphics.FromHwnd(Me.Handle)
>> >
>> >Dim hdc As IntPtr = g.GetHdc()
>> >TextOut(hdc, 100, 100, "TESTING", 7)
>> >g.ReleaseHdc(hdc)
>> >
>> >--
>> >Dmitriy Lapshin [C# / .NET MVP]
>> >X-Unity Test Studio
>> >
http://x-unity.miik.com.ua/teststudio.aspx
>> >Bring the power of unit testing to VS .NET IDE
>> >
>> >"Metallicraft" <anonymous@discussions.microsoft.com>[/color]
>> wrote in message[color=darkred]
>> >news:0c4d01c3a47a$26d38e70$a501280a@phx.gbl...
>> >> I understand what you're saying about the HDC and[/color][/color][/color]
HWND,[color=blue][color=green][color=darkred]
>> >> but I thought Handle.ToInt32 was the same as[/color][/color][/color]
Integer...[color=blue][color=green][color=darkred]
>> >> where Handle.ToInt32 is the integer representation of[/color]
>> the[color=darkred]
>> >> handle...which is the object's hDc, is this not true?
>> >>
>> >> When I'd pass a Handle to the TextOut API, I have the[/color]
>> hDc[color=darkred]
>> >> in the TextOut declaration defined as an IntPtr. Are
>> >> Handle and IntPtr different?
>> >>
>> >> If not, how would one declare the TextOut, for[/color][/color][/color]
example,[color=blue][color=green][color=darkred]
>> >> and what would be passed to the hDc parameter?
>> >>
>> >> Maybe that's not important because the REAL dll I'm[/color]
>> trying[color=darkred]
>> >> to get to work cannot be changed. So I need to know[/color][/color][/color]
if[color=blue][color=green]
>> I[color=darkred]
>> >> can pass a .Net-something into a VB6 Long variable[/color][/color][/color]
and[color=blue][color=green][color=darkred]
>> >> have them both be refering to the same hDc.
>> >>
>> >> I understand what you mean about the single-[/color][/color][/color]
threading,[color=blue][color=green]
>> but[color=darkred]
>> >> I'm still not sure where the "<STAThread()>" would[/color][/color][/color]
go or[color=blue][color=green][color=darkred]
>> >> how it's used. I have very little experience dealing[/color]
>> with[color=darkred]
>> >> threads.
>> >>
>> >> >-----Original Message-----
>> >> >Just to be safe: HDC and HWND are NOT the same and[/color][/color][/color]
are[color=blue][color=green][color=darkred]
>> >> NOT interchangeable.
>> >> >And therefore neither of the below will work as it[/color]
>> seems[color=darkred]
>> >> you are passing
>> >> >HWND
>> >> >where HDC is expected.
>> >> >
>> >> >> hDc As IntPtr and TextOut(Me.Handle, etc....
>> >> >>
>> >> >> -AND-
>> >> >>
>> >> >> hDc As Integer and TextOut(Me.Handle.ToInt32,[/color][/color][/color]
etc...[color=blue][color=green][color=darkred]
>> >> >
>> >> >From my experience there's no big difference whether[/color]
>> you[color=darkred]
>> >> declare an API
>> >> >function parameter as Int32 or IntPtr (the latter is
>> >> preferred as you'll
>> >> >avoid explicit type casts in your code) - both ways[/color]
>> work.[color=darkred]
>> >> >
>> >> >> I'm afraid I don't understand your last question
>> >> >> about "[STAThread]".
>> >> >
>> >> >Oops, it's C# syntax. In VB .NET it should look like
>> >> <STAThread()> or
>> >> >something like that. It's an attribute that[/color][/color][/color]
indicated[color=blue][color=green]
>> the[color=darkred]
>> >> application is
>> >> >single-thread and no call to a COM object will be
>> >> originated by a thread
>> >> >other that the main one. This is important to the[/color][/color][/color]
COM[color=blue][color=green][color=darkred]
>> >> subsystem to ensure
>> >> >instantiated COM objects (and your VB6 DLL is an[/color]
>> ActiveX[color=darkred]
>> >> DLL, isn't it?) run
>> >> >in the expected apartment. This is STA in case of[/color][/color][/color]
VB6[color=blue][color=green][color=darkred]
>> >> ActiveX DLLs.
>> >> >
>> >> >--
>> >> >Dmitriy Lapshin [C# / .NET MVP]
>> >> >X-Unity Test Studio
>> >> >
http://x-unity.miik.com.ua/teststudio.aspx
>> >> >Bring the power of unit testing to VS .NET IDE
>> >> >
>> >> >"Metallicraft" <anonymous@discussions.microsoft.com>
>> >> wrote in message
>> >> >news:0a9201c3a470$087fc6f0$a601280a@phx.gbl...
>> >> >> Me.Handle refers to the form's handle when I[/color][/color][/color]
tried to[color=blue][color=green][color=darkred]
>> >> just
>> >> >> TextOut to the form instead of a PictureBox. I do
>> >> believe
>> >> >> it's an hWnd. You'll note in the declaration:
>> >> >>
>> >> >>[/color][/color][/color]
<System.Runtime.InteropServices.DllImportAttribu te[color=blue][color=green][color=darkred]
>> >> >> ("gdi32.dll")> _
>> >> >> Private Shared Function TextOut(ByVal hdc As[/color][/color][/color]
IntPtr,[color=blue][color=green][color=darkred]
>> >> >> ByVal X As Integer, ByVal Y As Integer, ByVal
>> >> lpString
>> >> >> As String, ByVal nCount As Integer) As Integer
>> >> >> End Function
>> >> >>
>> >> >> ...hdc is defined as an "IntPtr". I've seen this[/color]
>> done[color=darkred]
>> >> in
>> >> >> many examples with APIs that require an hDc that's
>> >> >> normally a Long type, though I don't understand[/color][/color][/color]
how[color=blue][color=green][color=darkred]
>> >> people
>> >> >> can just change the API declaration like that and[/color]
>> have[color=darkred]
>> >> it
>> >> >> still work (I always thought API declarations were[/color]
>> very[color=darkred]
>> >> >> strict). Nevertheless, I've tried it both ways:
>> >> >>
>> >> >> hDc As IntPtr and TextOut(Me.Handle, etc....
>> >> >>
>> >> >> -AND-
>> >> >>
>> >> >> hDc As Integer and TextOut(Me.Handle.ToInt32,[/color][/color][/color]
etc...[color=blue][color=green][color=darkred]
>> >> >>
>> >> >> Neither work.
>> >> >>
>> >> >> I'm afraid I don't understand your last question
>> >> >> about "[STAThread]".
>> >> >>
>> >> >> >-----Original Message-----
>> >> >> >> I understand that Object.GetHdc is a pointer,[/color][/color][/color]
but[color=blue][color=green]
>> is[color=darkred]
>> >> >> >> Object.GetHdc.ToInt32 the same as a gdi32[/color][/color][/color]
device[color=blue][color=green][color=darkred]
>> >> context
>> >> >> >> or vb6 picturebox.hdc?
>> >> >> >
>> >> >> >Yes, they SHOULD be the same according to MSDN.[/color][/color][/color]
But:[color=blue][color=green][color=darkred]
>> >> >> >
>> >> >> >> ...to the top and in a button_click adding[/color][/color][/color]
this:[color=blue][color=green][color=darkred]
>> >> >> >>
>> >> >> >> TextOut(Me.Handle, 100, 100, "TESTING", 7)
>> >> >> >
>> >> >> >What is Me.Handle here? I suppose it is actually[/color]
>> HWND[color=darkred]
>> >> and
>> >> >> not HDC?
>> >> >> >Does your static Main function is marked as[/color]
>> [STAThread][color=darkred]
>> >> >> by the way?
>> >> >> >
>> >> >> >--
>> >> >> >Dmitriy Lapshin [C# / .NET MVP]
>> >> >> >X-Unity Test Studio
>> >> >> >
http://x-unity.miik.com.ua/teststudio.aspx
>> >> >> >Bring the power of unit testing to VS .NET IDE
>> >> >> >
>> >> >> >"Metallicraft"[/color][/color][/color]
<anonymous@discussions.microsoft.com>[color=blue][color=green][color=darkred]
>> >> >> wrote in message
>> >> >> >news:0f8501c3a3bd$44102100$a501280a@phx.gbl...
>> >> >> >> Well, I've tried a couple different things.
>> >> >> >>
>> >> >> >> I created a vb6 dll with the following code:
>> >> >> >>
>> >> >> >> Option Explicit
>> >> >> >>
>> >> >> >> Private Declare Function TextOut Lib "gdi32"
>> >> >> >> Alias "TextOutA" (ByVal hdc As Long, ByVal X As[/color]
>> Long,[color=darkred]
>> >> >> >> ByVal Y As Long, ByVal lpString As String,[/color][/color][/color]
ByVal[color=blue][color=green][color=darkred]
>> >> nCount
>> >> >> As
>> >> >> >> Long) As Long
>> >> >> >>
>> >> >> >> Public Sub DrawText(ByRef hdc As Long)
>> >> >> >> Dim dl As Long
>> >> >> >> dl = TextOut(hdc, 0, 0, "TEST", Len[/color][/color][/color]
("TEST"))[color=blue][color=green][color=darkred]
>> >> >> >> End Sub
>> >> >> >>
>> >> >> >> ...and I compiled it.
>> >> >> >>
>> >> >> >> I then created a vb application (referencing[/color][/color][/color]
that[color=blue][color=green][color=darkred]
>> >> dll)
>> >> >> >> with the following code:
>> >> >> >>
>> >> >> >> Option Explicit
>> >> >> >>
>> >> >> >> Private Sub Form_Load()
>> >> >> >> Picture1.AutoRedraw = True
>> >> >> >>
>> >> >> >> Dim dt As DrawText.clsDrawText
>> >> >> >> Set dt = New DrawText.clsDrawText
>> >> >> >> dt.DrawText (Picture1.hDC)
>> >> >> >>
>> >> >> >> Picture1.Refresh
>> >> >> >> End Sub
>> >> >> >>
>> >> >> >> ...the form contains one picture box.
>> >> >> >>
>> >> >> >> When I run the app, I get the word "TEST" in[/color][/color][/color]
the[color=blue][color=green][color=darkred]
>> >> picture
>> >> >> >> box as I would expect.
>> >> >> >>
>> >> >> >> Next, I created a vb.net Windows app, with only[/color]
>> one[color=darkred]
>> >> >> form,
>> >> >> >> one button, and a picture box. I referenced my
>> >> simple
>> >> >> dll
>> >> >> >> above and the only code exists in the[/color]
>> button_click:[color=darkred]
>> >> >> >>
>> >> >> >> Dim dt As New DrawText.clsDrawTextClass
>> >> >> >> dt.DrawText(PictureBox1.Handle.ToInt32)
>> >> >> >> dt = Nothing
>> >> >> >>
>> >> >> >> PictureBox1.Refresh()
>> >> >> >>
>> >> >> >> ...I run the app, press the button, and get no[/color]
>> text.[color=darkred]
>> >> >> I've
>> >> >> >> tried this with and without the Refresh and[/color][/color][/color]
with[color=blue][color=green]
>> and[color=darkred]
>> >> >> >> without the PictureBox (using the form's handle
>> >> instead)
>> >> >> >> with the same results.
>> >> >> >>
>> >> >> >> I have also tried, in a vb.net app, adding[/color][/color][/color]
this:[color=blue][color=green][color=darkred]
>> >> >> >>
>> >> >> >>
>> >> <System.Runtime.InteropServices.DllImportAttribu te
>> >> >> >> ("gdi32.dll")> _
>> >> >> >> Private Shared Function TextOut(ByVal hdc[/color][/color][/color]
As[color=blue][color=green][color=darkred]
>> >> IntPtr,
>> >> >> >> ByVal X As Integer, ByVal Y As Integer, ByVal
>> >> lpString
>> >> >> As
>> >> >> >> String, ByVal nCount As Integer) As Integer
>> >> >> >> End Function
>> >> >> >>
>> >> >> >> ...to the top and in a button_click adding[/color][/color][/color]
this:[color=blue][color=green][color=darkred]
>> >> >> >>
>> >> >> >> TextOut(Me.Handle, 100, 100, "TESTING", 7)
>> >> >> >>
>> >> >> >> ...running it, pressing button, and getting no[/color]
>> text.[color=darkred]
>> >> >> >>
>> >> >> >> So, even taking my dll and the graphics object[/color]
>> out of[color=darkred]
>> >> >> the
>> >> >> >> equation, I can't get a gdi32 function, like
>> >> TextOut, to
>> >> >> >> write on a .Net device context.
>> >> >> >>
>> >> >> >> I understand that Object.GetHdc is a pointer,[/color][/color][/color]
but[color=blue][color=green]
>> is[color=darkred]
>> >> >> >> Object.GetHdc.ToInt32 the same as a gdi32[/color][/color][/color]
device[color=blue][color=green][color=darkred]
>> >> context
>> >> >> >> or vb6 picturebox.hdc?
>> >> >> >>
>> >> >> >> >-----Original Message-----
>> >> >> >> >You can try calling a raw GDI function through
>> >> P/Invoke
>> >> >> >> on the HDC obtained
>> >> >> >> >and see whether it works that way. If yes,[/color][/color][/color]
you at[color=blue][color=green][color=darkred]
>> >> least
>> >> >> >> know the HDC being
>> >> >> >> >passed is valid.
>> >> >> >> >
>> >> >> >> >There also could be problems with VB6 COM DLL
>> >> running
>> >> >> on
>> >> >> >> a separate thread
>> >> >> >> >(as it runs in the Single-Threaded Apartment[/color][/color][/color]
and[color=blue][color=green][color=darkred]
>> >> >> ASP .NET
>> >> >> >> is
>> >> >> >> >multi-threaded), and I am not sure HDCs can be
>> >> >> passed "as
>> >> >> >> is" between
>> >> >> >> >threads.
>> >> >> >> >
>> >> >> >> >--
>> >> >> >> >Dmitriy Lapshin [C# / .NET MVP]
>> >> >> >> >X-Unity Test Studio
>> >> >> >> >
http://x-unity.miik.com.ua/teststudio.aspx
>> >> >> >> >Bring the power of unit testing to VS .NET IDE
>> >> >> >> >
>> >> >> >> >"Metallicraft"[/color]
>> <anonymous@discussions.microsoft.com>[color=darkred]
>> >> >> >> wrote in message
>> >> >> >> >news:083501c3a3af$6ff09d30$a001280a@phx.gbl...
>> >> >> >> >> Thanks for responding.
>> >> >> >> >>
>> >> >> >> >> I dispose of my bitmap and release the dc[/color]
>> after I[color=darkred]
>> >> >> write
>> >> >> >> >> the bitmap to a file further down in the[/color]
>> code. I[color=darkred]
>> >> >> know
>> >> >> >> the
>> >> >> >> >> vb6 dll works in vb6. The vb6 dll is[/color]
>> production[color=darkred]
>> >> >> >> software
>> >> >> >> >> already working in the hands of hundreds of
>> >> clients.
>> >> >> >> >>
>> >> >> >> >> I can do a:
>> >> >> >> >>
>> >> >> >> >> gfx.DrawString("test", New Font[/color]
>> ("Arial",[color=darkred]
>> >> >> 24.0F),
>> >> >> >> >> Brushes.Black, 0, 0)
>> >> >> >> >> gfx.DrawRectangle(New Pen[/color][/color][/color]
(Color.Black),[color=blue][color=green][color=darkred]
>> >> New
>> >> >> >> >> Rectangle(2, 1, 725, 309))
>> >> >> >> >>
>> >> >> >> >> ...inside vb.net and get a bitmap with text[/color]
>> and a[color=darkred]
>> >> >> >> >> rectangle, but when passing the graphic's[/color][/color][/color]
hdc[color=blue][color=green][color=darkred]
>> >> >> >> >> (Graphic.GetHdc.ToInt32) I get no drawing
>> >> whatsoever
>> >> >> >> from
>> >> >> >> >> the vb6 dll.
>> >> >> >> >>
>> >> >> >> >> >-----Original Message-----
>> >> >> >> >> >Hi,
>> >> >> >> >> >
>> >> >> >> >> >You can try calling ReleaseDC after the VB6[/color]
>> dll[color=darkred]
>> >> has
>> >> >> >> >> finished drawing. The
>> >> >> >> >> >rest of .NET code looks correct. You might[/color]
>> also[color=darkred]
>> >> >> want to
>> >> >> >> >> debug your VB6 dll
>> >> >> >> >> >to see where it possibly fails.
>> >> >> >> >> >
>> >> >> >> >> >--
>> >> >> >> >> >Dmitriy Lapshin [C# / .NET MVP]
>> >> >> >> >> >X-Unity Test Studio
>> >> >> >> >> >
http://x-unity.miik.com.ua/teststudio.aspx
>> >> >> >> >> >Bring the power of unit testing to VS .NET[/color][/color][/color]
IDE[color=blue][color=green][color=darkred]
>> >> >> >> >> >
>> >> >> >> >> >"Metallicraft"
>> >> <anonymous@discussions.microsoft.com>
>> >> >> >> >> wrote in message
>> >> >> >> >> >news:066e01c3a3a4$58879370[/color][/color][/color]
$a001280a@phx.gbl...[color=blue][color=green][color=darkred]
>> >> >> >> >> >> I have a vb6 application. On the main[/color][/color][/color]
form[color=blue][color=green]
>> is a[color=darkred]
>> >> >> >> picture
>> >> >> >> >> >> box with one or two images and several[/color]
>> pieces[color=darkred]
>> >> of
>> >> >> text
>> >> >> >> >> >> displayed in it. These are created on the[/color]
>> fly[color=darkred]
>> >> >> using
>> >> >> >> >> gdi32
>> >> >> >> >> >> routines that are all in a referenced,[/color]
>> custom[color=darkred]
>> >> >> dll. I
>> >> >> >> >> call
>> >> >> >> >> >> a PrintImage routine in the dll and pass[/color][/color][/color]
it[color=blue][color=green][color=darkred]
>> >> only
>> >> >> the
>> >> >> >> the
>> >> >> >> >> >> Picturebox.hdc from the main form. The[/color][/color][/color]
dll's[color=blue][color=green][color=darkred]
>> >> print
>> >> >> >> >> routine
>> >> >> >> >> >> draws to the hdc and it shows up in the
>> >> picturebox
>> >> >> >> >> >> perfectly.
>> >> >> >> >> >>
>> >> >> >> >> >> I would like to do a similar thing with[/color][/color][/color]
an[color=blue][color=green][color=darkred]
>> >> asp.net
>> >> >> >> page
>> >> >> >> >> >> using my same vb6 custom printing dll.[/color][/color][/color]
Where[color=blue][color=green][color=darkred]
>> >> >> >> >> Display.aspx
>> >> >> >> >> >> has and IMG tag with src="Image.aspx".[/color][/color][/color]
Now,[color=blue][color=green]
>> in[color=darkred]
>> >> the
>> >> >> >> >> >> Image.aspx.vb code, I make the necessary[/color]
>> calls[color=darkred]
>> >> to
>> >> >> my
>> >> >> >> dll
>> >> >> >> >> >> to preload some data, then I call the
>> >> PrintImage
>> >> >> >> >> routine.
>> >> >> >> >> >> What I get back is a black box. Since[/color][/color][/color]
it's[color=blue][color=green]
>> an[color=darkred]
>> >> >> asp.net
>> >> >> >> >> page
>> >> >> >> >> >> I don't have a picturebox to draw to[/color][/color][/color]
(even[color=blue][color=green]
>> if I[color=darkred]
>> >> >> did,
>> >> >> >> I'm
>> >> >> >> >> >> not sure the picturebox's Handle would be[/color]
>> the[color=darkred]
>> >> >> same as
>> >> >> >> >> >> vb6's hdc). So I'm trying to create a[/color][/color][/color]
bitmap[color=blue][color=green][color=darkred]
>> >> >> in .net
>> >> >> >> >> where
>> >> >> >> >> >> i can eventually get an hdc that I can[/color][/color][/color]
send[color=blue][color=green]
>> to[color=darkred]
>> >> my
>> >> >> >> >> printing
>> >> >> >> >> >> routine in the vb6 dll. Below is the[/color][/color][/color]
code I[color=blue][color=green]
>> use[color=darkred]
>> >> >> to do
>> >> >> >> >> this:
>> >> >> >> >> >>
>> >> >> >> >> >> Dim bm As Bitmap = New Bitmap(728, 312)
>> >> >> >> >> >> Dim gfx As Graphics = Graphics.FromImage[/color][/color][/color]
(bm)[color=blue][color=green][color=darkred]
>> >> >> >> >> >> gfx.Clear(Color.White)
>> >> >> >> >> >> Dim hDC As IntPtr = gfx.GetHdc()
>> >> >> >> >> >> prt.hdc = hDC.ToInt32 'prt.hdc is the[/color]
>> property[color=darkred]
>> >> in
>> >> >> my
>> >> >> >> vb6
>> >> >> >> >> >> dll that receives the hdc to print to
>> >> >> >> >> >>
>> >> >> >> >> >> The code runs without error, I save the[/color]
>> bitmap[color=darkred]
>> >> to
>> >> >> a
>> >> >> >> >> file,
>> >> >> >> >> >> read it into a bytearray, and do a
>> >> >> >> >> >> Response.Binarywrite...I get a black box[/color]
>> (well,[color=darkred]
>> >> >> now I
>> >> >> >> >> get
>> >> >> >> >> >> a white box since I added the gfx.Clear[/color][/color][/color]
line[color=blue][color=green][color=darkred]
>> >> >> above).
>> >> >> >> >> >>
>> >> >> >> >> >> Why can't my vb6 printing dll draw to[/color][/color][/color]
a .net[color=blue][color=green][color=darkred]
>> >> hdc?
>> >> >> >> >> >>
>> >> >> >> >> >> PS. I eventually don't want to have to[/color][/color][/color]
save[color=blue][color=green]
>> the[color=darkred]
>> >> >> >> bitmap
>> >> >> >> >> to
>> >> >> >> >> >> a file. If I can get the correct drawing[/color][/color][/color]
on[color=blue][color=green]
>> a[color=darkred]
>> >> >> device
>> >> >> >> >> >> context, I'd like to be able to stream[/color][/color][/color]
that[color=blue][color=green][color=darkred]
>> >> >> directly
>> >> >> >> to
>> >> >> >> >> a
>> >> >> >> >> >> byte array and do a Response.Binarywrite.
>> >> >> >> >> >>
>> >> >> >> >> >> If an expert can help with my main issue[/color]
>> and my[color=darkred]
>> >> >> PS. I
>> >> >> >> >> >> would greatly appreciate it.
>> >> >> >> >> >
>> >> >> >> >> >.
>> >> >> >> >> >
>> >> >> >> >
>> >> >> >> >.
>> >> >> >> >
>> >> >> >
>> >> >> >.
>> >> >> >
>> >> >
>> >> >.
>> >> >
>> >
>> >.
>> >[/color][/color]
>
>.
>[/color]