Click here to Skip to main content
15,894,180 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Streach or skew a bitmap to fit to resizing button size Pin
KarstenK27-Jun-07 20:53
mveKarstenK27-Jun-07 20:53 
QuestionRe: You need a ownerdrawn Button Pin
robshere29-Jun-07 2:00
robshere29-Jun-07 2:00 
AnswerRe: You need a ownerdrawn Button Pin
KarstenK29-Jun-07 2:18
mveKarstenK29-Jun-07 2:18 
QuestionHelp Needed !!! Pin
SelvaKr27-Jun-07 18:28
SelvaKr27-Jun-07 18:28 
AnswerRe: Help Needed !!! Pin
JudyL_MD28-Jun-07 2:38
JudyL_MD28-Jun-07 2:38 
GeneralRe: Help Needed !!! Pin
SelvaKr28-Jun-07 19:17
SelvaKr28-Jun-07 19:17 
GeneralRe: Help Needed !!! Pin
JudyL_MD29-Jun-07 2:27
JudyL_MD29-Jun-07 2:27 
QuestionHow to close a user created message box without effecting the background Pin
msr_codeproject27-Jun-07 18:26
msr_codeproject27-Jun-07 18:26 
Good morning... My query is......

After user selects PRINT menu one message box(usr created)will appear.
The message box consists of 2 command button controls.
one is OK and the other is CANCEL.
If the user presses OK it should take snapshot of the background and should create a BITMAP IMAGE without the message box. That means IMAGE shouldn't contain the message box. For this I am calling EndDialog() function. But now the problem message box is creating some empty space in the background and IMAGE is coming with that empty space. But it shouldn't come.
The code is as folows.

After selecting PRINT menu it will execute the following code.... i.e.,
**************************************************************************8
CSaiMessage m_objMsg;
m_objMsg.m_strMSG = "\n\n\nPress Print to Print the Screen or Cancel To Quit";
m_objMsg.DoModal();
****************************************************************************
Know the message box will appear. If the user selects PRINT button it will execute the following code.....
****************************************************************************
void CSaiMessage::OnClickCmdbtnPrint()
{
CSaiMessage::EndDialog(10);
snap();
}
****************************************************************************

void CSaiMessage::snap()
{
CWnd* pWnd = AfxGetApp()->m_pMainWnd;

if (windowtobmp("ShipStatus.bmp",pWnd)==FALSE)
{
MessageBox("ERROR");
}
}

BOOL CSaiMessage::windowtobmp(CString filename,CWnd* pwnd)
{
CWindowDC dc(pwnd);
CDC memdc;
memdc.CreateCompatibleDC(&dc);

CRect rect;
pwnd->GetWindowRect(rect);

CBitmap bmp;
bmp.CreateCompatibleBitmap(&dc,rect.Width(),rect.Height()-150);

CBitmap* poldbmp = memdc.SelectObject(&bmp);
memdc.BitBlt(0,0,rect.Width(),rect.Height(),&dc,0,0,SRCCOPY);

memdc.SelectObject(poldbmp);

HANDLE hdib = ConvertDDBToDIB(bmp);
writebmp(filename,hdib);
GlobalFree(hdib);

CString strPrintFilePath = FindPrintFilePath();
HINSTANCE hInstancePrint;//,hInstanceEditor;

hInstancePrint = ShellExecute(this->m_hWnd,"print","ShipStatus.bmp",NULL,NULL,SW_HIDE);

return TRUE;
}


Thanks in Advance
Sairam
AnswerRe: How to close a user created message box without effecting the background Pin
Joan M27-Jun-07 18:58
professionalJoan M27-Jun-07 18:58 
Questionunit testing Pin
deeps_cute27-Jun-07 17:55
deeps_cute27-Jun-07 17:55 
AnswerRe: unit testing Pin
_AnsHUMAN_ 27-Jun-07 20:05
_AnsHUMAN_ 27-Jun-07 20:05 
Questioncannot open include file 'afxres.h' Pin
gentleguy27-Jun-07 17:31
gentleguy27-Jun-07 17:31 
AnswerRe: cannot open include file 'afxres.h' Pin
spsharma27-Jun-07 22:51
spsharma27-Jun-07 22:51 
QuestionGettings error strings from Winerror.h Pin
Akin Ocal27-Jun-07 12:51
Akin Ocal27-Jun-07 12:51 
AnswerRe: Gettings error strings from Winerror.h Pin
Mark Salsbery27-Jun-07 13:15
Mark Salsbery27-Jun-07 13:15 
QuestionSlider Ctrl Pin
ScotDolan27-Jun-07 11:49
ScotDolan27-Jun-07 11:49 
AnswerRe: Slider Ctrl Pin
Mark Salsbery27-Jun-07 12:11
Mark Salsbery27-Jun-07 12:11 
GeneralRe: Slider Ctrl Pin
zhang80060527-Jun-07 16:11
zhang80060527-Jun-07 16:11 
GeneralRe: Slider Ctrl Pin
ScotDolan28-Jun-07 5:19
ScotDolan28-Jun-07 5:19 
GeneralRe: Slider Ctrl Pin
Mark Salsbery28-Jun-07 6:09
Mark Salsbery28-Jun-07 6:09 
AnswerRe: Slider Ctrl Pin
drexel17183-Jul-07 20:59
drexel17183-Jul-07 20:59 
QuestionWrite a string find and replace program Pin
Nacho Chip27-Jun-07 11:31
Nacho Chip27-Jun-07 11:31 
AnswerRe: Write a string find and replace program Pin
Naveen27-Jun-07 14:58
Naveen27-Jun-07 14:58 
AnswerRe: Write a string find and replace program Pin
zhang80060527-Jun-07 16:28
zhang80060527-Jun-07 16:28 
AnswerRe: Write a string find and replace program Pin
Arris7427-Jun-07 19:50
Arris7427-Jun-07 19:50 

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.