Click here to Skip to main content
16,007,163 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralWorkspace name Pin
meirav11-Nov-02 8:06
meirav11-Nov-02 8:06 
GeneralRe: Workspace name Pin
SavageBeast11-Nov-02 8:14
SavageBeast11-Nov-02 8:14 
GeneralRe: Workspace name Pin
beetung11-Nov-02 8:24
beetung11-Nov-02 8:24 
GeneralCStatic center vert with wordbreak Pin
Dave_11-Nov-02 7:46
Dave_11-Nov-02 7:46 
GeneralFarsi language in VC++ .NET Pin
Hadi Rezaee11-Nov-02 7:42
Hadi Rezaee11-Nov-02 7:42 
GeneralRe: Farsi language in VC++ .NET Pin
Mazdak12-Nov-02 4:35
Mazdak12-Nov-02 4:35 
GeneralRe: Farsi language in VC++ .NET Pin
Hadi Rezaee12-Nov-02 5:49
Hadi Rezaee12-Nov-02 5:49 
GeneralCopyImage woes Pin
Jim Crafton11-Nov-02 7:29
Jim Crafton11-Nov-02 7:29 
Whilst testing some code from the framework I have been working on in various Win32 platforms I came across a rather odd bug.

Lets say we have the following:
HBITMAP hbmpOrig = getImageListHBMP()


where hbmpOrig represents the HBITMAP to a properly created bitmap image in memory

Now I want to make a copy of the handle, and according to MSDN there is a nice function called CopyImage that does just this.

So I do the following:
HBITMAP hbmpCopy = (HBITMAP)CopyImage( hbmpOrig, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG );


Now according to the MSDN that I have at home (which is the Oct 98 MSDN that comes with VC6):
<quote>
CopyImage
<snip>
...
fuFlags
<snip>
LR_COPYRETURNORG Creates an exact copy of the image, ignoring the cxDesired and cyDesired parameters.


This is why I used the LR_COPYRETURNORG - to make a copy of the image.

The behavior on Win2000 (all sp versions), WinXP, Win98 (and presumably on 95 and ME as well) is to create a new HBITMAP value - just like the docs say.

However on Win NT4 it returns a the original value!! So this is a problem that was in the framework. One of the guys helping out on the project posted this problem to a newsgroup (or list, or whatever) on MSDN and this is what a Microsoft eng replied as :

> 
> I don't think I understand - the docs for LR_COPYRETURNORG state
> that you will get back the original if it meets the criteria. Since
> you're asking for 0 width and height, the only way the original 
> wouldn't satisfy your request is if it's a different bit depth.
> 
> The difference in behavior is either a bug in NT4, or due to the
> color depth in which you're running on the various machines. Either
> way, you could very easily create your own CopyImage() which creates
> a new bitmap and uses BitBlt() to copy the image from source to target.


Sure enough I checked on the latest MSDN docs for this and they read:
<quote>
CopyImage
<snip>
...
fuFlags
<snip>
LR_COPYRETURNORG
Returns the original hImage if it satisfies the criteria for the copy—that is, correct dimensions and color depth—in which case the LR_COPYDELETEORG flag is ignored. If this flag is not specified, a new object is always created.


WTF ! This is the behaviour on WinNT4 but NO OTHER system performs like this!!! Which is correct ? Do we just use 0 ?
So I am curious - has anyone else ran into this before ? Is there a workable solution or do we just end up writing our own version of CopyImage? This is just so incredibly annoying. Actually it is a lot more than that but I am going to refrain from a stream of expletives...sigh.

Thanks in advance !

¡El diablo está en mis pantalones! ¡Mire, mire!
GeneralRe: CopyImage woes Pin
Christian Graus11-Nov-02 8:37
protectorChristian Graus11-Nov-02 8:37 
GeneralUse a Dialog to another pgm created by another pgm Pin
youssef11-Nov-02 7:00
youssef11-Nov-02 7:00 
GeneralRe: Use a Dialog to another pgm created by another pgm Pin
valikac11-Nov-02 7:48
valikac11-Nov-02 7:48 
GeneralRe: Use a Dialog to another pgm created by another pgm Pin
youssef12-Nov-02 13:37
youssef12-Nov-02 13:37 
GeneralChanging view Pin
act_x11-Nov-02 6:47
act_x11-Nov-02 6:47 
GeneralApplication Idle Timeout Pin
SchmoBoy11-Nov-02 6:27
SchmoBoy11-Nov-02 6:27 
GeneralRe: Application Idle Timeout Pin
valikac11-Nov-02 7:56
valikac11-Nov-02 7:56 
GeneralInvoking another Application Pin
act_x11-Nov-02 5:51
act_x11-Nov-02 5:51 
GeneralRe: Invoking another Application Pin
Chris Losinger11-Nov-02 5:56
professionalChris Losinger11-Nov-02 5:56 
GeneralRe: Invoking another Application Pin
Scott H. Settlemier11-Nov-02 5:56
Scott H. Settlemier11-Nov-02 5:56 
Generalserial comm. Pin
peter ho11-Nov-02 5:40
peter ho11-Nov-02 5:40 
GeneralRe: serial comm. Pin
Scott H. Settlemier11-Nov-02 5:51
Scott H. Settlemier11-Nov-02 5:51 
GeneralRotarty dial control knob Pin
john john mackey11-Nov-02 5:36
john john mackey11-Nov-02 5:36 
GeneralRe: Rotarty dial control knob Pin
Andreas Saurwein11-Nov-02 5:46
Andreas Saurwein11-Nov-02 5:46 
GeneralRe: Rotarty dial control knob Pin
Anonymous11-Nov-02 5:55
Anonymous11-Nov-02 5:55 
GeneralRe: Rotarty dial control knob Pin
Andreas Saurwein11-Nov-02 6:16
Andreas Saurwein11-Nov-02 6:16 
Generaldoubt about EnumPrinters() Pin
vgkotha11-Nov-02 4:18
vgkotha11-Nov-02 4:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.