|
Your welcome.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
i have a Sdi with a splitter (4 rows).
When i click on the maximize button the window is maximized and the 1. splitter row changes its height proportionally , but when i try to restore, nothing happens with the Splitter ;(.
Please help me !
Here is my code:
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
int iCurRow_cy = 0, iMin_cy = 0;
static int iOldWnd_cy = 0, iOldWnd_cx = 0;
int iNewCurRow_cy = 0;
static int iZaehler = 0;
static CString a, b, c, d;
iZaehler++;
if (iZaehler == 1)
{
iOldWnd_cy = cy;
a.Format("%02d",iOldWnd_cy);
b.Format("%02d",cy);
c.Format("%02d",iCurRow_cy);
d.Format("%02d",iNewCurRow_cy);
MessageBox("iOldWnd_cy: "+ a + "\ncy: " + b + "\niCurRow_cy: " + c + "\niNewCurRow_cy: " + d,"in: iZaehler == 1 " ,MB_OK);
}
if ((nType == SIZE_MAXIMIZED))
{
m_Splitter_Main.GetRowInfo(0 ,iCurRow_cy, iMin_cy);
iNewCurRow_cy = (int)ResizeSplitter(cx, cy, iOldWnd_cx, iOldWnd_cy, iCurRow_cy, 1);
a.Format("%02d",iOldWnd_cy);
b.Format("%02d",cy);
c.Format("%02d",iCurRow_cy);
d.Format("%02d",iNewCurRow_cy);
MessageBox("iOldWnd_cy: "+ a + "\ncy: " + b + "\niCurRow_cy: " + c + "\niNewCurRow_cy: " + d,"in: SIZE_MAXIMIZED " ,MB_OK);
m_Splitter_Main.SetRowInfo(0, iNewCurRow_cy , 0);
m_Splitter_Main.RecalcLayout();
}
else if((!m_Splitter_Main.m_hWnd && nType == SIZE_RESTORED))
{
m_Splitter_Main.GetRowInfo(0 ,iCurRow_cy, iMin_cy);
iNewCurRow_cy = (int)ResizeSplitter(cx, cy, iOldWnd_cx, iOldWnd_cy, iCurRow_cy, (1));
a.Format("%02d",iOldWnd_cy);
b.Format("%02d",cy);
c.Format("%02d",iCurRow_cy);
d.Format("%02d",iNewCurRow_cy);
MessageBox("iOldWnd_cy: "+ a + "\ncy: " + b + "\niCurRow_cy: " + c + "\niNewCurRow_cy: " + d,"in: SIZE_RESTORED " ,MB_OK);
m_Splitter_Main.SetRowInfo(0, iNewCurRow_cy , 0);
m_Splitter_Main.RecalcLayout();
}
CFrameWnd::OnSize(nType, cx, cy);
}
double CMainFrame::ResizeSplitter(int cx, int cy, int iOldWnd_cx, int iOldWnd_cy, int iCurRow_cy, int iZahl)
{
double iNewCurRow_cy;
double iDiff;
double iFaktor;
CString ccc;
CString ddd;
CString aaa;
CString bbb;
iDiff = cy - iOldWnd_cy;
iFaktor = iDiff / cy;
iNewCurRow_cy = (iCurRow_cy * ((iFaktor)+(iZahl)));
return iNewCurRow_cy;
Many, many thanks !
Best regards !
Croc
|
|
|
|
|
REALLY NOBODY !!!???
Best regards
Croc
|
|
|
|
|
Have you tried handling WM_WINDOWPOSCHANGED?
This is called whenever you minimize, maximize, restore or move. I reckon you'll get away with
making the code in your onSize handler respond to WM_WINDOWPOSCHANGED instead of WM_SIZE.
modified on Sunday, October 12, 2008 8:44 AM
|
|
|
|
|
THX enhzflep,
i'll try it !!!
Best regards
ShadowEater
|
|
|
|
|
Look at the following piece of code:
class IAbstractBase
{
public:
virtual void funca() = 0;
};
class IAbstractDerived : public IAbstractBase
{
public:
virtual void funcb() = 0;
};
class BaseImpl : public IAbstractBase
{
public:
void funca() { }
};
class DerivedImpl : public BaseImpl, public IAbstractDerived
{
public:
void funcb() { }
};
void some_func()
{
DerivedImpl* x = new DerivedImpl();
}
The compiler now tells me that i can't instanciate DerivedImpl, because funca() has no implementation. What i don't understand is that funca() is defined in BaseImpl, which is a base class of DerivedImpl, but the compiler doesn't care about that.
Here is the exact compiler output:
------
.\Test.cpp(33) : error C2259: 'DerivedImpl' : cannot instantiate abstract class
due to following members:
'void IAbstractBase::funca(void)' : is abstract
.\Test.cpp(6) : see declaration of 'IAbstractBase::funca'
------
Any idea for a solution of that problem?
|
|
|
|
|
Why do you use the (slighty modified) diamond inheritance pattern? could you avoid it, couldn't you?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I don't think that it is really a diamond.
Please look at my answer at: (link)[^]
|
|
|
|
|
Andreas Kilian wrote: What i don't understand
Multiple inheritance diamond problem[^]
Andreas Kilian wrote: Any idea for a solution of that problem?
No because that depends on your requirements which you have not provided. Essentially you need a different design which of course is based on the requirements.
led mike
|
|
|
|
|
The diamond:
IAbstractBase
/ \
/ \
BaseImpl AbstractDerived
\ /
\ /
DerivedImpl
Andreas Kilian wrote: Any idea for a solution of that problem?
You could maybe use virtual inheritance, but be sure
it's what you want (that's why this code throws a warning)...
class IAbstractBase
{
public:
virtual void funca() = 0;
};
class IAbstractDerived : public <code>virtual</code> IAbstractBase
{
public:
virtual void funcb() = 0;
};
class BaseImpl : public <code>virtual</code> IAbstractBase
{
public:
void funca() { }
};
class DerivedImpl : public BaseImpl, public IAbstractDerived
{
public:
void funcb() { }
};
I have a feeling that may not be what you want...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi!
I don't think that it is a classical diamond because IAbstractBase and IAbstractDerived are pure virtual. I think my problem is that i've been programming Java and C# for too long. In those languages the classes IAbstractBase and IAbstractDerived were interfaces. Java code would look like:
interface IAbstractBase {}
interface IAbstractDerived extends IAbstractBase {}
class BaseImpl implements IAbstractBase {}
class DerivedImpl extends BaseImpl implements IAbstractDerived {}
this is totally legal and works fine in Java. I just adopted that design and took "pure virtual classes" in C++ as what is called an "interface" in Java (and C#).
I rewrote the code to:
class IAbstractBase { };
class IAbstractDerived : virtual public IAbstractBase { };
class BaseImpl : virtual public IAbstractBase { };
class DerivedImpl : public BaseImpl, virtual public IAbstractDerived { };
Virtual inheritance solves the compiler error. What i've done is using virtual inheritance for all pure virtual classes. But i still get a warning:
.\Test.cpp(34) : warning C4250: 'DerivedImpl' : inherits 'BaseImpl::BaseImpl::funca' via dominance
.\Test.cpp(24) : see declaration of 'BaseImpl::funca'
I'm sure i can safely ignore this warning because there's only one inheritance path which has function implementations (and data members). All other add just pure virtual functions.
But thanks for you anser! Your hint to virtual inheritance solved my problem.
|
|
|
|
|
This isn't java - The inheritance paths with multiple inheritance
in C++ are separate (so I guess it's a pyramid, not a diamond)
Anyway, both inheritance paths have to implement any pure virtual
functions along the path, unless you use virtual inheritance.
Andreas Kilian wrote: I'm sure i can safely ignore this warning
If you'd like, you can disable it for that code with
#pragma warning disable 4250 // disable "'DerivedImpl' : inherits 'BaseImpl::BaseImpl::funca' via dominance"
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hey everybody!
How do I get the domain's SID???
I looked all over the web for that, and I also checked the WMI.
Any help with that, anyone???
Thanks!
|
|
|
|
|
Green Fuze wrote: How do I get the domain's SID???
You mean this?[^]
led mike
|
|
|
|
|
Yeah!
Thanks!
and with that, I also found ConvertSidToStringSid() to get it to string.
But how do I get the the account SID needed for GetWindowsAccountDomainSid???
thanks a lot! again!
|
|
|
|
|
Nevermind, got that
|
|
|
|
|
Hello All,
I am trying to write a program who acts as client and server both, first it connects to the main server and then can communicate with other clients directly and can maintain connection with the main server simeltaneously.
Can anyone help on this please? Its really urgent.
Thanks.
|
|
|
|
|
smdhd wrote: Its really urgent.
Its always.. writing urgentz in posts generally doesn't help getting answers.
Now regarding your problem..
Can you please tell us so far what have you done ?? and where are you stuck??
Regards,
Sandip.
|
|
|
|
|
smdhd wrote: Can anyone help on this please?
Help you with what?
smdhd wrote: Its really urgent.
Really? It is? If it so urgent why did you not post what you need help with? At this point you should seriously consider a different line of work.
led mike
|
|
|
|
|
|
I think you've to write the server code and the client one. BTW the clients and the server are supposed to communicate, possible via some kind of IPC.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hey Friends
Any idea how they would have created yahoo messenger (not complete but only layout) for vista?
A Dialog Box with some images on that?
or something else?
Regards
|
|
|
|
|
I thought I heard it uses WPF[^].
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
yeah that's amazing stuff & brilliant work by yahoo
with these kind of utilities i hope users will really feel that they are using vista
and i am going to look for some tutorial / small programs for wpf
can't wait to try it
|
|
|
|
|