Click here to Skip to main content
15,887,135 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCode snippet for Copying a file from one location to another Pin
V K 226-Mar-09 17:42
V K 226-Mar-09 17:42 
AnswerRe: Code snippet for Copying a file from one location to another Pin
_AnsHUMAN_ 26-Mar-09 18:23
_AnsHUMAN_ 26-Mar-09 18:23 
QuestionThe use of the process handle? Pin
breezescut26-Mar-09 17:25
breezescut26-Mar-09 17:25 
AnswerRe: The use of the process handle? Pin
CPallini26-Mar-09 21:32
mveCPallini26-Mar-09 21:32 
Questiondebug model :CAsyncSocket class ,Dubug Assertion Failed! File:sockcore.cpp Line :408 Pin
vernchen26-Mar-09 17:12
vernchen26-Mar-09 17:12 
AnswerRe: debug model :CAsyncSocket class ,Dubug Assertion Failed! File:sockcore.cpp Line :408 Pin
CPallini26-Mar-09 22:08
mveCPallini26-Mar-09 22:08 
QuestionConforming a bitmap image to a particular resolution without resizing artefacts, and storing it as a PNG image in a database Pin
Sternocera26-Mar-09 12:08
Sternocera26-Mar-09 12:08 
AnswerRe: Conforming a bitmap image to a particular resolution without resizing artefacts, and storing it as a PNG image in a database Pin
Stuart Dootson26-Mar-09 12:58
professionalStuart Dootson26-Mar-09 12:58 
Sternocera wrote:
1. Open an image of any of the major image formats (say Windows bitmap, Jpeg and PNG).


CImage[^]

Sternocera wrote:
2. Conform it to a certain resolution. I have a strong preference for doing so without creating any resizing artefacts. I would like the result to be similar to the result you get by resizing an image in Photoshop, rather than the result you get when internet explorer renders and image at a resolution different to that of the image itself (that creates unsettling artefacts).


Bicubic Interpolation[^]

Sternocera wrote:
3. Convert to PNG, and then get a char pointer to a buffer containing the PNG file, so I can serialise the image as a blob in a database for later retrieval.


Again, CImage. Use the Save[^] method to save to an IStream created on an HGLOBAL[^], i.e. an IStream that writes to memory. Use a null HGLOBAL to start with, then use GetHGlobalFromStream[^] to get the HGLOBAL that the stream eventually ended up allocating. Then use GlobalSize[^] to get the amount of memory used by the stream and GlobalLock[^] to access the memory.

Sternocera wrote:
4. Retrieve the image from the database, and re-create the PNG image to be displayed in my MFC application.


Load the blob into an HGLOBAL (allocate a global with the required size, lock it to get a pointer where you can write the blob contents, hten unlock it). Then create an IStream on that HGLOBAL and use CImage::Load[^] to read the IStream into a CImage.

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Conforming a bitmap image to a particular resolution without resizing artefacts, and storing it as a PNG image in a database Pin
Sternocera26-Mar-09 13:12
Sternocera26-Mar-09 13:12 
GeneralRe: Conforming a bitmap image to a particular resolution without resizing artefacts, and storing it as a PNG image in a database Pin
Sternocera26-Mar-09 13:50
Sternocera26-Mar-09 13:50 
GeneralRe: Conforming a bitmap image to a particular resolution without resizing artefacts, and storing it as a PNG image in a database Pin
Stuart Dootson26-Mar-09 14:25
professionalStuart Dootson26-Mar-09 14:25 
GeneralRe: Conforming a bitmap image to a particular resolution without resizing artefacts, and storing it as a PNG image in a database Pin
CPallini26-Mar-09 22:49
mveCPallini26-Mar-09 22:49 
QuestionChanging icons for items in the list part of a Windows Explorer application [modified] Pin
Ben Aldhouse26-Mar-09 11:23
Ben Aldhouse26-Mar-09 11:23 
QuestionWindows scheduler question Pin
tom groezer26-Mar-09 11:17
tom groezer26-Mar-09 11:17 
AnswerRe: Windows scheduler question Pin
David Crow26-Mar-09 17:25
David Crow26-Mar-09 17:25 
QuestionMultiply Threads and Termination Pin
BobInNJ26-Mar-09 10:33
BobInNJ26-Mar-09 10:33 
AnswerRe: Multiply Threads and Termination Pin
CPallini26-Mar-09 11:04
mveCPallini26-Mar-09 11:04 
AnswerRe: Multiply Threads and Termination Pin
David Crow26-Mar-09 17:27
David Crow26-Mar-09 17:27 
QuestionSHBrowseForFolder and shell namespace extensions Pin
Greg Ingels26-Mar-09 9:40
Greg Ingels26-Mar-09 9:40 
AnswerRe: SHBrowseForFolder and shell namespace extensions Pin
Code-o-mat26-Mar-09 9:55
Code-o-mat26-Mar-09 9:55 
QuestionRun-time error in Matrix ADT Pin
Ma7moud El-Naggar26-Mar-09 9:35
Ma7moud El-Naggar26-Mar-09 9:35 
AnswerRe: Run-time error in Matrix ADT Pin
Stuart Dootson26-Mar-09 11:03
professionalStuart Dootson26-Mar-09 11:03 
GeneralOT - Welcome Pin
CPallini26-Mar-09 11:15
mveCPallini26-Mar-09 11:15 
GeneralRe: OT - Welcome Pin
Ma7moud El-Naggar31-Mar-09 8:58
Ma7moud El-Naggar31-Mar-09 8:58 
GeneralRe: OT - Welcome Pin
CPallini31-Mar-09 9:32
mveCPallini31-Mar-09 9:32 

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.