|
Quote: which src is a HDC object?
What? That doesn't make sense. Try rephrasing or expand on what you're trying to ask.
|
|
|
|
|
I mean HdcObject in the code.
I just want to copy a HDC object to CDC object, use CDC object's BitBlt() function.
|
|
|
|
|
HDC is a handle not an object....
You can use CDC::FromHandle() to get a temporary object for immediate use. Alternatively, you can CDC::Attach() to keep a more permanent CDC object around. You should make sure you release a device context (DC) when you're done using it (FromHandle sort of automatically handles this situation by going out of scope).
If you have CWnds, you can also get a pointer to an existing CDC with CWnd::GetDC().
There is a lot of info on drawing in GDI online, I suggest you read up on it.
|
|
|
|
|
Hello, I get this error when I try to create a new project wi h Visual Studio 2010 (XP), Win32, MFC or Forms (only VB works)
"Object reference not set to an instance of an object"
I found nothing with Google for this case (just creating a new project) and tried to uninstall/install, repair, n times, impossible to fix
Thanks in advance for any idea, I'm desperate, unable to create even an empty Win32 project !
|
|
|
|
|
Looks like a Visual Studio problem, but impossible to guess what.
|
|
|
|
|
But it appeared just recently, it had worked for years before
|
|
|
|
|
I can only assume that something has been corrupted somewhere. But as I said before, it's impossible to guess what. Your only chance is to collect all the information that you can, and report it to Microsoft.
|
|
|
|
|
How can I get the CListCtrl scrollbar rectangle ? Whether the scrollbar is visible or not, I tested in following way:
if(GetStyle() & WS_VSCROLL)
{
}
but, in order to change the scrollbar background by DrawThemeBackground[^], I need the scrollbar rectangle ... how can I retrieve the scrollbar rectangle ?
|
|
|
|
|
|
Thank you Jochen ... the rectangle is retrieve it ...
I have to dig in, because it seems that something is wrong in my code, because though rectangle is correct now, the color of scrollbar is not drawn ...
void CGridCtrlExt::OnDraw(CDC* pDC)
{
HTHEME hTheme = OpenThemeData(m_hWnd, L"WINDOW");
if(NULL != hTheme)
{
if(WS_VSCROLL & GetStyle())
{
SCROLLBARINFO si;
si.cbSize = sizeof(SCROLLBARINFO);
GetScrollBarInfo(OBJID_VSCROLL, &si);
CRect rect(si.rcScrollBar);
pDC->FillSolidRect(&rect, RGB(255, 255, 0));
DrawThemeBackground(hTheme, pDC->GetSafeHdc(), WP_VERTSCROLL, VSS_NORMAL, &rect, NULL);
}
CloseThemeData(hTheme);
}
}
|
|
|
|
|
This may be because the scroll bar is redrawn by the system.
You may use a custom drawn scroll bar or handle WM_CTLCOLOR when you only need to change the background.
Searching the web may give you some solutions. The article http://www.drdobbs.com/windows/developing-a-custom-windows-scrollbar-in/184416659[^] is rather old but contains a good introduction and shows how to implement a custom drawn scroll bar.
|
|
|
|
|
"You may use a custom drawn scroll bar or handle WM_CTLCOLOR when you only need to change the background"
I already tried that ... if I override WM_CTLCOLOR I could color everything, except scrollbars ...
"Searching the web may give you some solutions. The article http://www.drdobbs.com/windows/developing-a-custom-windows-scrollbar-in/184416659[^] is rather old but contains a good introduction and shows how to implement a custom drawn scroll bar."
I saw that article, but is about replacing the original scrollbar with CScrollBarEx control ... well, in this case I will front with 2 issues: hiding the original scrollbar, and second, synchronize the listctrl with CScrollbarEx control ... I think that is the longest road ... and the hardest ...
I thought that trying to use DrawThemeBackground I could change the scrollbars colors ... I am working on that for weeks ... I have to dig in ...
|
|
|
|
|
"This may be because the scroll bar is redrawn by the system"
I wonder if I put properly the scrollbar coloring code ... inside of CMyControl::OnDraw is ok ? I guess not ...
|
|
|
|
|
OnDraw is a CView member function. You probably mean some kind of custom / owner draw. But this won't work for the scroll bars of list controls because only the list control content can be changed by this method. The scroll bar is still drawn by the system when necessary and your drawing vanishes.
If handling WM_CTLCOLOR did not work (and I believe meanwhile that it does not work with list controls), the only solution is using a complety custom drawn control or another GUI framework like Qt.
|
|
|
|
|
Thank you so much for your attention Jochen !
In the real situation, I used an CGridCtrl, and this control has CGridCtrl::OnDraw to drawing itself ... but there is no difference between this kind of control or CListCtrl, or CListBox ... I had tried to change the color of the scrollbars of these last ones and I didn't succeded ...
After all, CGridCtrl is derived from CWnd, so is the same matter ... Should be a chance to move that code on some handler that is called after the system is redrawing the scrollbars ? ... who knows ...
I should dig in ...
modified 23-Jan-15 8:47am.
|
|
|
|
|
Hello,
Is it possible to retrieve module state information (AFX_MODULE_STATE) of a regular DLL (MFC shared) that is loaded in an MFC application from within the EXE?
Thank you very much in advance
|
|
|
|
|
can anybody tell me how to design in C 
|
|
|
|
|
Pretty much like you would design in any procedural language. You know C supports structured programming[^].
[edit]
Fixed the link, thanks to Richard Andrew x64
[/edit]
modified 20-Jan-15 11:09am.
|
|
|
|
|
Link is broken.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
|
Did you mean to link to a page about "banking industry jargon?" If so, then the link works.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
OOOOPS
and double OOOOOOOOOPS .
Fixed the link, thanks.
|
|
|
|
|
This isn't bugzilla! 
|
|
|
|
|
Designs are usually language neutral.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|