|
I use a window with horicontal+vertical ruler from COXRuler and COXRulerOrganizer class (Ultimate Toolbox).
Both start in the left upper corner with the origin. The values on the horicontal ruler grows from left to right. I need a possiblity to change the origin from the horicontal ruler to the right side, so that the values grows from right to left.
It would be a great help for me, if there is somebody with more experience or an idea for a workaround.
Coach Greg
|
|
|
|
|
I'm trying to take an existing class and add a member function to it. Something like this:
class baseclass {
public:
baseclass();
baseclass(int i);
~baseclass();
public:
int a() {
int b() {
}
class derived : public baseclass {
public:
derived() : base();
derived(int i) : base(i);
public:
int sum() { return baseclass->a() + baseclass->b(); };
} I know I have to explicitly declare the constructors, but I'm under the impression that a() and b() are inherited without further effort. Which means if I create an object derived d , then int i = d.a(); is a valid expression.
Do I have to "explicitly inherit" a() and b() in order to use them in sum() ?
I've been all over the documentation and the articles here, but can't seem to track this down.
More nooB questions, I know - any help is appreciated.
MZR
|
|
|
|
|
no need to any further steps. as you've publically inherited from base class, the public and protected attributes and functions are part of derived class.
<blockquote class="FQ"><div class="FQA">Mike the Red wrote:</div>int sum() { return baseclass->a() + baseclass->b(); }; // I DO know it's not done like this...</blockquote>
It should be
int sum() { return baseclass::a() + baseclass::b(); };
is it really not possible for you to call d.a()? what's the problem you're facing?
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Mike the Red wrote: Do I have to "explicitly inherit" a() and b() in order to use them in sum() ?
I've been all over the documentation and the articles here, but can't seem to track this down.
What's wrong with:
class baseclass
{
public:
baseclass(){}
baseclass(int i){}
~baseclass(){}
public:
int a() {return 1;}
int b() {return 2;}
};
class derived : public baseclass
{
public:
derived(){}
derived(int i):baseclass(i){}
public:
int sum()
{
return a() + b();
}
};
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
...Error Between Keyboard and Chair... I get a lot of these...
Thanks, guys!
|
|
|
|
|
Hi
I created a CWnd derived class.
pPreviewWindow = new CMyWindow(this, bitmap);
CRect rc;
pStatic->GetWindowRect(rc);
pPreviewWindow->Create("", "", WS_CHILD| WS_VISIBLE, CRect(rc.left,rc.top,rc.bottom,rc.right), this, 1234);
....
pPreviewWindow->Invalidate();
The "Invalidate" (and other functions) will cause ASSERT(::IsWindow(m_hWnd))" fails.
How can I resolve it?
Best regards,
|
|
|
|
|
transoft wrote: The "Invalidate" (and other functions) will cause ASSERT(::IsWindow(m_hWnd))" fails. How can I resolve it?
Have you checked that Create() was successful?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi
I just checked the Create return value. It is "0". Why would this happen?
I created this class using VS2005 class creation wizard. It looks like:
class CBitmapWindow : public CWnd
{
DECLARE_DYNAMIC(CBitmapWindow)
public:
CBitmapWindow();
CBitmapWindow(CWnd* pParent, HBITMAP hBitmapIn);
virtual ~CBitmapWindow();
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnPaint();
};
pPreviewWindow = new CBitmapWindow(this, pCompatDev->GetBitmap());
BOOL ret = pPreviewWindow->Create("wert", "wert", WS_CHILD| WS_VISIBLE, CRect(rc.left,rc.top,rc.bottom,rc.right), this, 1234);
---------------------------------------
I just checked create format:
virtual BOOL Create(
LPCTSTR lpszClassName,
LPCTSTR lpszWindowName,
DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd,
UINT nID,
CCreateContext* pContext = NULL
);
Must I give "UINT nID" a number or not? If I have no ID number, what should I input here?
Best regards,
modified on Wednesday, July 8, 2009 7:05 PM
|
|
|
|
|
You've to pass a valid class name to the Create function.
Either you can pass some standard window class[^] names
or register your own class name using AfxRegisterWndClass function and pass the name to the Create function
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Where can I find them ? I want to go back in time and have on my hand those tools even if I can get them on a virtual machine.
Can you help me fulfill that wish ?
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
|
|
|
|
|
Probably MSDN has both. You need a subscription though.
I was wrong.
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]
modified on Wednesday, July 8, 2009 11:31 AM
|
|
|
|
|
How are you Pallini. It has been long since we were in touch. I do have an MSDN subscription. I will check on that.
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
|
|
|
|
|
I've not ever seen Windows v3.0 in MSDN, and the last VC++ I had with my subscription was 1.52c.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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're right, indeed, and my guess was wrong.
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]
|
|
|
|
|
Is it really possible to download an unsupported product (especially OS) even we've an MSDN subscription? I think even Visual C++ 6.0 is not possible to download. (Sorry I don't have any MSDN subscription)
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
As David Crow pointed out, MSDN has NOT OP's requested OS and compiler.
Sarath. wrote: Is it really possible to download an unsupported product (especially OS) even we've an MSDN subscription? I think even Visual C++ 6.0 is not possible to download.
You're right about Visual C++ 6.0 : it isn't available on MSDN , anyway Visual Basic 6.0 it still available there and, AFAIK, it is an unsopported product too.
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]
|
|
|
|
|
If I remember correctly, Visual C++ 1.0 did not run on Windows 3.0, but Windows 3.1. (Windows 3.1 displaced Windows 3.0 almost immediately.) You could still create Windows 3.0 applications with it. The final version of Visual C++ 16-bit was 1.52c and I still have my CD-ROM for it in my closet (I had to support more than one 16-bit app through the 90s.)
Visual C++ 1.52c and Windows 3.1 are [typically] both available on eBay.
|
|
|
|
|
If I continue failing to find them, then I will ask you eagerly to give me your copy. I want to travel back in time.
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
|
|
|
|
|
|
Hi,
when i tried to change LPRECT to CRect as follows..
LPRECT lprect;
CRect crect(lprect);
it throws exception as Access violation..
Please let me know how to convert LPRECT to Crect
|
|
|
|
|
LPRECT is a pointer to a RECT structure. In your case, you didn't initialize the pointer, so whe nthe constructor of CRect is trying the content of the pointer, this causes an access violation.
|
|
|
|
|
it was initialised and having the left,right and top values also..
|
|
|
|
|
Hope u didnt allocated LPRECT?
LPRECT lpRect = new RECT();
lpRect->left = 100;
lpRect->right = 200;
lpRect->top = 230;
CRect rec(lpRect);
otherwise no probs
|
|
|
|
|
Don't you like the bottom part?
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]
|
|
|
|
|
They show how to do it [^].
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]
|
|
|
|