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

C / C++ / MFC

 
Questionunresolved external symbol __imp__PlaySoundW@12 Pin
gateway2320-Sep-10 21:40
gateway2320-Sep-10 21:40 
AnswerRe: unresolved external symbol __imp__PlaySoundW@12 Pin
Niklas L20-Sep-10 21:49
Niklas L20-Sep-10 21:49 
AnswerRe: unresolved external symbol __imp__PlaySoundW@12 Pin
Cedric Moonen20-Sep-10 21:55
Cedric Moonen20-Sep-10 21:55 
GeneralRe: unresolved external symbol __imp__PlaySoundW@12 Pin
gateway2320-Sep-10 23:18
gateway2320-Sep-10 23:18 
QuestionDrawing onto a bitmap Pin
softwaremonkey20-Sep-10 20:04
softwaremonkey20-Sep-10 20:04 
AnswerRe: Drawing onto a bitmap Pin
«_Superman_»20-Sep-10 20:23
professional«_Superman_»20-Sep-10 20:23 
GeneralRe: Drawing onto a bitmap Pin
softwaremonkey20-Sep-10 20:48
softwaremonkey20-Sep-10 20:48 
AnswerRe: Drawing onto a bitmap Pin
basementman23-Sep-10 4:33
basementman23-Sep-10 4:33 
Below is a code snippet that demonstrates creating a memory DC, calling functions that use std GDI funtions to draw onto the DC, extracting the BMP from the DC and doing something with it, and finally clean up:

<br />
BOOL DoChart(CallContextObj *pCallContextObj)<br />
{<br />
  CDC oMemDC;<br />
  CBitmap *pOldBmp;<br />
  CBitmap oBmp;<br />
<br />
  long lWidth = 300;<br />
  long lHeight = 200;<br />
  pCallContextObj->GetParameterValue(_T("ChartWidth"),&lWidth);<br />
  pCallContextObj->GetParameterValue(_T("ChartHeight"),&lHeight);<br />
<br />
  CRect oBmpSize(0,0,lWidth,lHeight);<br />
<br />
  oMemDC.CreateCompatibleDC(NULL);<br />
  int iOldMapMode = oMemDC.SetMapMode(MM_TEXT);<br />
<br />
  CWindowDC dcScreen(NULL);<br />
<br />
  oBmp.CreateCompatibleBitmap(&dcScreen,oBmpSize.Width(), oBmpSize.Height());<br />
<br />
  pOldBmp = oMemDC.SelectObject(&oBmp);<br />
<br />
  WORD wChartType = 88;<br />
  pCallContextObj->GetParameterValue(_T("ChartType"),&wChartType);<br />
<br />
  BOOL bRetval = FALSE;<br />
  TCHAR caError[1024];<br />
  _tcscpy(caError,_T("Invalid Chart Type"));<br />
<br />
  switch (wChartType)<br />
    {<br />
      case 0:<br />
        bRetval = DoLineChart(pCallContextObj,&oMemDC,caError,oBmpSize);<br />
        break;<br />
<br />
      case 1:<br />
        bRetval = DoBarChart(FALSE,pCallContextObj,&oMemDC,caError,oBmpSize);<br />
        break;<br />
<br />
      case 2:<br />
        bRetval = DoBarChart(TRUE,pCallContextObj,&oMemDC,caError,oBmpSize);<br />
        break;<br />
<br />
      case 3:<br />
        bRetval = DoOpenHiLowCloseChart(pCallContextObj,&oMemDC,caError,oBmpSize);<br />
        break;<br />
<br />
      case 4:<br />
        bRetval = DoPieChart(pCallContextObj,&oMemDC,caError,oBmpSize);<br />
        break;<br />
    }<br />
<br />
  if (bRetval)<br />
    {<br />
      char caHeaders[1024];<br />
<br />
#ifdef UNICODE<br />
      BYTE *cpBuf = (BYTE *)pCallContextObj->GetUTF8OutputBufferPtr();<br />
#else<br />
      BYTE *cpBuf = (BYTE *)pCallContextObj->GetOutputBufferPtr();<br />
#endif<br />
<br />
      long lQuality = 75;<br />
      pCallContextObj->GetParameterValue(_T("ImageQuality"),&lQuality);<br />
<br />
      long lDataSize = WriteImage(oBmp,cpBuf,pCallContextObj->GetOutputBufferSize(),caError,(DWORD)lQuality);<br />
      if (lDataSize > 0)<br />
        {<br />
          pCallContextObj->SuppressHeaders();<br />
<br />
          sprintf(caHeaders,"Content-Type: image/jpeg\r\nContent-Length: %d\r\n\r\n",lDataSize);<br />
<br />
          // write out our custom headers<br />
          if (pCallContextObj->ServerSupportFunction(HSE_REQ_SEND_RESPONSE_HEADER,"200 OK",0,(LPDWORD)caHeaders) || ::GetLastError() == 10054)<br />
            pCallContextObj->WriteClient((LPVOID)cpBuf,(LPDWORD)&lDataSize);<br />
<br />
          *cpBuf = 0;<br />
          pCallContextObj->EraseContent();<br />
        }<br />
      else<br />
        bRetval = FALSE;<br />
    }<br />
<br />
  oMemDC.SetMapMode(iOldMapMode);<br />
  oMemDC.SelectObject(pOldBmp);<br />
<br />
  oMemDC.DeleteDC();<br />
<br />
  if (!bRetval)<br />
    {<br />
      pCallContextObj->StartContent();<br />
      pCallContextObj->WriteTitle();<br />
      pCallContextObj->WriteContent(_T("Error Converting Bitmap!<BR>"));<br />
      pCallContextObj->WriteContent(caError);<br />
      pCallContextObj->EndContent();<br />
    }<br />
<br />
  return TRUE;<br />
}

 onwards and upwards... 

Questioncode generation failed Pin
raju_shiva20-Sep-10 19:37
raju_shiva20-Sep-10 19:37 
AnswerRe: code generation failed Pin
Niklas L20-Sep-10 20:55
Niklas L20-Sep-10 20:55 
AnswerRe: code generation failed Pin
rp_suman21-Sep-10 9:08
rp_suman21-Sep-10 9:08 
QuestionCapEditCopy and its data retrieval format. Explanation wanted. Pin
Vaclav_20-Sep-10 7:32
Vaclav_20-Sep-10 7:32 
AnswerRe: CapEditCopy and its data retrieval format. Explanation wanted. Pin
Phil J Pearson20-Sep-10 12:09
Phil J Pearson20-Sep-10 12:09 
GeneralRe: CapEditCopy and its data retrieval format. Explanation wanted. Pin
Vaclav_20-Sep-10 13:58
Vaclav_20-Sep-10 13:58 
QuestionCBitmapButton not taking keyboard inputs. Pin
Member 383463020-Sep-10 4:19
Member 383463020-Sep-10 4:19 
AnswerRe: CBitmapButton not taking keyboard inputs. [modified] Pin
Aescleal20-Sep-10 5:27
Aescleal20-Sep-10 5:27 
QuestionSave web page Pin
VVVimal19-Sep-10 23:37
VVVimal19-Sep-10 23:37 
QuestionRe: Save web page Pin
CPallini19-Sep-10 23:59
mveCPallini19-Sep-10 23:59 
AnswerRe: Save web page Pin
VVVimal20-Sep-10 0:08
VVVimal20-Sep-10 0:08 
GeneralRe: Save web page Pin
«_Superman_»20-Sep-10 0:12
professional«_Superman_»20-Sep-10 0:12 
GeneralRe: Save web page [modified] Pin
CPallini20-Sep-10 0:40
mveCPallini20-Sep-10 0:40 
GeneralRe: Save web page Pin
mesajflaviu22-Sep-10 22:55
mesajflaviu22-Sep-10 22:55 
GeneralRe: Save web page Pin
CPallini22-Sep-10 23:00
mveCPallini22-Sep-10 23:00 
QuestionCombining all files in single file Pin
learningvisualc19-Sep-10 22:31
learningvisualc19-Sep-10 22:31 
AnswerRe: Combining all files in single file Pin
«_Superman_»19-Sep-10 22:54
professional«_Superman_»19-Sep-10 22:54 

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.