|
-
May 30th, 2001, 09:08 AM
#1
Using LoadImage
What am I doing wrong, I always get a zero value for hBmp.
hBmp = LoadImage(Picture2.hdc, 0, IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE)
I am trying to copy the image in picture to the hBmp.
Thanks in advance,
-
Jun 1st, 2001, 06:10 PM
#2
Addicted Member
You cannot copy a bitmap like this. The LoadImage function is used for loading bitmap images from files. Use the BitBlt to copy (blit) a bitmap from one DC to another.
However, if you want to obtain a handle to a bitmap use the .Picture.Handle property of a form, picturebox...
-
Jun 2nd, 2001, 09:19 AM
#3
These will all return the handle to the picture, so just choose which one you like the best:
Code:
Print Picture1
Print Picture1.Picture
Print Picture1.Picture.Handle
-
Jun 3rd, 2001, 07:54 AM
#4
Addicted Member
Personally I prefer .Picture.Handle because in VB.NET there will be no default properties
-
Jun 3rd, 2001, 11:08 AM
#5
I usually use Picture1.Picture, because there are some times where you can't use .Handle, e.g:
Code:
Picture1.Picture = Picture2.Picture
-
Jun 3rd, 2001, 12:02 PM
#6
PowerPoster
This copies the whole struct right?
Does VB always check if there might be a default value to use if you specify '.picture'?
-
Jun 3rd, 2001, 12:30 PM
#7
transcendental analytic
No that doesn't. Set is implicitely used when you assign an object reference, so the correct syntax is
Set Picture1.Picture = Picture2.Picture
I guess they're variants, otherways it should give you an error.
The COM Objects are not like structs, that is UDT's in VB, when the assignment is done, a pointer is just copied so both picture1 and picture2's picture properties points to the same stdpicture. You can't copy COM objects with a decent general way in VB, if you design your own classes you can put in clone functions though. The compiler should search for default properties whenever there's a type mismatch (between COM and other datatypes) if you don't specify explicitely by using SET or LET statements.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|