title: Handling Drawframecontrol
body: <p>I'm making a plug-in for a program and when faced with the options on how to create a window inside the program with the same style as the program window i opted for using the MFC classes:CDC, CRect, CPen,etc and then using DrawFrameControl i was able to design a simplified version of what i want.</p>
  
  <p>The question now is: i created a close,minimize,etc buttons. But how will i add events to what i have drawn?</p>
  
  <p>I searched online and haven't found a solution, that why i'm asking you guys</p>
  
  <p>Thank you</p>
  
  <p>Here is the code for what i've drawn so far:</p>
  
  <pre><code>CDC dc;
  dc.Attach(hdc);
  CButton but;
  
  CBrush green(COLOR_GREEN);
  CBrush white(COLOR_WHITE);
  CRect rect=GetRadarArea();
  CRect rect2=GetChatArea();
  CPoint ptdown,ptup;
  
  rect.bottom=rect2.top;
  rect.TopLeft().x=rect.BottomRight().x-180;
  //AddScreenObject (1,"Cenas",rect,true,"nice") ;
  
  //but.Create("Undo",BS_PUSHBUTTON,rect,hdc,MYBUTTONID);
  dc.FillRect(&amp;rect,&amp;green);
  
  CRect rect3; //Closebutton
  
  rect3.TopLeft().x=rect.BottomRight().x-10;
  rect3.TopLeft().y=rect.TopLeft().y;
  rect3.BottomRight().x=rect.BottomRight().x;
  rect3.BottomRight().y=rect.TopLeft().y+10;
  dc.DrawFrameControl(&amp;rect3,DFC_CAPTION,DFCS_CAPTIONCLOSE);
  
  CRect rect4; //Minimize button
  
  rect4.top=rect3.top;
  rect4.bottom=rect3.bottom;
  rect4.TopLeft().x=rect3.TopLeft().x-10;
  rect4.BottomRight().x=rect3.BottomRight().x-10;
  dc.DrawFrameControl(&amp;rect4,DFC_CAPTION,DFCS_CAPTIONMIN);
  
  
  CRect rect5;
  rect5.top=rect3.top;
  rect5.bottom=rect3.bottom;
  rect5.TopLeft().x=rect.TopLeft().x;
  rect5.BottomRight().x=rect3.BottomRight().x;
  dc.SetTextColor(COLOR_WHITE);
  dc.DrawText("FL Changes List",rect5,DT_CENTER);
  
  CPen    pen1 ( 0, 0.2, COLOR_WHITE) ;
  dc.SelectObject(&amp;pen1);
  dc.MoveTo(rect.TopLeft().x,rect5.BottomRight().y);
  dc.LineTo(rect.BottomRight().x,rect5.BottomRight().y);
  </code></pre>