|
It's 5:30am so I'm headed off to bed in next few. Let me know if this is working for you or if you want me to send you the demo.
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.
|
|
|
|
|
Archer,
Thanx,can u send me the demo, so,it would be helpfull to me.
Thanks very much for ur help.
mohan
|
|
|
|
|
You're very welcome. Demo is on the way.
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.
|
|
|
|
|
Archer,
Very much thanks for the Demo, is that the code same even for if the dialog resource is IDD_FORMVIEW(now what u have done is IDD_DIALOG1).
By the way i've already develped number of of applicatons(15,every application is a single window) in MDI,now i have to integerate all the applicaton into an single MDI application, can u give me a idea.
Hope u understand my question.
THanking you
mohan
|
|
|
|
|
mohanrajh wrote:
Very much thanks for the Demo, is that the code same even for if the dialog resource is IDD_FORMVIEW(now what u have done is IDD_DIALOG1
The resource id doesn't matter as it's abstracted from my code via your CFormView-derived class.
mohanrajh wrote:
By the way i've already develped number of of applicatons(15,every application is a single window) in MDI,now i have to integerate all the applicaton into an single MDI application, can u give me a idea.
Sure. Shouldn't be too hard. I haven't actualy done the following steps, but something like this should be really close to what you need to do.
1) Open the MDI project where everything will end up
2) One by one, open the resource file of each MDI project that has only one view. Copy the needed dialog to the clipboard and then paste it into the main MDI project's resource view.
3) Copy each view's cpp and h file to the main project's folder and add it to the project.
4) If you've kept your code mainly in the view classes, you should be set at this point.
5) Now just follow the original instructions from the point at which you have your formview classes.
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,
Thanks for Ur step by step instruction, will try to do it.
The demo was fine, my project is in progress, is that the same kind of code, to display the window(CFormView) when the 'Button' is pressed,i.e. displaying from one view(window) to another. can i have some tips for this?
Whenever the new child is created in your Demo ,it is not destroyed, so it is addying up to the new window, so when the menu option 'New' is selected it just shows a listbox with several number of option to choose from.
is their any rectification?
Regards,
mohan
|
|
|
|
|
mohanrajh wrote:
Thanks for Ur step by step instruction, will try to do it
You're welcome
mohanrajh wrote:
to display the window(CFormView) when the 'Button' is pressed,i.e. displaying from one view(window) to another. can i have some tips for this
Same code. Just add the handler and inser the call to CreateOrActivateFrame
mohanrajh wrote:
Whenever the new child is created in your Demo ,it is not destroyed
When you call CWinApp::AddDocTemplate, the document pointer is added to the application's CDocManager m_templateList (a CPtrList object). When the CDocManager is destructed it walks this list, deleting all document templates from memory. Therefore, if you attempt to delete the entry without removing it from the list, you'll actually cause a GPF as the CDocManager will exepect it to be there.
mohanrajh wrote:
so it is addying up to the new window, so when the menu option 'New' is selected it just shows a listbox with several number of option to choose from.
is their any rectification?
Sorry. I didn't understand this question.
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,
What is the advantage of CFormView over CDialog Class, I was told by team leader to create windows(Classes) derived from CView or any classes that is derived from CView.
Actual problem is,
In half a way of our project my team leader has left the project, so i've been put in his position to integerate all the applications(window Dialogs derived from CFormView) done by other persons into a single application.
Im finding it difficult, so why not it be CDialog classes, that makes the job easier.
Is their any disadvantage to have CDialog derived GUI classes than CView.
Thanking You
Regards,
Mohan
|
|
|
|
|
I created a regular MFC DLL with a class like:
<br />
class CLASS_DECLSPEC CPacket<br />
{<br />
protected:<br />
static long m_counter;<br />
};<br />
I tried to initialize it below the class declaration as
<br />
long CPacket::m_counter = 1;<br />
but I got the redefinition problem in linking, and when i tried to initialize it in CMyWinApp::InitInstance() with
CPacket::m_counter = 1;
The compiler reported CMyWinApp can't access protected member declared in class CPacket.
How can I initialize it ?
Hiya, Everybody ^^
|
|
|
|
|
Try the following. (Note that the initialization of the static does not occur within a function.)
class __declspec(dllexport) CPacket
{
protected:
static long m_counter;
};
long CPacket::m_counter = 1;
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
By the way, as I mention in my VC++ book (had to get the plug in there), you can also do the following as long as _AFXDLL and _AFXEXT are defined.
class AFX_EXT_CLASS CPacket
{
protected:
static long m_counter;
};
long CPacket::m_counter = 1;
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
I tried before, and tried again, and I checked _AFXDLL is defined. However, it still won't work.
The compiler reported :
CPacketSender.obj : error LNK2005: "protected: static long CPacket::test" (?test@CPacket@@1JA) already defined in CpacketReceiver.obj
Hiya, Everybody ^^
|
|
|
|
|
I'm sending you a quick sample of it working...
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!
Put
long CPacket::m_counter = 1;
into cpp file, not into header.
Mukkie
|
|
|
|
|
You're telling the wrong person I sent him a demo that shows how it works.
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 works ^^
Thanks everybody. The problem I had before was that I just put the initialization below the header file, not the CPP file.
Hiya, Everybody ^^
|
|
|
|
|
Hi Friends
I have CDateTime Control to Get the Time. With the Value member variable m_VTime set the 0 in the Constructor.
Display value is 6:00:00 AM
I have a Button which only contains UpdateData(TRUE) , to get the m_VTime Variable Updated. When I press this when the time is set to less than 6:00:00 AM it gives the following error. (E.g. With in 5.am to 12.am)
Debug Assertion Filed!
Program : xxx/xxx/xx.exe
File : timecore.cpp
Line 40
Why is this coming? Please try this and give me a solution.
Regards
Gaurika
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
|
Dear Mike
This is whats in timecore.cpp in line 40. this file is a MFC File.
CTime::CTime(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec,
int nDST)
{
struct tm atm;
atm.tm_sec = nSec;
atm.tm_min = nMin;
atm.tm_hour = nHour;
ASSERT(nDay >= 1 && nDay <= 31);
atm.tm_mday = nDay;
ASSERT(nMonth >= 1 && nMonth <= 12);
atm.tm_mon = nMonth - 1; // tm_mon is 0 based
ASSERT(nYear >= 1900);
atm.tm_year = nYear - 1900; // tm_year is 1900 based
atm.tm_isdst = nDST;
m_time = mktime(&atm);
Line 40--->ASSERT(m_time != -1); // indicates an illegal input time
}
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
Along with Michael's suggestions always look at the output window when you get an assert. Many times, MFC will output the reason for the assert with a TRACE statement.
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.
|
|
|
|
|
Hey all.
My application (ActiveX Control) requires Rich Edit Control v3. (v2 doesn't right-align correctly from some reason).
I couldn't find a redistributable package on MS site. Can I just pick up the riched20.dll on my computer, along with 2 or 3 DLLs it depends on, and deploy them on the clients' machines (if they don't have a newer DLL)? Or is it somehow dangerous / illegal / etc.?
Thank you!
|
|
|
|
|
I can find no reference to redist of riched32.dll. So, no you can't do it.
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/default.htm?p=/msdownload/platformsdk/sdkupdate/psdkredist.htm
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Check in the Common\Redist\Redist.txt file of your VC6 install. (I can't as I'm running VS.NET). If it's listed in that file, you can redistribute it.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
What about compiling statically?
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|