Click here to Skip to main content
15,894,106 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to avoid context menu for activex control Pin
MKC00227-Aug-10 1:07
MKC00227-Aug-10 1:07 
GeneralRe: how to avoid context menu for activex control Pin
Cool_Dev27-Aug-10 2:57
Cool_Dev27-Aug-10 2:57 
Questionallocate and lock memory Pin
AmbiguousName17-Aug-10 0:30
AmbiguousName17-Aug-10 0:30 
AnswerRe: allocate and lock memory Pin
Moak17-Aug-10 0:36
Moak17-Aug-10 0:36 
AnswerRe: allocate and lock memory Pin
Maximilien17-Aug-10 0:54
Maximilien17-Aug-10 0:54 
AnswerRe: allocate and lock memory PinPopular
Aescleal17-Aug-10 1:19
Aescleal17-Aug-10 1:19 
AnswerRe: allocate and lock memory Pin
«_Superman_»17-Aug-10 19:23
professional«_Superman_»17-Aug-10 19:23 
QuestionFillRect C++ Pin
arthur89kim17-Aug-10 0:18
arthur89kim17-Aug-10 0:18 
Hi all, I am using Visual Studio 2005 with MFC application. I have create a transparent window with following codes:

HINSTANCE hInst = ::GetModuleHandle(NULL);

WNDCLASSEX wc;
wc.cbSize=sizeof(WNDCLASSEX);
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = (HBRUSH)GetStockObject( NULL_BRUSH );
wc.hCursor = LoadCursor( NULL, IDC_CROSS );
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wc.hInstance = hInst;
wc.lpfnWndProc = (WNDPROC) CCaptureDlg::WndProc;
wc.lpszClassName = L"Test";
wc.lpszMenuName = 0;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.hIconSm = NULL;

        m_hWnd=::CreateWindowEx(WS_EX_TRANSPARENT|WS_EX_TOPMOST,L"Test",0, WS_VISIBLE|WS_POPUP,0,0, m_ComputerResolutionX, m_ComputerResolutionY,0,0,0,this);


In that Window "Test", I can drag and draw a rectangle but when I keep dragging and moving the mouse around the screen, it does not clear off my previous drawing, is there a way to clear off my previous drawing? I have tried FillRect as following but still does not work:

case WM_MOUSEMOVE:
     {
 if (pClass->m_MouseDown==1)  //to indicate mouse is pressed before drawing
 {
             HDC hdc;
 hdc = ::GetWindowDC(hwnd);
             RECT re;
 SetRect(&re, 0,0,pClass->m_ComputerResolutionX,pClass->m_ComputerResolutionY);

 HBRUSH brush =(HBRUSH)::GetStockObject(NULL_BRUSH);
 if (pClass->m_tempPoint.x!=p.x && pClass->m_tempPoint.y!=p.y)    //if mouse move into different position
 {
     static int count = 0;
     TRACE(L"Test %d\n", count++);
     FillRect(hdc,&re,brush);
     pClass->m_tempPoint=p;
 }

 CPen mypen(PS_DOT, 1, RGB(0,0,0));
 HPEN pen = (HPEN)mypen;

 SelectObject(hdc, pen);
 SelectObject(hdc, brush);
             ::Rectangle( hdc, pClass->m_InitPoint.x, pClass->m_InitPoint.y, p.x , p.y);
             }
 break;
     }


Or is there another way to remove my previous drawing on this transparent window other than FillRect? I would be pleased to learn about it. TQ~
Teaching and learning is a cycle...

Learning something new enable to teach others;
Teaching others enable self learning.

AnswerRe: FillRect C++ PinPopular
Richard MacCutchan17-Aug-10 0:44
mveRichard MacCutchan17-Aug-10 0:44 
GeneralRe: FillRect C++ Pin
malcombold10-Sep-10 23:14
malcombold10-Sep-10 23:14 
GeneralRe: FillRect C++ Pin
Richard MacCutchan11-Sep-10 1:33
mveRichard MacCutchan11-Sep-10 1:33 
AnswerRe: FillRect C++ Pin
Eugen Podsypalnikov17-Aug-10 3:15
Eugen Podsypalnikov17-Aug-10 3:15 
QuestionResizing controls in CFormview Pin
Sakhalean16-Aug-10 23:23
Sakhalean16-Aug-10 23:23 
AnswerRe: Resizing controls in CFormview Pin
Nuri Ismail16-Aug-10 23:33
Nuri Ismail16-Aug-10 23:33 
AnswerRe: Resizing controls in CFormview Pin
Le@rner17-Aug-10 1:09
Le@rner17-Aug-10 1:09 
QuestionClass Templates and MFC Pin
Rajeswari, T.16-Aug-10 23:19
Rajeswari, T.16-Aug-10 23:19 
AnswerRe: Class Templates and MFC Pin
Nuri Ismail16-Aug-10 23:28
Nuri Ismail16-Aug-10 23:28 
AnswerRe: Class Templates and MFC Pin
bleedingfingers16-Aug-10 23:56
bleedingfingers16-Aug-10 23:56 
AnswerRe: Class Templates and MFC Pin
Maximilien17-Aug-10 1:16
Maximilien17-Aug-10 1:16 
Questionthreads in C++... Pin
mashhur16-Aug-10 22:42
mashhur16-Aug-10 22:42 
AnswerRe: threads in C++... Pin
Moak17-Aug-10 0:18
Moak17-Aug-10 0:18 
QuestionCRichEditCtrl show text? Pin
yfpfly16-Aug-10 22:30
yfpfly16-Aug-10 22:30 
AnswerRe: CRichEditCtrl show text? Pin
Nuri Ismail16-Aug-10 22:55
Nuri Ismail16-Aug-10 22:55 
GeneralRe: CRichEditCtrl show text? Pin
yfpfly5-Sep-10 17:28
yfpfly5-Sep-10 17:28 
QuestionHow to write Password code in cpp Pin
ganesh_IT16-Aug-10 21:32
ganesh_IT16-Aug-10 21:32 

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.