[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

vb5: API Creating Device Contexts / Bitmaps

Posted on 2000-04-09
6
Medium Priority
?
210 Views
Last Modified: 2010-05-02
I've either reached something vb can't do or I'm doing it incorrectly.  I want to be able to create a bitmap in memory and bitblt ONTO that bitmap as well as from it.

CreateCompatibleDC and CreateCompatibleBitmap is what I've used so far with no success.
0
Comment
Question by:ChrisK
6 Comments
 
LVL 12

Expert Comment

by:pjknibbs
ID: 2697597
You've presumably used CreateCompatibleDC() to create a DC, then selected the bitmap created with CreateCompatibleBitmap() into the DC before the blit? (A code sample of what you're trying would have been nice...). The most obvious error I can think of is: you might be calling CreateCompatibleBitmap() with the DC you get from CreateCompatibleDC() as a parameter. A memory DC is created by default with a 1x1 pixel monochrome bitmap, so CreateCompatibleBitmap() will return the same thing when you try it. Make sure you're calling CreateCompatibleBitmap() with the screen DC.
0
 
LVL 32

Expert Comment

by:Erick37
ID: 2697865
These may help:

:HOWTO: Create Your Own Bitmap Object Class:
http://support.microsoft.com/support/kb/articles/Q187/5/68.ASP

"HOWTO: Capture and Print the Screen, a Form, or any Window"
http://support.microsoft.com/support/kb/articles/Q161/2/99.ASP
0
 
LVL 2

Author Comment

by:ChrisK
ID: 2698205
Sorry...forgot my code :)

Erick these examples don't do what I'm trying to do.  Loading a bitmap from the hd into a memory allocation works....I want to bitblt onto one.  Example Picture1 is on the form...a real object.  Picture2 is only resident in memory.  I need to be able to bitblt picture1's contents to picture2 and visa versa.

tempdc = CreateCompatibleDC(map.hdc)
CreateCompatibleBitmap tempdc, 400, 400
BitBlt tempdc, 0, 0, 400, 400, map.hdc, 0, 0, vbSrcCopy

map.hdc is a picture box on the form.  So I presumed I was creating another dc with it's attributes.  Specified the size with CreateCompatibleBitmap, then bitblt to it....but I get nothing.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 28

Accepted Solution

by:
AzraSound earned 150 total points
ID: 2698352
http://www.vb-helper.com/Howto/picmask.zip

Don't know if thats what youre looking for either
0
 
LVL 2

Author Comment

by:ChrisK
ID: 2698392
azra, submit as the answer.  I was able to figure out what was wrong from that example.

I lacked SelectObject.  Apparently I have to have that before I try to bitblt.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2698399
Hello Chris, glad it pointed you in the right direction.  You can just accept my comment above as an answer if you wish.  Cheers!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month18 days, 10 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question