|
You're code is not working because the window has not been created yet. Always keep in mind that just because you create an instance of an MFC class such as CDialog (or a derived class), the encapsulated window isn't actually there until you tell the class to create it.
With regards to communicating data between these various dialogs, there several ways to achieve this. If you're simply trying to get initialization data to one dialog from another, you can change the constructor to accept this information. Then in the dialog's constructor, you save this information in member variables and finally use it to init the dialog's controls in either the OnInitDialog or DoDataExchange function.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Hi Tom ,
I don't understand what you said when you tell that 'the encapsulated window isn't actually there until you tell the class to create it'. Is this because I create my window inside the main window or what? Would you supply me a small example that will point me in the right direction.
Also, my datas to be communicated aren't only to be passed at initialisation of the dialog, they are to be communicated all the time until I stop the app.
Im newbie in C++ so, there's a lot of thing that confuse me!!
Thanks,
Brind
If coding looks like drugs... I should go on therapy...
|
|
|
|
|
When you instantiate a CDialog, you don't have a window yet. You won't until you specifically tell the class to create its underlying window. In the case of a modal dialog this is done via DoModal. In the case of a modeless dialog, this is done via Create or CreateIndirect. In you situation, you're referring to controls on a dialog that haven't been created because their containing window (the dialog) hasn't been created. Therefore, you'll need to move that code using one of the techniques I described.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
What is this function used for?
No seriously, I have been playing around with CFtpConnection, specifically PutFile, and I have found that i need to specify exacly where the file should be placed on the server. I tried to use SetCurrentDirectory but to no avail. The functions returns success but when I just put the file name in PutFile it transfers it to the root. To me SetCurrentDirectory should let me put just the file name(no path) in PutFile.
So my question is. Am I doing it wrong and SetCurrentDirectory should work the way I want it to, or am I suck with PutFile with the Path\FileName.
Thanks in advance
***********************
Tony Fontenot
Recreational Solutions
tony@recsolutions.com
***********************
|
|
|
|
|
That's definitely strange because I've written a very basic FTP client and it works fine.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
It worked perfectly for me, you tried using GetCurrentDirectory and then set the path relatively with SetCurrentDirectory ? What was the error that GetLastError() reports ?
x = GetLastError();
Better put the variable x on the watch window with the modifier hr like this:
x,hr
what the error says ?
See this on this page for a basic ftp tool using wininet :
Some tips
Cheers,
Joao Vaz
Frustrated TCL programmer,good c++ programmer wannabe
|
|
|
|
|
Got it working thanks all
***********************
Tony Fontenot
Recreational Solutions
tony@recsolutions.com
***********************
|
|
|
|
|
how can i add Explorer's functions ,for example,the list view of the Explorer ,to my program?
i am coming quietly just as i am leaving quietly.
|
|
|
|
|
You have to implement IShellBrowser.
|
|
|
|
|
Hi there,
I made 3 forms(dialogs) in the resource in my project.
How can i change the document's form in my program ?
For example the menu has 3 items:
FORM 1
FORM 2
FORM 3
Now, i want to when i click on each items, program show me the forms ...
So, please tell me how can change forms in the document(formview) ?!!!
Thanks.
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
You need to create a CFormView-derived class via the ClassWizard for each dialog resource that you defined. Then you need to call CFrameWnd::CreateView() for each view. Then use CFrameWnd::SetActiveView() to switch between them.
cheers,
swinefeaster
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Thanks for help
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
In addition to swinefeasters' advice (gotta love a handle like that), check out this thread where I've explained step by step how to do this.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Hello Master. Tom Archer,
Thanks alooot for example, it is my honor that someone like you answer me
With Best Regards.
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
You're very welcome. Let me know if you need any further assistance.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Hi there,
For example i want to put Flex Grid activex in CView ...
How could i do that ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Haven't test it before but I guess you can do it with Create() function of that ActiveX.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Hi, i would like to give my toolbar buttons the IE6 look. Well, is this a style i should set, are they owner draw??? Any idea
Thanks
Gabriel
don´t worry drink happy
|
|
|
|
|
Look through the Buttons classes available on this site. I highly recommend CButtonST. That guy rules.
|
|
|
|
|
Hello!
I'm trying to record a metafile under Gdi+ somehow into MEMORY, but all the constructors for Gdiplus::Metafile require a filename!
There is however one constructor which allows the metafile to be recorded into an IStream interface. I was thinking that perhaps such an object could be written that would stream the data into a memory buffer via an IStream interface.
<br />
Metafile::Metafile(IStream* stream, HDC referenceHdc, Rect& frameRect, MetafileFrameUnit frameUnit, EmfType type, WCHAR* description)<br />
<br />
Creates a Metafile object for recording to an IStream interface.<br />
Does anyone know how this is possible? Perhaps some atl / com code? I need this for a Visual C++ 6.0 Mfc app.
Thanx a bunch! I really appreciate your help .
Cheers,
swinefeaster
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Does anybody know how can i get the menuitem information and then draw it into a CWnd, of course this using a Crect to draw the menuitem, this is all that i need to make my own fakemenu, pls help.
|
|
|
|
|
I am creating a template class, with different functionalities. Some of them can work only with numeric types(short, float, double). But the user can still instantiate objects using non-numeric types such as "char" (To use the functionalities which need not require numeric types). I want to know how I can tell the user in run-time that certain operations are not applicable to a particular data type.
How do I check the data type instantiated in the object and let the user know that what he is trying to do is not possible?
I will be very grateful for suggestions?
(This is a simple C++ class and I am not using MFC)
|
|
|
|
|
I use the templatized MFC collections myself. However, one place to begin would be the beginner-level STL tutorials. I think those will help you get started with templates.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Tom Archer wrote:
I use the templatized MFC collections myself.
Really ? Why ? Don't you ever require things like sorting ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Try this:
#include <iostreamᡊe9ac73-238b-46be-991d-0f050c37248d#include <typeinfoᡊe9ac73-238b-46be-991d-0f050c37248d#include <stringᡊe9ac73-238b-46be-991d-0f050c37248d
using namespace std;
<br>
template<class Tᡊe9ac73-238b-46be-991d-0f050c37248dclass MyClass
{
T _data;
enum _DataType {
enShort,
enInt,
enFloat,
enDouble,
enOther
};
_DataType _Type;
bool _TypeAllow() {
return _Type != enOther;
}
public:
MyClass(T val)
{
string sType = typeid(val).name();
if(sType == "short")
_Type = enShort;
else if(sType == "int")
_Type = enInt;
else if(sType == "float")
_Type = enFloat;
else if(sType == "double")
_Type = enDouble;
else
_Type = enOther;
_data = val;
}
void Function() throw() {
if(!_TypeAllow())
throw (typeid(_data).name() + ((string)" not allowed!"));
cout << "Processing...\n";
}
};
void main()
{
MyClass<string> obj("");
MyClass<int> nobj(3);
try {
nobj.Function();
obj.Function();
}
catch(string& sMsg)
{
cout << sMsg.c_str() << endl;
}
}
Maxwell Chen
|
|
|
|