|
Yes you must check them else you have trouble code.
|
|
|
|
|
Ok, thanks.
I appreciate your help all the time...
Eranga
|
|
|
|
|
|
now that i am displaying the designators in a combo box. i used recursive function to display that in the combo box. the next thing that i need to do is when i click on the designator the files and folders in that designator should display in a list box. what needs to be done for that?
chandru080
|
|
|
|
|
Well it seems that this question is in the continue other question but do you want to show content a file on the listbox or other thing?
|
|
|
|
|
yes it is. i need to shw the content of the directory in a list box. that is when i click on C: the folders and files of that c: should appear on the listbox. same goes to other directories also
|
|
|
|
|
For show files and folders on the listbox you can use of DlgDirList function also you can use of FindFirstFile/FindNextFile .
|
|
|
|
|
Take a look in the forum, there has been a similar question a few days ago
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Nelek wrote: ...there has been a similar question a few days ago
And the posters share the same name. Amazing! Maybe that's why he started off by stating, "now that i am displaying the designators in a combo box."
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
something wrong in that usage??? well that was a continuation of a previous query. thought will start of with a new one..
|
|
|
|
|
Chandrasekharanp wrote: something wrong in that usage???
No, I was just curious why Nelek did not associate the two posts were both from you.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Because I didnt notice different questions, sorry
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
what is advantage of "Base class pointer to Derived Class object" ?
class Base
{
public:
Base(){ cout<<"Constructor: Base"<<endl;}
~base(){ cout<<"destructor="" :="" base"<<endl;}
void="" funbase()
{
cout="" <<"base="" function="" invoked"<<endl;
}
};
class="" derived:="" public="" base
{
public:
derived(){="" cout<<"constructor:="" derived"<<endl;}
~derived(){="" derived"<<endl;}
void="" funderived()
{
cout="" <<"derived="" invoked"<<endl;
}
};
int="" _tmain(int="" argc,="" _tchar*="" argv[])
{
cout<<"ashish"<<"\n";
base="" *var="new" derived();
delete="" var;
}
even="" though="" "var"="" points="" to="" derived="" class="" object="" ,="" it="" cannot="" access="" member="" i.e="" funderived().="" var="" can="" only="" base="" functions.
instead="" of="" why="" dont="" we="" use="" ,
base="" *check="new" base();
check-="">fun1();
I guess it is having same behaviour. Please let me know wht is advantage of using base class pointer to derived class object?
Thanks\
Ash.
|
|
|
|
|
It is in fact extremly powerfull and widely used. This is what is called 'polymorphism' (if you google for it, you'll probably find tons of information).
The principle is that you declare some virtual function in your base class that can be redefined by a derived class. In this way the derived class can have a different behavior as its parent. And, if you have several different derived classes that inherit from the same base class, they all can be treated as a base class but have different behavior (and, so, they can all be stored in an array for example).
If you want a typical example: suppose that you write a program to draw shapes (triangles, squares, circles, ...). What you would do in that case is have a base class CShape that has a virtual method Draw. Each derived class (CSquare, CCircle, CTriangle, ...) will specialize this Draw method for itself. All the shapes, as they are inherited by the same base class can be manipulated exactly the same way (they will be stored in an array, and whenever you need to redraw your drawing, you will call Draw from all the shapes in your array, no matter what shape it really is).
This is an extremly important concept in OOP.
|
|
|
|
|
Try using virtual functions.
This gives your base class pointer a behaviour depending on the class where it is derived from.
class CBase
{
public:
virtual void OpenDoor( ) = 0;
};
class House: public CBase
{
public:
virtual void OpenDoor( )
{
AfxMessageBox(_T("Open door of house") );
}
};
class Car: public CBase
{
public:
virtual void OpenDoor( )
{
AfxMessageBox(_T("Open door of Car") );
}
};
CBase* pObject = new House;<br />
pObject->OpenDoor( );<br />
|
|
|
|
|
Thanks Koos,
I got wht i ws searching for..
|
|
|
|
|
Below is the steps that i have followed to create a web page viewer and i have a restriction to create it only using Win32 Projects.
Using visual studio .NET 7.0 with framework 1.1
1.File -> New -> Project
2.Choose Visual C++ Projects -> Win32 -> Win32 Project
3.Project Name "Browser"
Now i want to make it a web page viewer and want to take screen shot of the viewed pages and want to save it as 24bit bitmap image.
Thanks,
Soumyadipta De
|
|
|
|
|
These steps are common for other objects except you set a browser name for it
but do you want to show html pages on your dialog?
|
|
|
|
|
Hi All,
I am writing a non MFC Application using Opengl (Win32 Project) but i am using
some MFC Headers below
#include // MFC core and standard components
#include // MFC extensions
#include // MFC Automation classes
#include // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include
#include
////////////////////////////////////////////////////////////////////////
I want to use Web Browser Control On my project (Activex) but i am not
using any form i want create web browser using createWindow function
////////////////////////////////////////////////////////////////////////
It will be really help full if anyone please send me sample code
Thanks,
Soumyadipta De
|
|
|
|
|
In MFC application I've open a file on a click event as follows.
<br />
void CSRFToolDlg::OnBnClickedOpen()<br />
{<br />
char* ReadFileName = "G:\\Work On\\CPP\\SRFTool\\text_file.txt" ;
<br />
if(openFile.Open(ReadFileName, CFile::modeCreate | CFile::modeReadWrite))<br />
{<br />
AfxMessageBox("File creates successfully", MB_OK) ;<br />
}<br />
else<br />
{<br />
AfxMessageBox("Error in file opening", MB_OK) ;<br />
}<br />
}<br />
Then I wrote few text to it as follows, again on a click event.
<br />
void CSRFToolDlg::OnBnClickedWrite()<br />
{ <br />
GetDlgItemText(IDC_S_WRITE, readString) ;<br />
AfxMessageBox("Data write to the file successfully", MB_OK) ;<br />
openFile.Write(readString, readString.GetLength()) ;<br />
}<br />
Here readString is a CString.
Then try to read that file and print it on a text box(edit control). How can I do that. Try to use a buffer, but failed to do it. Like this,
<br />
void CSRFToolDlg::OnBnClickedRead()<br />
{<br />
char tempBuffer[256] ;<br />
UINT readText = 0;<br />
readText = openFile.Read(tempBuffer, strlen(tempBuffer)) ;<br />
<br />
SetDlgItemText(IDC_S_READ, readText) ;<br />
}<br />
Where I'm going wrong.
I appreciate your help all the time...
Eranga
|
|
|
|
|
you didnt specify, what is the output/error you are getting.
and what does openFile.Read() return?
any way,
Eranga Thennakoon wrote: readText = openFile.Read(tempBuffer, strlen(tempBuffer)) ;
instead of strlen(tempBuffer) try giving 256 and see;
---------------------------------------------------------------------
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
chandu004 wrote: you didnt specify, what is the output/error you are getting.
and what does openFile.Read() return?
Sorry about that and I got this error.
'CWnd::SetDlgItemTextA' : cannot convert parameter 2 from 'UINT' to 'LPCTSTR'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
chandu004 wrote: instead of strlen(tempBuffer) try giving 256 and see;
I'll already do it, but the issue is there. I used strlen(tempBuffer) to set the length of string same to the buffer.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: I'll already do it, but the issue is there. I used strlen(tempBuffer) to set the length of string same to the buffer.
i didnt get this can u explain more?
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
Ok,
As you said I've replace the strlen(tempBuffer) part with 256. It avoid a warning conversion from 'size_t' to 'UINT', possible loss of data
Initially I've create a buffer of size 256. I want to put my string there and use it. I think it is clear.....
To read the file I used openFile.Read() with two arguments, the buffer and length what I want to read. If I use 256 it read all the buffer, more than my string. If the buffer is not empty it can read something else. Is it clear.
But it not work.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: To read the file I used openFile.Read() with two arguments, the buffer and length what I want to read. If I use 256 it read all the buffer, more than my string.
atleast you have got your string here right?
but you are getting extra characters here am i right?
so while writing itself, append the string with \0 at the end and see.
now you will get the packed string without extra characters.
gud luck.
--------------------------------------------------
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|