Click here to Skip to main content
15,896,154 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionconcept of uploading... Pin
tasumisra26-Jun-07 20:56
tasumisra26-Jun-07 20:56 
AnswerRe: concept of uploading... Pin
_AnsHUMAN_ 26-Jun-07 21:50
_AnsHUMAN_ 26-Jun-07 21:50 
GeneralRe: concept of uploading... Pin
tasumisra26-Jun-07 22:04
tasumisra26-Jun-07 22:04 
AnswerRe: concept of uploading... Pin
Mark Salsbery27-Jun-07 6:07
Mark Salsbery27-Jun-07 6:07 
GeneralRe: concept of uploading... Pin
tasumisra29-Jun-07 6:12
tasumisra29-Jun-07 6:12 
GeneralRe: concept of uploading... Pin
Mark Salsbery2-Jul-07 13:44
Mark Salsbery2-Jul-07 13:44 
AnswerRe: concept of uploading... Pin
Moak29-Jun-07 1:26
Moak29-Jun-07 1:26 
QuestionHow to close a user created message box without effecting the parent window Pin
msr_codeproject26-Jun-07 20:41
msr_codeproject26-Jun-07 20:41 
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
CSwissMessage 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 CSwissMessage::OnClickCmdbtnPrint()
{
CSwissMessage::EndDialog(10);
snap();
}
****************************************************************************

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

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

BOOL CSwissMessage::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;
}
AnswerRe: How to close a user created message box without effecting the parent window Pin
Jhony george26-Jun-07 21:43
Jhony george26-Jun-07 21:43 
GeneralRe: How to close a user created message box without effecting the parent window Pin
msr_codeproject26-Jun-07 23:29
msr_codeproject26-Jun-07 23:29 
AnswerRe: How to close a user created message box without effecting the parent window Pin
prasad_som27-Jun-07 1:31
prasad_som27-Jun-07 1:31 
GeneralRe: How to close a user created message box without effecting the parent window Pin
msr_codeproject27-Jun-07 2:05
msr_codeproject27-Jun-07 2:05 
QuestionHow to forward delare CArray class ? Pin
VCSharp00726-Jun-07 20:21
VCSharp00726-Jun-07 20:21 
AnswerRe: How to forward delare CArray class ? Pin
CPallini26-Jun-07 20:50
mveCPallini26-Jun-07 20:50 
AnswerRe: How to forward delare CArray class ? Pin
Nibu babu thomas26-Jun-07 21:00
Nibu babu thomas26-Jun-07 21:00 
GeneralRe: How to forward delare CArray class ? Pin
VCSharp00726-Jun-07 22:31
VCSharp00726-Jun-07 22:31 
GeneralRe: How to forward delare CArray class ? Pin
Nibu babu thomas26-Jun-07 22:39
Nibu babu thomas26-Jun-07 22:39 
AnswerRe: How to forward delare CArray class ? Pin
KarstenK26-Jun-07 21:28
mveKarstenK26-Jun-07 21:28 
QuestionEnumerating Installed Apps with MSI Pin
Akin Ocal26-Jun-07 20:13
Akin Ocal26-Jun-07 20:13 
QuestionBSTR in C++ Pin
Axonn Echysttas26-Jun-07 19:45
Axonn Echysttas26-Jun-07 19:45 
AnswerRe: BSTR in C++ Pin
Nibu babu thomas26-Jun-07 20:10
Nibu babu thomas26-Jun-07 20:10 
GeneralRe: BSTR in C++ Pin
Axonn Echysttas26-Jun-07 20:52
Axonn Echysttas26-Jun-07 20:52 
GeneralRe: BSTR in C++ Pin
Nibu babu thomas26-Jun-07 21:06
Nibu babu thomas26-Jun-07 21:06 
AnswerRe: BSTR in C++ Pin
Arman S.26-Jun-07 20:16
Arman S.26-Jun-07 20:16 
GeneralRe: BSTR in C++ Pin
Axonn Echysttas26-Jun-07 20:48
Axonn Echysttas26-Jun-07 20:48 

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.