|
If this is supposed to be useful to anyone but yourself, perhaps you could create an article for it, rather than just a post that will go away in a matter of hours. Provide lots of documentation as to what it is and/or isn't supposed to do.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
|
|
Not really a question, but rather signaling a MFC pitfall...
wincore.cpp, approx. line 3152 (Visual C++ 6.0, SP6)
void CWnd::CenterWindow(CWnd* pAlternateOwner)
{
ASSERT(::IsWindow(m_hWnd));
// determine owner window to center against
DWORD dwStyle = GetStyle();
HWND hWndCenter = pAlternateOwner->GetSafeHwnd();
if (pAlternateOwner == NULL)
{
...
Seems to me that pAlternateOwner calls first GetSafeHwnd, then is tested if is NULL...
-- modified at 1:55 Monday 7th August, 2006
|
|
|
|
|
GetSafeHwnd() works fine if pAlternateOwner is null:
HWND CWnd::GetSafeHwnd() const { return this == NULL ? NULL : m_hWnd; } If the this object is NULL , it just returns NULL .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Correct, I didn't checked. Sorry about that.
|
|
|
|
|
Is pAlternateOwner valid?
|
|
|
|
|
Can be NULL or not, but Mike Dunn corrected me. GetSafeHwnd returns NULL if "this" is NULL. A little bit strange to me to have
CWnd *pAlternateOwner = NULL;
HWND hwndAlternate = pAlternateOwner->GetSafeHwnd(); // NULL because pAlternateOwner is NULL
|
|
|
|
|
Cristian Amarie wrote: HWND hWndCenter = pAlternateOwner->GetSafeHwnd();
GetSafeHwnd() is an inline function, so there's nothing to dereference.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello.
In my application I have added a combo box on the toolbar by calling Create()
method.
My requirement is to keep this combo box disabled initially. And after some specific action I want this combo box to be enabled. I can disable it while creating it by passing WS_DISABLE, but the question is how can I enable it after words?
Please reply.
-- modified at 1:46 Monday 7th August, 2006
Rakesh
|
|
|
|
|
m_ComboBox.EnableWindow(0);
|
|
|
|
|
Thanks dude...It worked.
Thanks again.
Rakesh
|
|
|
|
|
Rakesh_Thakur wrote: disable it while creating it by passing WS_DISABLE,
The EnableWindow function enables or disables mouse and keyboard input to the specified window or control.
Are you creating the combo box and have the handle to that window
EnableWindow(hwndCombo,true); will enable the combo box
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi
I should implement functionalities of MS paint ,like I need to identify the regions in a bitmap and then fill the regions with a specified color.
Could any one please provide me with relavant information or links?
The happiest of people don't necessarily have the best of everything; they just make the most of everything that comes along their way.
|
|
|
|
|
Is your purpose?
<br />
include AtlImage.h<br />
HDC hdc=CreateCompatibleDC(GetDC()->m_hDC);<br />
HBITMAP hbit=CreateCompatibleBitmap(GetDC()->m_hDC,100,100); <br />
SelectObject(hdc,hbit);<br />
FillRect(hdc,CRect(0,0,100,100), (HBRUSH)GetStockObject(WHITE_BRUSH) ); <br />
TextOut(hdc,0,0,"test",4); <br />
CImage m_Image; <br />
m_Image.Attach(hbit); <br />
m_Image.Save("D:\\test.bmp"); <br />
DeleteObject(hbit); <br />
DeleteDC(hdc);<br />
|
|
|
|
|
I should implement Hit Testing in a Region.
|
|
|
|
|
So see,a image in 800x600 and a square on thr image
<br />
CImage m_Image;<br />
m_Image.Load("d:\\0.bmp");<br />
m_Image.BitBlt(GetDC()->m_hDC,0,0,800,600,0,0);<br />
<br />
FillRect(GetDC()->m_hDC,CRect(0,0,100,100), (HBRUSH)GetStockObject(BLACK_BRUSH) );
|
|
|
|
|
I am using CxImageLib. I have included all the include file in the directiory tab and copied all the dlls and lib file of that project in to my project. But when i copile and build my project in shows an error...
fatal error C1083: Cannot open include file: 'stdbool.h': No such file or directory
where the #include <stdbool.h> statement is in some library header file.
How to solve this.Please help.
KIRAN PINJARLA
|
|
|
|
|
|
Hi all,
I have drawn a Circle by using cdc::Ellipse(...) in a Dialog. I have a Button Control in the Dialog, when i click the button how can i erase the ellise which i have drawn with the Mouse.
I don't want to use Invaldate(..), InvalidateRect(...) for this method.
Is it possible with dc.SetRop2(...) method. if possible please provide a solution for it.
uday.
|
|
|
|
|
if you dont want to use Invalidate did you see CDC::RestoreDC and CDC::SaveDC
|
|
|
|
|
Hi whitsky,
Please give a snippet of code so that i can understand how to erase the Ellipse when i click the Button in a CDialog.
Please help me out.
Uday kiran
|
|
|
|
|
|
Drawing with an XOR operation is the usual way of restoring the original bitmap - just do the same XOR draw again. Otherwise, the original draw overwrites the bits where the ellipse goes, and you have to redraw the window to remove the ellipse.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|