|
-
Nov 5th, 2002, 05:05 PM
#1
Thread Starter
New Member
SelectObject problem
Can someone help me out? I am new to using DC's and working with pictures, and I am running into a problem. I am trying to select an object to create a dc by doing the following:
Dim DC As Long
Dim Temp As IPictureDisp
DC = CreateCompatibleDC(frmHold.hdc)
Set Temp = frmHold.imgBeginner.Picture
SelectObject DC, Temp
srcDC=DC
DeleteObject Temp
Set Temp = Nothing
Everything works fine up to this point. The DC is created that I want to work with, and I can manipulate the picture just like I want. However, when I go and take a look at my imgBeginner picture, it is wiped out and I can't access it anymore. Why is this?
-
Nov 5th, 2002, 11:45 PM
#2
Good Ol' Platypus
Its because this kind of thing actually creates some kind of pseudo-pointer, selectobject it with nothing again and it'll be changed (I think).
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Nov 6th, 2002, 10:51 AM
#3
Thread Starter
New Member
Sastraxi,
How would I SelectObject it again with nothing in it? Would I just use something like
SelectObject 0, Empty
If so, I tried that and it didn't change anything
-
Nov 6th, 2002, 11:38 AM
#4
Thread Starter
New Member
I figured out my problem.
I wasn't releasing the DC when I was done with it. All I needed to do was to put in:
DeleteDC srcDC
when I was finished using it, and everythig works fine now.
-
Nov 6th, 2002, 04:19 PM
#5
Good Ol' Platypus
Ah. I see; it must've been something else that had that DC pointer prob, glad you figured it out.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
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
|