Click here to Skip to main content
15,908,909 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionsafe version of strstr Pin
Chintoo7231-Oct-05 0:43
Chintoo7231-Oct-05 0:43 
AnswerRe: safe version of strstr Pin
Jose Lamas Rios1-Oct-05 13:28
Jose Lamas Rios1-Oct-05 13:28 
GeneralRe: safe version of strstr Pin
Chintoo7231-Oct-05 14:47
Chintoo7231-Oct-05 14:47 
QuestionDialog Based Dll Pin
Balaji Krishna1-Oct-05 0:20
Balaji Krishna1-Oct-05 0:20 
QuestionI need a CopyBitmap() function Pin
RancidCrabtree1-Oct-05 0:16
RancidCrabtree1-Oct-05 0:16 
AnswerRe: I need a CopyBitmap() function Pin
Mircea Puiu1-Oct-05 0:44
Mircea Puiu1-Oct-05 0:44 
AnswerRe: I need a CopyBitmap() function Pin
Gary R. Wheeler1-Oct-05 2:22
Gary R. Wheeler1-Oct-05 2:22 
AnswerHere is my CopyBitmap() function Pin
RancidCrabtree3-Oct-05 12:02
RancidCrabtree3-Oct-05 12:02 
Here is the function I settled on. Unfortunately, I copied most of the code from another source on the internet, and lost my link to it. Therefore I cannot properly cite that source. If you recognize the code as yours, then please accept my thanks for it.
void CLabeledBitmap::CopyBitmapSection(CBitmap &bmpSrc, CBitmap &bmpDest, CRect &rectSection, CDC* pDC)
{
    int nWidth = rectSection.Width();
    int nHeight = rectSection.Height();
 	
    CDC destDC, srcDC;
 	
    CBitmap *pOldBmp = NULL;
    CBitmap *pOldSrcBmp = NULL;
 
    // Create two device contexts, one for the destination bitmap and one for the source bitmap.
    destDC.CreateCompatibleDC(pDC);
    srcDC.CreateCompatibleDC(pDC);
 
    // Make sure that the destination bitmap is empty.
    bmpDest.DeleteObject();

    // Create a bitmap that is compatible with the current device context.
    bmpDest.CreateCompatibleBitmap(pDC, nWidth, nHeight);
 
    // Select the bitmaps into the device contexts.
    pOldSrcBmp = srcDC.SelectObject(&bmpSrc);
    pOldBmp = destDC.SelectObject(&bmpDest);
 
    // Transfer the section of the source bitmap into the destination bitmap.
    destDC.StretchBlt(0, 0, nWidth, nHeight, &srcDC, rectSection.left, rectSection.top,
                      rectSection.Width(), rectSection.Height(), SRCCOPY);
 
    // Set the dimensions of the bitmap so that they can be used later.
    // Otherwise, they will be invalid.
    bmpDest.SetBitmapDimension(nWidth, nHeight);
 
    // Clean up the device contexts.
    destDC.SelectObject(pOldBmp);
    srcDC.SelectObject(pOldSrcBmp);
}


-- modified at 1:38 Wednesday 5th October, 2005
QuestionPacket Sniffing Pin
progvc30-Sep-05 23:14
progvc30-Sep-05 23:14 
GeneralRe: Packet Sniffing Pin
Jörgen Sigvardsson1-Oct-05 14:05
Jörgen Sigvardsson1-Oct-05 14:05 
GeneralRe: Packet Sniffing Pin
progvc2-Oct-05 19:33
progvc2-Oct-05 19:33 
QuestionConnecting to Oracle Database using ADO in vc++ Pin
snprani30-Sep-05 22:46
snprani30-Sep-05 22:46 
AnswerRe: Connecting to Oracle Database using ADO in vc++ Pin
ThatsAlok30-Sep-05 23:21
ThatsAlok30-Sep-05 23:21 
Questionallocating memory in a DLL Pin
hamidreza_buddy30-Sep-05 22:28
hamidreza_buddy30-Sep-05 22:28 
AnswerRe: allocating memory in a DLL Pin
Prakash Nadar30-Sep-05 22:32
Prakash Nadar30-Sep-05 22:32 
GeneralRe: allocating memory in a DLL Pin
hamidreza_buddy30-Sep-05 22:57
hamidreza_buddy30-Sep-05 22:57 
GeneralRe: allocating memory in a DLL Pin
John M. Drescher1-Oct-05 1:55
John M. Drescher1-Oct-05 1:55 
GeneralRe: allocating memory in a DLL Pin
Cedric Moonen1-Oct-05 3:48
Cedric Moonen1-Oct-05 3:48 
QuestionZ-order of parent Pin
Ashman30-Sep-05 20:56
Ashman30-Sep-05 20:56 
AnswerRe: Z-order of parent Pin
Mircea Puiu30-Sep-05 21:12
Mircea Puiu30-Sep-05 21:12 
GeneralRe: Z-order of parent Pin
ThatsAlok30-Sep-05 21:15
ThatsAlok30-Sep-05 21:15 
GeneralRe: Z-order of parent Pin
Mircea Puiu30-Sep-05 21:32
Mircea Puiu30-Sep-05 21:32 
AnswerRe: Z-order of parent Pin
ThatsAlok30-Sep-05 21:14
ThatsAlok30-Sep-05 21:14 
QuestionCopy /Paste of CTreeCtrl Pin
swarnamanoo30-Sep-05 20:46
swarnamanoo30-Sep-05 20:46 
AnswerRe: Copy /Paste of CTreeCtrl Pin
Mircea Puiu1-Oct-05 0:47
Mircea Puiu1-Oct-05 0:47 

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.