Click here to Skip to main content
16,011,608 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to have access to the members of a class Pin
ian mariano4-Mar-04 10:53
ian mariano4-Mar-04 10:53 
AnswerRe: How to have access to the members of a class Pin
Steve S4-Mar-04 22:41
Steve S4-Mar-04 22:41 
QuestionHow do I compile? Pin
john john mackey4-Mar-04 9:47
john john mackey4-Mar-04 9:47 
AnswerRe: How do I compile? Pin
ian mariano4-Mar-04 10:56
ian mariano4-Mar-04 10:56 
GeneralRe: How do I compile? Pin
john john mackey5-Mar-04 8:09
john john mackey5-Mar-04 8:09 
GeneralRe: How do I compile? Pin
ian mariano8-Mar-04 12:15
ian mariano8-Mar-04 12:15 
GeneralCPaintDC develish slow Pin
S van Leent4-Mar-04 9:21
S van Leent4-Mar-04 9:21 
GeneralRe: CPaintDC develish slow Pin
basementman4-Mar-04 9:42
basementman4-Mar-04 9:42 
bitblt.

Code snippet to help you (heavily edited and content deleted):

BOOL DoChart(CallContextObj *pCallContextObj)
{
  CDC oMemDC;
  CBitmap *pOldBmp;
  CBitmap oBmp;

  long lWidth = 300;
  long lHeight = 200;
  pCallContextObj->GetParameterValue("ChartWidth",&lWidth);
  pCallContextObj->GetParameterValue("ChartHeight",&lHeight);

  CRect oBmpSize(0,0,lWidth,lHeight);

  oMemDC.CreateCompatibleDC(NULL);
  int iOldMapMode = oMemDC.SetMapMode(MM_TEXT);

  CWindowDC dcScreen(NULL);

  oBmp.CreateCompatibleBitmap(&dcScreen,oBmpSize.Width(), oBmpSize.Height());

  pOldBmp = oMemDC.SelectObject(&oBmp);

  WORD wChartType = 88;
  pCallContextObj->GetParameterValue("ChartType",&wChartType);

  BOOL bRetval = FALSE;
  char caHeaders[512];
  strcpy(caHeaders,"Invalid Chart Type");

  switch (wChartType)
    {
      case 0:
        bRetval = DoLineChart(pCallContextObj,&oMemDC,caHeaders,oBmpSize);
        break;

      case 1:
        bRetval = DoBarChart(FALSE,pCallContextObj,&oMemDC,caHeaders,oBmpSize);
        break;

      case 2:
        bRetval = DoBarChart(TRUE,pCallContextObj,&oMemDC,caHeaders,oBmpSize);
        break;

      case 3:
        bRetval = DoOpenHiLowCloseChart(pCallContextObj,&oMemDC,caHeaders,oBmpSize);
        break;

      case 4:
        bRetval = DoPieChart(pCallContextObj,&oMemDC,caHeaders,oBmpSize);
        break;
    }

  if (bRetval)
    {
      LPSTR cpBuf = pCallContextObj->GetOutputBufferPtr();

      long lQuality = 75;
      pCallContextObj->GetParameterValue("ImageQuality",&lQuality);

      char caContentType[256];

      long lDataSize = WriteImage(oBmp,cpBuf,pCallContextObj->GetOutputBufferSize(),caHeaders,(DWORD)lQuality);
      if (lDataSize > 0)
        {
          pCallContextObj->SuppressHeaders();
          // pCallContextObj->GetMimeType("x.bmp",caContentType);
          pCallContextObj->GetMimeType("x.jpg",caContentType);

          sprintf(caHeaders,"Content-Type: %s%sContent-Length: %d%s%s",caContentType,cpCRLF,lDataSize,cpCRLF,cpCRLF);

          // write out our custom headers
          if (pCallContextObj->ServerSupportFunction(HSE_REQ_SEND_RESPONSE_HEADER,"200 OK",0,(LPDWORD)caHeaders) || ::GetLastError() == 10054)
            pCallContextObj->WriteClient((LPVOID)cpBuf,(LPDWORD)&lDataSize);

          *cpBuf = 0;
        }
      else
        bRetval = FALSE;
    }

  oMemDC.SetMapMode(iOldMapMode);
  oMemDC.SelectObject(pOldBmp);

  oMemDC.DeleteDC();


 onwards and upwards... 
GeneralRe: COM Port Reading Pin
David Crow4-Mar-04 8:56
David Crow4-Mar-04 8:56 
GeneralRe: COM Port Reading Pin
dimitar.rosenov4-Mar-04 9:26
dimitar.rosenov4-Mar-04 9:26 
GeneralGDI Scale Pin
Hesham Amin4-Mar-04 8:41
Hesham Amin4-Mar-04 8:41 
GeneralRe: GDI Scale Pin
David Crow4-Mar-04 8:58
David Crow4-Mar-04 8:58 
GeneralRe: GDI Scale Pin
Hesham Amin4-Mar-04 21:44
Hesham Amin4-Mar-04 21:44 
Questionhow do you use the combo box? Pin
catngo4-Mar-04 7:43
catngo4-Mar-04 7:43 
AnswerRe: how do you use the combo box? Pin
Like2Byte4-Mar-04 7:54
Like2Byte4-Mar-04 7:54 
GeneralStopping devices in Windows 98 Pin
stasik garifulin4-Mar-04 6:47
stasik garifulin4-Mar-04 6:47 
GeneralRe: Stopping devices in Windows 98 Pin
Mazdak4-Mar-04 7:21
Mazdak4-Mar-04 7:21 
GeneralTAPI + PARALLEL PORT PROGRAMMING IN VC++ 6.0 Pin
Prabha Govind Perumal4-Mar-04 6:23
Prabha Govind Perumal4-Mar-04 6:23 
GeneralRe: TAPI + PARALLEL PORT PROGRAMMING IN VC++ 6.0 Pin
Michael P Butler4-Mar-04 6:47
Michael P Butler4-Mar-04 6:47 
GeneralListControl with shell icons Pin
rrrado4-Mar-04 6:15
rrrado4-Mar-04 6:15 
GeneralRe: ListControl with shell icons Pin
Shog94-Mar-04 7:07
sitebuilderShog94-Mar-04 7:07 
GeneralRe: ListControl with shell icons Pin
rrrado4-Mar-04 20:33
rrrado4-Mar-04 20:33 
GeneralRe: ListControl with shell icons Pin
rrrado4-Mar-04 21:21
rrrado4-Mar-04 21:21 
General__int64 question Pin
Shay Harel4-Mar-04 5:38
Shay Harel4-Mar-04 5:38 
GeneralRe: __int64 question Pin
basementman4-Mar-04 5:45
basementman4-Mar-04 5:45 

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.