BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box
Go Back  Xtreme Visual Basic Talk > > > BitBlt of bitmap only show a black box


Reply
 
Thread Tools Display Modes
  #1  
Old 12-21-2004, 03:00 PM
Adde_Sweden Adde_Sweden is offline
Newcomer
 
Join Date: Aug 2004
Posts: 3
Default BitBlt of bitmap only show a black box


Using VB .Net I want to draw some text in another applications window. I have no other access to the window than a handle to it, so I figure I have to map a bitmap image on it with BitBlt, but all I get is a black box. When saving it to a file, the image looks fine though. I'm clueless. Anyone know how to do it?

Here's the code:

Dim myImage As Image = New System.Drawing.Bitmap(100, 100)
Dim gr1 As Graphics = Graphics.FromImage(myImage)

gr1.DrawString("abcd", New Font("Verdana", 12, FontStyle.Bold), Brushes.Blue, 10, 10)
' myImage.Save("C:\temp.bmp",System.Drawing.Imaging.ImageFormat.Bmp)

Dim dc1 As IntPtr = gr1.GetHdc()
Dim dc2 As Integer = GetWindowDC(&H10F58)
BitBlt(dc2, 0, 0, 100, 100, dc1.ToInt32, 0, 0, SRCCOPY)

gr1.ReleaseHdc(dc1)
Reply With Quote
  #2  
Old 12-22-2004, 11:04 AM
Iceplug's Avatar
IceplugBitBlt of bitmap only show a black box Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Why are you using BitBlt?
You probably need to declare the SRCCOPY constant. I think it's &HCC0220, but that's probably wrong.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #3  
Old 12-22-2004, 11:26 AM
Adde_Sweden Adde_Sweden is offline
Newcomer
 
Join Date: Aug 2004
Posts: 3
Default

Quote:
Originally Posted by Iceplug
Why are you using BitBlt?
You probably need to declare the SRCCOPY constant. I think it's &HCC0220, but that's probably wrong.
I have it declared to &HCC0020, and have tried with all other options as well (PATCOPY, SRCPAINT, etc), with no good result.

I use BitBlt because I know of no other way to accomplish what I want in VB .Net, that is:

1. Within my application I have a handle to another applications window.
2. In that window I want to draw some text.

Do you know of any other way to do this?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box
 
BitBlt of bitmap only show a black box
BitBlt of bitmap only show a black box
 
-->