|
Is there a way to create a Multi-SDI appication with MFC? WTL is supported it. I've made a search at the www.google.com, but haven't managed to find examples or articles. Does this mean that MFC have some internal problems to apply such a technique?
|
|
|
|
|
Could you please explain what Multi-SDI means? Is that MDI?
Best regards,
Alexandru Savescu
|
|
|
|
|
Multi-SDI is not MDI.
It's a group of SDI applications running in the context of single process. So the can share all the internal data and structures and this way save memory and other resources. Good example of a Multi-SDI application is Internet Explorer
|
|
|
|
|
Create an SDI app with MFC App Wizard.
Go to you app init instance and look for this code:
pDocTemplate = new CSingleDocTemplate(<br />
IDR_MAINFRAME,<br />
RUNTIME_CLASS(CMSDIDoc),<br />
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CMSDIView));<br />
AddDocTemplate(pDocTemplate);
Make a copy of that code and paste it right below it. That should be enough to get you started. Your code should now look like this:
<br />
<br />
CSingleDocTemplate* pDocTemplate;<br />
pDocTemplate = new CSingleDocTemplate(<br />
IDR_MAINFRAME,<br />
RUNTIME_CLASS(CMSDIDoc),<br />
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CMSDIView));<br />
AddDocTemplate(pDocTemplate);<br />
<br />
pDocTemplate = new CSingleDocTemplate(<br />
IDR_MAINFRAME,<br />
RUNTIME_CLASS(CMSDIDoc),<br />
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CMSDIView));<br />
AddDocTemplate(pDocTemplate);<br />
<br />
<br />
CCommandLineInfo cmdInfo;<br />
ParseCommandLine(cmdInfo);<br />
<br />
James
Drinking In The Sun
Forgot Password?
|
|
|
|
|
Thank you!
Good trick, but it's still not the stuff which I need. It uses one thread and I can open as many new windows as many times I called AddDocTemplate. And when I close first window the rest of windows close too.
|
|
|
|
|
MFC7 has this as in Office 2000 apps.
|
|
|
|
|
I've generated an ActiveX with Visual C++, it works fine on TestContainer and Visual Basic Forms, but when I put it on a SDI Visual C++ Project in a CFormView it doesn´t work fine.
The buttoms contained in the control ActiveX doesn´t work and it goes to sleep.
Please, Can anybody help me???
Thanks in advance!!!!!
|
|
|
|
|
In the control's OnCreate function, put ModifyStyleEx(WS_EX_CONTROLPARENT);
Try it. It may work.
Best of luck,
Rejeesh.T.S
|
|
|
|
|
<code></code>eg. How do I assign tc1.x = 20; in TestFunction2() ?
class TestClass1
{
public:
int x;
int y;
}
class TestClass2
{
public:
CArray<TestClass1, TestClass1&> arr;
}
void TestClass2::TestFunction1()
{
TestClass1 tc1;
for(int i=0; i<5; i++)
{
tc1.x = 5;
tc1.y = 10;
arr.Add(tc1);
}
}
void TestClass2::TestFunction2()
{
for(int i=0; i<tc1.GetSize(); i++)
{
tc1.x = 20; // does not work !!!
}
}
rsg_dj
|
|
|
|
|
|
GetAt will return a copy of the object, not the object itself.
Use ElementAt or operator[]
Best regards,
Alexandru Savescu
|
|
|
|
|
You can use this:
SetAt(index, element);
Moreover, it's useful to use SetSize(size) for initializes the Array before using it. Frequent re-allocations thus are avoided...
Hello World!!!
from Raphaël
|
|
|
|
|
Well, of course.
Moreover, it's better to use a std::vector don't you think?
Best regards,
Alexandru Savescu
|
|
|
|
|
Really better... ;);)
Hello World!!!
from Raphaël
|
|
|
|
|
I know I'm a broken record in this topic, but assuming your question has already been answered, let me add that CArray is CRAP. You should do yourself a favour and read my STL series of articles, starting with the one on vector. Anyone who uses MFC container classes is using stuff written as a stopgap prior to the release of STL, and is selling themselves way short.
Read the articles and I am sure you will agree. CArray cannot do half of what vector does.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|
I have the following trouble with !STANDARD! Radio Buttons:
I place 2 or more RadioButtons in Resource-Editor, I give the first element the group-flag via the property sheet and add one int variable to the first element. after that in InitDialog I do the following:
m_radioval = 1;
UpdateData(FALSE);
I get the following warning-messages in the output-window:
Warning: skipping non-radio button in group.
can anybody please explain me what happens? can't find anything on the net to that warning-message.
thanks in advance
silver
I don't want achieve immortality through my work - I want achieve it through not dying - Woody Allen
|
|
|
|
|
All your radio buttons that you want grouped together have to be in the proper tab order, and the first control that comes after your group of radio buttons must have it's group flag set.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks a lot - you helped me very much! (and sorry for my trashing english)
I don't want achieve immortality through my work - I want achieve it through not dying - Woody Allen
|
|
|
|
|
silverspoon wrote:
sorry for my trashing english
You didn't trash it. Your written english is excellent. I really admire all you non english speaking people who manage to use english to get their point across on these forums, because I know that if I had to use german ( or any other language) I would fail miserably.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Hello friends,
i have a CView (fullscreen) on the bottom (in x-axis) and i would like to show a modeless CDialog (fullscreen) on the CView. And then i would like to show an another modeless CDialog (quarder-screen) on the CDialog (fullscreen).
I would like to create (and delete) all dialogs in the CView, and the user should operate with all dialogs at the same time.
I have try that, and my problem is this:
I see the fullscreen dialog and the quarderscreen dialog (that is right), but i don't can operate with quarder-screen dialog (that is the problem). That dialog get no mouse-messages, and the buttons (on the quarderscreen dialog) don't move down when i try to click on it.
Here is a code-snipet (that i use to create one of the dialogs):
void CViewPMain::CreatePFkt3Zeile()
{
CRect DlgPFkt3Zeile, View;
if (!m_DlgPFkt3Zeile)
{
GetClientRect(View);
m_DlgPFkt3Zeile = new CDlgPFkt3Zeile;
if (!::IsWindow(m_DlgPFkt3Zeile->GetSafeHwnd()))
m_DlgPFkt3Zeile->Create(IDD_P_FKT_3ZEILE, this);
m_DlgPFkt3Zeile->GetWindowRect(DlgPFkt3Zeile);
ASSERT(m_DlgPFkt3Zeile->SetWindowPos(NULL
, View.Width() - DlgPFkt3Zeile.Width() //int x
, View.Height() - DlgPFkt3Zeile.Height() //int y
, DlgPFkt3Zeile.Width() //int cx
, DlgPFkt3Zeile.Height() //int cy
, SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOZORDER));
m_DlgPFkt3Zeile->ShowWindow(SW_SHOW);
}
else
{
delete m_DlgPFkt3Zeile;
m_DlgPFkt3Zeile = 0;
}
}
At the SetWindowPos-function i have tryed a lot of parameters for the first and the last parameter, but ever i don't can operate with the second dialog.
What make i wrong at the "create" of the dialogs? Or is "multiple dialogs" not aviable? Is there any other solution that i can do?
Thank you very much for your help!
PS: Sorry for my bad english.
|
|
|
|
|
> PS: Sorry for my bad english.
It's very difficult to understand what you are asking here, but I'll try to answer your question.
First you'll have to answer some questions.
1. Are you using splitters? I don't understand what you mean by "i have a CView (fullscreen) on the bottom (in x-axis)". On the bottom of what?
2. When you say you want a Dialog in the view, do you mean you are using a form view or do you want a dialog whose parent is a CView?
3. Can you provide me with a better explanation of what this application looks like and does?
Let's start there. Just answer these questions and maybe I'll be able to understand better.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hello perlmunger,
Thank you very very much that you try to help me!
My answers of your questions:
1. I mean i don't use splitters(but i don't know what splitter is). I have a view (from CView - class), that show a dialog resoucre. With on the bottom i mean, that i create the CView first. "in x-axis" is wrong, i mean in z-axis, sorry.
2. I don't know that the dialog is the right solution (i am new in VC++), i try to explain what i want:
The CView must be the "master", i mean he should create and delete all my dialogs. The dialogs should modeless, without titlebar... and the user should not see/know that the dialogs are not the view(i mean the user should mean that he see only one dialog/view). The view should create some dialogs, that all activate. When the user click a button on a dialog, the dialog should send a user message to the view.
I have try that: the view create a dialog and then he create a second dialog, but i don't can operate with the second dialog (he recieve no messages) but i see the dialog.
3. a little background:
I port a HMI from C and a realtime-OS to win32. This part is the process visualisation. First you see a dialog that the machine is run up. Then you see a a lot of dialogs, what the machine is doing at the moment. Sometimes i show a dialog with function-keys/buttons. The problem is that i don't show only one dialog at the same time.
Do you understand my problem now?
|
|
|
|
|
Are there any STL gurus who can help a newbie? I am trying to pass a vector as an argument to a function. What is the correct way to do this or is it even possible? This is what I've thought of doing(I need the whole vector container in the function).
<br />
<br />
#include "stdafx.h"<br />
<br />
class myclass{<br />
<br />
public:<br />
<br />
myclass(){};<br />
<br />
virtual int myfunction(vector<CString> V1, vector<CString> V2);<br />
<br />
~myclass(){};<br />
<br />
}<br />
<br />
<br />
<br />
<br />
<br />
#include "stdafx.h"<br />
#include "myclass.h"<br />
#include <vector><br />
using std::vector;<br />
<br />
int main(){<br />
<br />
vector<CString> mystring;<br />
vector<CString> myotherstring;<br />
<br />
<br />
myclass classy;<br />
<br />
classy.myfunction(mystring, myotherstring);<br />
<br />
return 0;<br />
<br />
}<br />
<br />
int myclass::myfunction(vector<CString> V1, vector<CString V2){<br />
<br />
<br />
}
I don't want to pass the value of one element of the container, but the whole container as the function parameter. If you can help me, I will consider you an STL Guru of the highest order. Thanks in advance friends!
|
|
|
|
|
Pass by reference:
virtual void myfunction (vector<CString>& v1, vector<CString>& v2)
Thus, you will pass only a reference the containter not the whole container.
Best regards,
Alexandru Savescu
|
|
|
|
|
And even better: If you just want to read the parameters, pass them as const reference:
virtual void myfunction( const vector<CString>& v1, const vector<CString>& v2 )
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|