|
I added classes for the second doc and view and added the template. Wouldnt compile. I compared it with a successful example with uses CViews , not CFormViews. My CFOrmView view code differed from the CView code,: the constructor wasnt argumentless and was public, and there was no dyncraete staement. SO I moved the declaration of my cosntructor to protected and added the dyncreate statement, but still wont compile. What am I doing wrong or not doing?
Thank you!
|
|
|
|
|
ns wrote:
but still wont compile
what are the error messages???
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
Thanks so much for the interest. I used class wizard to make my view and doc files (the second doc)
The example with CView that works has:
from .h
protected:
CMDIBillView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CMDIBillView)
and from .cpp
IMPLEMENT_DYNCREATE(CMDIBillView, CView)
CMDIBillView::CMDIBillView()
{
}
I just noticed that:
The implement line was missing in my view code (CFOrmView based)
so I added
IMPLEMENT_DYNCREATE(CMDIKVView, CFormView)
plus the other changes noted below. Now only 1 error:
C:\Trainer\mditalk\MDIKVView.cpp(16) : error C2512: 'CMDIKVView' : no appropriate default constructor available
My second view class has the following relevant code (I moved the constructor to protected and added dyncreate - it didnt show up by default as is does in a CView based example I made)
From the .h file:
protected:
CMDIKVView(CWnd* pParent /*=NULL*/); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CMDIKVView)
From the cpp file:
CMDIKVView::CMDIKVView(CWnd* pParent /*=NULL*/)
: CDialog(CMDIKVView::IDD, pParent)
{
//{{AFX_DATA_INIT(CMDIKVView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
The example with CView that works has:
from .h
protected:
CMDIBillView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CMDIBillView)
and from .cpp
IMPLEMENT_DYNCREATE(CMDIBillView, CView)
CMDIBillView::CMDIBillView()
{
}
I just noticed that:
The implement line was missing in my view code (CFOrmView based)
so I added
IMPLEMENT_DYNCREATE(CMDIKVView, CFormView)
plus the other changes noted below. Now only 1 error:
C:\Trainer\mditalk\MDIKVView.cpp(16) : error C2512: 'CMDIKVView' : no appropriate default constructor available
|
|
|
|
|
Well,
It turns out that my second document I accidentally derived from CDIalog, whereas I wanted CFormView. So things are okay regarding my troubles with that. Which brings me to the question: Does one not make a view derived from CDialog in MDI?
|
|
|
|
|
ns wrote:
Does one not make a view derived from CDialog in MDI?
no. one does not use CFormView instead.
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
Hello,
This is in regards to MDI architecture.
I have a CString that gets set to (lpszPathName) on the OpenDocument function inside the Doc class.
I want to access this string in the View class, and I don't know how to access it.
I tried this.
(in Doc Class)
m_String = lpszPathName;
AfxMessageBox(m_String);
This MessageBox display the Pathname as I wanted.
(in View class)
CMyView NewView;
AfxMessageBox( NewView.m_String );
This MessageBox displays a blank box. Obviously, the string isn't passing as I thought it would.
Does anyone know how I could do this?
Thanks a whole lot.
|
|
|
|
|
You have to get a pointer to the view's associated document first.
CMyDoc* pDoc = (CMyDoc*)GetDocument();
if (pDoc)
{
AfxMessageBox((LPCTSTR)pDoc->m_String);
}
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Perhaps i wasnt clear: I want to send info from view2 of doc2 to doc1 which will update view1 (how is mysterious yet).
I'm going to try the postmessage and see if I can populate a variable in view1 with info from view2.
However I'm still unable to even create a cFORMView project with 2 documents!!!! I posted about this just now.
I appreciate your responses.
|
|
|
|
|
HEY!!!!!!!!
That was awesome! That reply came so quick! And it hella worked.
Thank you, Outlaw Programmer. You da man!
-<>-
|
|
|
|
|
If this is confusing, please just read my summary. Thats what my ultimate goal is:
I am trying to communicate information received in a View (which is associated with doc1) to Doc2 so it can update View2.
First question is that if I put a button on my view and in the click event try to set the doc2 public variable directly (like Doc2::var = abc), it says that its illegal to access a data member from a static variable.
So I put a setvariable() function in doc1, and tried to create an object of type doc1 in view2 to set the variable (which I dont think is going to do what I want because of the way the document is created from the template). Anyways turns out that doc1() constructor is protected in order to use the dyn_create stuff.
I suppose making the classes friends might allow me access, but the view (view1) I eventually want to use to display info from view2, is created from a template so it wont be communicated to by the simple doc1 object that I am trying to make.
Summary:
I call a dll in view2, and want to give the info received in view2, to be seen in view1. THis I realize has to be done via doc1, but I am not able to figure out how to transmit this info to doc1.
Additional question: In response to a button click on view2, if I can successfully change the value of a variable in doc1, how do I updateallviews()? I dont want to click a ,menu item in doc1 to update all views. rather I want it done automatically as soon as the variable value changes.
|
|
|
|
|
Why don't you post a user-defined message to view2 from view1, and let view1 set the variable according to an lparam value passed with the call to PostMessage?
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Hi,
The aspi scsi based software cannot find my CDRW/DVDR ROM,
such as CDex, Audacity, Xtractor and EAC...
I have a test by using ASPI Rip justly, the log file report an error
about my cdrom is "Wrong Drive Count".
What it mean? and how get a correct drive count for the cdrom?
Thanks in advance!
chen
chen
|
|
|
|
|
Drop the ASPI (that is inherently unsupported by MS) and go for SPTI or at least an ASPI<->SPTI conversion layer such as akrip (at least I think they still provide it).
The error you mention is completely useless without further info.
++luck;
|
|
|
|
|
Hi,
I have installed VStudio 7.0 on my computer, then I wanted to install DirectX 8.1 SDK in my machine but..., it seems that VStudio 7.0 doesn´t accept or import the wizards from Dx 8.1, what can I do ? Is there anyway to import them ?
Thanks, greetings
Braulio
|
|
|
|
|
I don't know this for sure (just a guess), so bear with me. But, the wizards in the DX SDK work with VC6, and I think even with 8.1 they still only work with VC6. I still haven't tried to use DX and VC7 together, so I don't know for sure.
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"Half the reason people switch away from VB is to find out what actually
goes on.. and then like me they find out that they weren't quite as good
as they thought - they've been nannied." - Alex, 13 June 2002
|
|
|
|
|
Does anybody know how to get extended information about a process under NT4/2000?
I have the ProcessID, therefore I can get a handle etc. but I need to know if the process is still
active(i.e. GetExitCodeProcess(hProcess, &dwExitCode)) does not help, if dwExitCode == STILL_ACTIVE the process could still be hung.
Thanks
|
|
|
|
|
enumerate the thread's windows (EnumThreadWindows) and try
sending message with a timeout (SendMessageTimeout) to see
if there is responsiveness.
|
|
|
|
|
Use this
DWORD dwResult;
BOOL bResponding = SendMessageTimeout(hwndInQuestion,
WM_NULL,
0,
0,
SMTO_ABORTIFHUNG,
5000,
&dwResult);
bResponding is TRUE if the process is responding and processing messages. This is precisely the way Task Manager works.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Wow, thanks, that´s what I call a speedy response, thanks again !
|
|
|
|
|
is it possible to let the user select text that was generated by drawtext in a rect??
if yes, how??
with kind regards
barry pappot
|
|
|
|
|
no. when text is rendered it is simply pixels on a DC - it's not a character any more.
you will have to do all of it by-hand : (where is the character? is the mouse moving over it? yes, draw the character reversed, etc.). like this - an edit control implemented from scratch.
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
Yes, but you have to do it manually. Nothing automatic exists in MFC or the Windows API that allows you to do it.
I wrote an article that and posted it here that almost does what I think you want to do, but you'll probably have to modify the code so that you get the desired visual effect.
Here's a link to that article.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Hi,
I have some problems with my apps memory usage. They use a lot of memory.
How can I make my app to use less memory?
Does it matter if I use semantic
{
CMyClass c;
:
}
or
{
CMyClass *c;
c = new CMyClass();
:
delete c;
}
Do Windows use some kind of garbage collection? Then my app has been running for a while the memory usage is lesser. Why?
Grateful for all help I can get.
/Ola Carlsson, Sweden
|
|
|
|
|
The amount of memory required by a CMyClass object is the same, regardless of whether it's used on the stack or the heap.
Garbage collection in VC++ is non-existant. If you use the heap, use it wisely. If I have a given object new'd/deleted many times, I will usually redesign the app so that the class is defined as a global variable and new'd in InitInstance, and deleted in the app destructor. Of course, this assumes that you don't need more than a single instance of the class object.
Each app's requirements are different.
Last item of note - I'm not sure if there's a limit on the size of the stack in a 32-bit program. In 16-bit days, it was 64k, so you had to be very careful of what data you put there.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|