Click here to Skip to main content
15,891,981 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow to get menu text of Visual Studio2005 or sqlserver 2005? Pin
pashamsridhar16-Sep-09 4:51
pashamsridhar16-Sep-09 4:51 
AnswerRe: how to get menu text of Visual Studio2005 or sqlserver 2005? Pin
Stuart Dootson16-Sep-09 5:28
professionalStuart Dootson16-Sep-09 5:28 
GeneralRe: how to get menu text of Visual Studio2005 or sqlserver 2005? Pin
pashamsridhar16-Sep-09 19:54
pashamsridhar16-Sep-09 19:54 
GeneralRe: how to get menu text of Visual Studio2005 or sqlserver 2005? Pin
Stuart Dootson16-Sep-09 21:25
professionalStuart Dootson16-Sep-09 21:25 
GeneralRe: how to get menu text of Visual Studio2005 or sqlserver 2005? Pin
vasu_sri17-Sep-09 20:47
vasu_sri17-Sep-09 20:47 
Questionwho uses local mysql database with visual c++? Pin
includeh1016-Sep-09 3:52
includeh1016-Sep-09 3:52 
AnswerRe: who uses local mysql database with visual c++? Pin
Saurabh.Garg16-Sep-09 4:25
Saurabh.Garg16-Sep-09 4:25 
GeneralRe: who uses local mysql database with visual c++? Pin
includeh1016-Sep-09 7:46
includeh1016-Sep-09 7:46 
GeneralRe: who uses local mysql database with visual c++? Pin
Saurabh.Garg16-Sep-09 15:24
Saurabh.Garg16-Sep-09 15:24 
QuestionCreate new bitmap from oldbitmap Pin
Game-point16-Sep-09 3:18
Game-point16-Sep-09 3:18 
AnswerRe: Create new bitmap from oldbitmap Pin
Code-o-mat16-Sep-09 3:28
Code-o-mat16-Sep-09 3:28 
GeneralRe: Create new bitmap from oldbitmap Pin
Game-point16-Sep-09 3:31
Game-point16-Sep-09 3:31 
GeneralRe: Create new bitmap from oldbitmap Pin
Code-o-mat16-Sep-09 3:33
Code-o-mat16-Sep-09 3:33 
GeneralRe: Create new bitmap from oldbitmap Pin
Game-point16-Sep-09 3:54
Game-point16-Sep-09 3:54 
GeneralRe: Create new bitmap from oldbitmap Pin
Code-o-mat16-Sep-09 4:16
Code-o-mat16-Sep-09 4:16 
GeneralRe: Create new bitmap from oldbitmap Pin
Game-point16-Sep-09 4:22
Game-point16-Sep-09 4:22 
GeneralRe: Create new bitmap from oldbitmap Pin
Code-o-mat16-Sep-09 5:01
Code-o-mat16-Sep-09 5:01 
Ah well, create a new bitmap in memory with the required size, blit from the source image to the target image the part you want to cut out and then save this new bitmap.
So something like this:

HDC pDC=::GetDC(0);
HDC TmpDC=CreateCompatibleDC(pDC);
CImage _image;
_image.Load(_T("//read.tif"));
int width=_image.GetWidth();
int height=_image.GetHeight();
HGDIOBJ TmpObj2 = SelectObject(TmpDC,(HGDIOBJ)(HBITMAP)_image);			

int newWidth  = width/2;
int newHeight = height/2;
HDC NewDC = CreateCompatibleDC(TmpDC);
HBITMAP NewBitmap = CreateCompatibleBitmap(TmpDC, newWidth, newHeight);
HGDIOBJ NewTmpObj = SelectObject(NewDC, NewBitmap);

BitBlt(NewDC, 0, 0, newWidth, newHeight, TmpDC, 0, 0, SRCCOPY);

SelectObject(NewDC, NewTmpObj);
DeleteDC(NewDC);

SelectObject(TmpDC,TmpObj2);
::ReleaseDC(NULL,pDC);

CImage newImage;
newImage.Attach(NewBitmap);
newImage.Save( _T("D:\\newy.jpg"), Gdiplus::ImageFormatJPEG);
DeleteObject(NewBitmap); //Is this needed, will CImage destroy the bitmap or not?

I am not saying this code works or if it compiles at all, but it can be a starting point for you to get the idea, good luck.

> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <

AnswerRe: Create new bitmap from oldbitmap Pin
Nuri Ismail16-Sep-09 5:02
Nuri Ismail16-Sep-09 5:02 
GeneralRe: Create new bitmap from oldbitmap Pin
Game-point16-Sep-09 20:46
Game-point16-Sep-09 20:46 
GeneralRe: Create new bitmap from oldbitmap [modified] Pin
Nuri Ismail16-Sep-09 22:04
Nuri Ismail16-Sep-09 22:04 
GeneralRe: Create new bitmap from oldbitmap Pin
Game-point16-Sep-09 22:36
Game-point16-Sep-09 22:36 
GeneralRe: Create new bitmap from oldbitmap Pin
Nuri Ismail16-Sep-09 22:50
Nuri Ismail16-Sep-09 22:50 
QuestionHow to put MFC View full screen on second monitor? Pin
Jeff Archer16-Sep-09 2:36
Jeff Archer16-Sep-09 2:36 
GeneralRe: How to put MFC View full screen on second monitor? Pin
Iain Clarke, Warrior Programmer16-Sep-09 3:20
Iain Clarke, Warrior Programmer16-Sep-09 3:20 
QuestionMFC app does not show full screen Pin
m_mun16-Sep-09 2:20
m_mun16-Sep-09 2:20 

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.