|
|
yes one example is on MSDN see BitBlt on MSDN.
|
|
|
|
|
(1)You can use of CAnimateCtrl or use of MCI functions
(2)You can open your file with CImage class and use of WM_ERASEBKGND for show it
<br />
#include AtlImage.h<br />
CImage m_Image;<br />
m_Image.Load("c:\\0.jpg");<br />
....<br />
void CAnswerDlg::OnPaint() <br />
{<br />
CPaintDC dc(this);<br />
m_Image.BitBlt(dc.m_hDC,0,0,640,480,0,0);<br />
}<br />
|
|
|
|
|
I am reading here c++ faqs Private inheritance section: http://www.parashift.com/c++-faq-lite/private-inheritance.html
There is an expression that i don't understand.They said :"Private inheritance makes all of the public functions of the parent class private in the child class".
So i understand that we can not reach them from derived class.But with "::" operator we can reach the functions.I don't understand the magic of this operator.I know it is scope resolution operator but is this also can reach private sections of the classes?
Or is this extraordiary rule for private inherintance.
class Wilma {<br />
protected:<br />
void fredCallsWilma()<br />
{<br />
std::cout << "Wilma::fredCallsWilma()\n";<br />
wilmaCallsFred();<br />
}<br />
virtual void wilmaCallsFred() = 0;
};<br />
<br />
class Fred : private Wilma {<br />
public:<br />
void barney()<br />
{<br />
std::cout << "Fred::barney()\n";<br />
Wilma::fredCallsWilma();
}<br />
protected:<br />
virtual void wilmaCallsFred()<br />
{<br />
std::cout << "Fred::wilmaCallsFred()\n";<br />
}<br />
};<br />
<br />
also<br />
class D_prot : protected B {<br />
public:<br />
using B::f;
}
|
|
|
|
|
sawerr wrote: So i understand that we can not reach them from derived class.
Not technically correct. It is more like copying every member of the base class into the child class, but putting it all under the private keyword. The child class can see (that is call) the base class' methods, but any outsiders would only be able to call the child class' public methods.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
Zac Howland wrote: It is more like copying every member of the base class into the child class, but putting it all under the private keyword. The child class can see (that is call) the base class' methods, but any outsiders would only be able to call the child class' public methods.
Not really. OP got it right, just used protected in his sample.
|
|
|
|
|
Nemanja Trifunovic wrote: Not really. OP got it right, just used protected in his sample.
Check again (he copied the example from the C++ FAQ):
lass Wilma {
protected:
void fredCallsWilma()
{
std::cout << "Wilma::fredCallsWilma()\n";
wilmaCallsFred();
}
virtual void wilmaCallsFred() = 0;
};
class Fred : private Wilma {
public:
void barney()
{
std::cout << "Fred::barney()\n";
Wilma::fredCallsWilma();
}
protected:
virtual void wilmaCallsFred()
{
std::cout << "Fred::wilmaCallsFred()\n";
}
};
also
class D_prot : protected B {
public:
using B::f;
}
For more information, check out this: http://www.gotw.ca/publications/mill06.htm[^]
And if you still don't believe me, try this:
#include <iostream>
using namespace std;
class Base
{
public:
Base() { cout << "Base::Base()" << endl; }
virtual ~Base() { cout << "Base::~Base()" << endl; }
void Print() { cout << "Base::Print()" << endl; }
};
class Child : private Base
{
public:
Child() { cout << "Child::Child()" << endl; }
virtual ~Child(){ cout << "Child::~Child()" << endl; }
void MyPrint()
{
cout << "Child::MyPrint()" << endl;
Print();
}
};
int main()
{
Child c;
c.MyPrint();
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
You're right. I didn't carefully look at his code, and it was a part of your comment that confused me :
It is more like copying every member of the base class into the child class, but putting it all under the private keyword
From the outsider's point of view it is correct, but the child class cannot access non-public members of base, and if you copy every member of the base to child's private section, all of them would be accessible from the child.
|
|
|
|
|
Nemanja Trifunovic wrote: From the outsider's point of view it is correct, but the child class cannot access non-public members of base, and if you copy every member of the base to child's private section, all of them would be accessible from the child.
The child class can access protected members, but no, it can't access private members.
As a side note, this is part of why it is recommended to NOT use private inheritance unless it is absolutely necessary (which it only is in very few cases) and instead use aggregation.
[sarcasm]Of course, my favorite type of inheritance is still protected .... [/sarcasm]
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
That's because you are using protected , not private
[EDIT] Forget it - didn't read the code sample well[/EDIT]
-- modified at 13:11 Friday 13th October, 2006
|
|
|
|
|
Hi
I am very new to VC++ ,I want to add a progress bar. Can anybody tell me how to put a progress bar in an application
Waiting for reply
|
|
|
|
|
You can see two examples of CProgressCtrl class on MSDN
|
|
|
|
|
Hi,
Use CProgressCtrl class or CreateWindow with PROGRESS_CLASS as its class name.
Regards
|
|
|
|
|
you can look at msdn sample CMNCTRL2. It has a sample of CProgressCtrl. but as a sample
//make a memebr variable
CProgressCtrl m_Progress;
//in OnInitDialog()
m_Progress.Create(WS_VISIBLE | WS_CHILD, rect, this, IDC_PROGRESS);
m_Progress.SetRange(0, 30);
//set the step by
m_Progress.SetStep(2);
//increment it
m_Progress.StepIt();
//or set position by
m_Progress.SetPos(26);
|
|
|
|
|
Javagal Srinath wrote: Can anybody tell me how to put a progress bar in an application
Like you would any other control. With your dialog template open in the resource editor, just select the control (in the Controls window) you want to add and then click the dialog. Move and size as needed.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I want to copy the items from the tree control that are selected using checkboxes into the File Open Dialog Box.To be brief my aplication consists of tree conrol and button in a form view.When i press the button File open Dialog Box is opening.Now i want to add the selected items from the tree control to that opened window.How can i do it.
Thanks.
|
|
|
|
|
Hi,
Open file dialog box is not designed for such functionality, it is common dialog box, though it is not impossible.
Use CopyFile, MoveFile functions to copy files to specified directory.
Regards
|
|
|
|
|
Galatei wrote: Open file dialog box is not designed for such functionality, it is common dialog box, though it is not impossible.
The open file dialog allows dragging and dropping files
Mark
|
|
|
|
|
Is there any article that contains dragging and dropping folders from tree control to the outside environment i.e,open file dialog box or desktop etc.If it is there please tell me ,it is very urgently needed for my project.
|
|
|
|
|
|
I have a application in which I open a file to edit in Notepad. But when I used the _execl() function, the dialog disappeared and Notepad was active. I can not to find the way that is appropriate to fix the problem so I want to have help from more experient people. sincerely thank alot
duc an
|
|
|
|
|
Hi,
AFAIK _execl & _wexecl doesn't return to the calling process if operation was successfull.
You can use ShellExecute , to do that, with a lot more flexibility.
Regards
|
|
|
|
|
Pham duc an wrote: But when I used the _execl() function...
Why use such antiquated functions when CreateProcess() and ShellExecute() are available?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
My project code is same as below. In the below code i get an exception when i delete the amount.
Please kindly tell me what exactly is wrong in the below code.
I should be able to use the values and also delete it.
#include "stdafx.h"
#include "iostream.h"
#include "iomanip.h"
#include <algorithm>
#include <vector>
void fun(long **a);
int main(int argc, char* argv[])
{
long *amount = NULL;
fun(&amount);
for (int i = 0; i<5 ;++i,++amount)
{
cout<< *amount <<endl;
}
="" delete="" amount;="" i="" get="" an="" exception="" here.
="" return="" 0;
}
void="" fun(long="" **a)
{
="" *a="new" long[5];
=""
="" std::vector<long=""> var;
var.push_back(5);
var.push_back(6);
var.push_back(65);
var.push_back(58);
var.push_back(57);
std::vector<long>::iterator i;
int k = 0;
for(i= var.begin();i != var.end();++k, ++i)
{
a[k] = new long;
(*a)[k] = *i;
}
}
Thanks in advance!
Thanks & Regards,
Dhana
|
|
|
|