Click here to Skip to main content
15,887,361 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: problem with sprintf_s() on win 7 Pin
Member 93537764-Nov-12 16:34
Member 93537764-Nov-12 16:34 
GeneralRe: problem with sprintf_s() on win 7 Pin
Richard MacCutchan4-Nov-12 21:26
mveRichard MacCutchan4-Nov-12 21:26 
AnswerRe: problem with sprintf_s() on win 7 Pin
H.Brydon26-Nov-12 19:36
professionalH.Brydon26-Nov-12 19:36 
Questionwsageterror() Pin
bkelly131-Nov-12 15:28
bkelly131-Nov-12 15:28 
AnswerRe: wsageterror() Pin
Richard MacCutchan1-Nov-12 22:48
mveRichard MacCutchan1-Nov-12 22:48 
QuestionSTL map issue in VS2010 Pin
Subhash Madhukar30-Oct-12 3:47
Subhash Madhukar30-Oct-12 3:47 
AnswerRe: STL map issue in VS2010 Pin
Richard MacCutchan30-Oct-12 6:04
mveRichard MacCutchan30-Oct-12 6:04 
Questionhow do i copy a CImage DIB to clipboard Pin
Member 951640015-Oct-12 11:15
Member 951640015-Oct-12 11:15 
im trying to copy a cimage dib to the clipboard. the second
memcpy fails with a read access violation. can anyone help?

C++
CImage tmpImage = pDoc->m_imageArray[0];
     
    int w = tmpImage.GetWidth();
    int h = tmpImage.GetHeight();
    int Bpp = tmpImage.GetBPP();
     
    BITMAPINFOHEADER bmInfohdr;
    bmInfohdr.biSize = sizeof(BITMAPINFOHEADER);
    bmInfohdr.biWidth = w;
    bmInfohdr.biHeight = -h;
    bmInfohdr.biPlanes = 1;
    bmInfohdr.biBitCount = Bpp;
    bmInfohdr.biCompression = BI_RGB;
    bmInfohdr.biSizeImage = w*h*Bpp;
    bmInfohdr.biXPelsPerMeter = 0;
    bmInfohdr.biYPelsPerMeter = 0;
    bmInfohdr.biClrUsed = 0;
    bmInfohdr.biClrImportant = 0;
     
    BITMAPINFO bmInfo;
    bmInfo.bmiHeader = bmInfohdr;
    bmInfo.bmiColors[0].rgbBlue=255;
     
     
    void* pBits = tmpImage.GetBits();
    HANDLE hData = ::GlobalAlloc (GMEM_MOVEABLE, sizeof(BITMAPINFO) + w * h * 3);
    LPVOID pData = (LPVOID) ::GlobalLock (hData);
    LPBYTE p_imagebits;
    p_imagebits  = (LPBYTE)pData + sizeof(BITMAPINFO);
    
 
    memcpy(pData,&bmInfo,sizeof(BITMAPINFO));
     
           
    DWORD dwBytes = ((DWORD) w * Bpp) / 32;
    
    if(((DWORD) w * Bpp) % 32) {
       dwBytes++;
    }
    dwBytes *= 4;
   
    unsigned long m_dwSizeImage = dwBytes * h; // no compression
     
     
    memcpy (p_imagebits, pBits, m_dwSizeImage);
    
 
    ::GlobalUnlock (hData);
     
    COleDataSource* pods = new COleDataSource;
    pods->CacheGlobalData (CF_DIB, hData);
    pods->SetClipboard ();

AnswerRe: how do i copy a CImage DIB to clipboard Pin
chaau15-Oct-12 11:41
chaau15-Oct-12 11:41 
QuestionWhy does this fail - CFile / SeekToEnd? Pin
charlieg10-Oct-12 6:43
charlieg10-Oct-12 6:43 
AnswerRe: Why does this fail - CFile / SeekToEnd? Pin
charlieg10-Oct-12 9:31
charlieg10-Oct-12 9:31 
AnswerRe: Why does this fail - CFile / SeekToEnd? Pin
chaau10-Oct-12 11:23
chaau10-Oct-12 11:23 
GeneralRe: Why does this fail - CFile / SeekToEnd? Pin
charlieg11-Oct-12 2:20
charlieg11-Oct-12 2:20 
AnswerRe: Why does this fail - CFile / SeekToEnd? Pin
Richard MacCutchan10-Oct-12 21:45
mveRichard MacCutchan10-Oct-12 21:45 
GeneralRe: Why does this fail - CFile / SeekToEnd? Pin
charlieg11-Oct-12 2:30
charlieg11-Oct-12 2:30 
GeneralRe: Why does this fail - CFile / SeekToEnd? Pin
charlieg11-Oct-12 4:53
charlieg11-Oct-12 4:53 
GeneralRe: Why does this fail - CFile / SeekToEnd? Pin
Richard MacCutchan11-Oct-12 11:19
mveRichard MacCutchan11-Oct-12 11:19 
GeneralRe: Why does this fail - CFile / SeekToEnd? Pin
charlieg11-Oct-12 11:34
charlieg11-Oct-12 11:34 
GeneralRe: Why does this fail - CFile / SeekToEnd? Pin
Richard MacCutchan11-Oct-12 12:01
mveRichard MacCutchan11-Oct-12 12:01 
GeneralRe: Why does this fail - CFile / SeekToEnd? Pin
charlieg12-Oct-12 5:54
charlieg12-Oct-12 5:54 
AnswerRe: Why does this fail - CFile / SeekToEnd? Pin
Stephen Hewitt11-Oct-12 12:58
Stephen Hewitt11-Oct-12 12:58 
AnswerRe: Why does this fail - CFile / SeekToEnd? Pin
charlieg18-Jan-13 1:47
charlieg18-Jan-13 1:47 
QuestionKeep program open and running Pin
Lucidation8-Oct-12 11:23
Lucidation8-Oct-12 11:23 
AnswerRe: Keep program open and running Pin
Richard MacCutchan8-Oct-12 22:14
mveRichard MacCutchan8-Oct-12 22:14 
GeneralRe: Keep program open and running Pin
Lucidation9-Oct-12 11:14
Lucidation9-Oct-12 11:14 

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.