What are you trying do? Looks like you are trying to change the background color. If that is the case handle WM_CTLCOLOR message.
Mohan Ramachandra
Posts
-
RedrawWindow + ListControl -
FullScrean listboxAdding to the Niklas Lindquist suggestions in the below post GetClientRect API helps to obtain the client area of the Window. Get the parent window's client area and resize listbox according to it or the way you want.
-
FullScrean listboxResize the ListBox using MoveWindow API while changing from full screen to regular mode and vice versa.
-
Round Buttonjohn5632 wrote:
Button is coming with round edges but If button repaints it is becoming rectanglular shape button. What shall I do?
I think your drawing the whole rectangular area of the button in OnDraw function. Draw only the round rectangular area of the button. OR Draw the button with the dialog background first and then draw the remaining things.
-
stream objectTypecast..
char arrc[10];
functionName((LPUNKNOWN) arrc); -
Errorjohn5632 wrote:
mfc90.dll is not a valid Windows image
Replace with a new DLL(mfc90.dll). The Dll that you are using might be corrupted.
-
CButton changing background colorTry this
// Add a CBrush member variable CBrush m\_brushBK;
In OnInitialUpdate function
m\_brushBK.CreateSolidBrush(RGB(200,200,0));//Set brush color
In the OnCtlColor function
HBRUSH CtestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{if(pWnd->GetDlgCtrlID()==IDC\_CHECK1)// Control ID of the Check box { return m\_brushBK; } else { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); return hbr; }
}
-
Draw filled circleTry this...
CDC \*pDC = GetDC(); CRect rect; GetClientRect(rect); CBrush brush; brush.CreateSolidBrush(RGB(255,0,0)); CBrush \*pOldBrush= pDC->SelectObject(&brush); pDC->Ellipse(rect); pDC->SelectObject(pOldBrush); ::ReleaseDC(m\_hWnd,pDC->m\_hDC );
-
CString conversion problemCedric Moonen wrote:
No, calling GetBuffer is really a very bad practice. You shouldn't do that, the CString class already provides cast operators so there's no need to call GetBuffer !
Thanks, I didn't know that
-
Strange problem with pointersAgain you forgot to mention the type of buffer?
-
CString conversion problemTry this :)
WCHAR disname\[100\]={0}; CStringW name; name= m\_IniReader.getKeyValue(str,"VIEWNAME"); wcscpy(disname, (LPCWSTR)name.GetBuffer(100)); MessageBoxW(NULL,disname,disname,MB\_OK); name.ReleaseBuffer(100);
-
CString conversion problemHow are you converting?
-
VC++2008(graphics)!I think you are trying to compile the code, which was written using turbo c++ compiler? Because
anassamar wrote:
'graphics.h':
and
anassamar wrote:
I want to use the follwing functions: setcolor Graphmode Textmode , lineto ……………!!!!
are graphical functions and header file provided in turbo c++ compiler.
-
making a modelessdialog box as modalJust call DoModal [^] member function of the dialog in the, menu message handler.
-
How to remove default icon in caption of MessageBoxam 2009 wrote:
MB_TOPMOST property is ignored by vista. It is working fine on Windows XP,but not on Vista.
I am using Vista and it's working fine.
-
How to remove default icon in caption of MessageBox:thumbsup:
-
How to remove default icon in caption of MessageBoxHope this one will help
MessageBox(NULL,L"Please start application ",L"Test",MB_OK |MB_TOPMOST);
MB_TOPMOST : Creates the message box with the WS_EX_TOPMOST window style.
-
How to set the ListCtrl's item color ?You need to do custom draw in CListCtrl. This article in CP might help you [^]
-
mfc application hangsEstablish connection using thread AfxBeginThread . Then your main application thread won't stuck
-
UAC and restarting an external service in my MFC appThis one might help
Sternocera wrote:
ms_asmv2:requestedExecutionLevel level="highestAvailable"
change to ms_asmv2:requestedExecutionLevel level="highestAvailable" uiAccess="true"