|
You don't need an article for this if you haven't done anything fishy
Create a new SDI-project with the desired name. Move over the document and view files ( ProjectNameDoc.cppm ProjectNameDoc.h, ProjectNameView.cpp and ProjectNameView.h) from the original project. Voilà!
Then, you'll of course have to copy and add all the other files you've added to the MDI-project, as well as the resources...
|
|
|
|
|
I was rather thinking of creating a new sdi project with the same name, and incorporating the differences into my mdi app, but I was looking for pointers as to what is different, rather than finding out myself.
The reverse process that you are suggesting seems much more tedious, since there's a lot of code and resources to be copied onto the new project.
Have no fear of perfection - You will never reach it
|
|
|
|
|
The document and view are the same for SDIs and MDIs. Actually, the only run-time difference is the view OnInitialUpdate , where SDIs reuse the call (and you can test for the function being run a second time if you, for example, create controls in it).
As for copying classes and resources, how long time can copying the files and inserting them take You can - if you use MSVC++ 6.0 - open the two resource files and drag the contents from one to the other. All in all a few minutes work, I'd say. Far quicker than rewriting the MDI app. If you want that aggravation, however, you'll have to rewrite stuff in both the application class and the main frame, merge the mainframe and the mdi menus into one, remove the child frame, just to mention what pops up as I write - a far more involved process.
Trust me, do as I suggest Even if you have lots of libs and special settings in the project file, it will be far easier.
|
|
|
|
|
Hello,
I'd like to make a sort of image editing application.
I want to show bmp image,
draw free line by GDI brush on the new layer,
and output only this layer to the bmp file.
It is a like photoshop layer function.
How could I get some information for this application.
Please answer this question.
|
|
|
|
|
Paint the bitmap as a background and store the brush strokes as an array of points. When you save, redraw these points to a memdc, extract the bitmap from the memdc and write it. You may want to consult the good old Scribble sample app for details on how to save and draw the points.
onwards and upwards...
|
|
|
|
|
I need to use several classes like:
CString , CRecordset and e.t.c.
What should I do to include them?
|
|
|
|
|
no way.
use other classes that the WinAPI provides
TOXCCT >>> GEII power
|
|
|
|
|
Include MFC support in your project.
Or....
Dont use them.
Simple. Some of the smaller classes you can actually copy and paste into Win32 code and they work with a bit of tweaking. But there is much more to MFC than a bunch of classes that can be used independatly of the framework im affraid... So you either use MFC, or you dont.
The best bet is to forgo MFC ....
For CString - id just use std::string or one of the billion other string classes out there.
For CRecordset - well, personally I'd use ADO anyway but thats just me.
|
|
|
|
|
what is std::string and how to use it?
|
|
|
|
|
hey, do you know MSDN ?
std::string is the C++ standard string template class
have a look at the file STRING (without the .h) in you compiler includes folder to see how it work is you prefer... (if you use visual C++ 6, it could be something like that : C:\Program Files\Microsoft Visual Studio\VC98\Include\STRING[^])
TOXCCT >>> GEII power
|
|
|
|
|
It's part of the standard template library (STL).
STL is sorta like MFC, but unlike MFC it's not a framework and is more geared to data storage/manipulation etc - providing you with things such as map's, linked lists, vectors, dynamic arrays etc. IMHO it's actually better than MFC's version of these classes - far more standard and MFC's versions were only really created as a stop gap when STL was being developed.
Though while map is better than CMap, and list is better than CList (IMHO), std::string isn't quite as good as CString, but its a string class you get free.
To use it:
#include <string>
#include <algorithim>
using namespace std;
void Blah()
{
// contact
string myString = "Hello ";
myString += "word"
// make the string lower case
transform(myString.begin(), myString.end(), myString.begin(), tolower);
etc etc.
}
One word of warning. STL does have quite a learning curve (for the very basic, just learn what an iterator is) and the provided docs (with MSDN) are very poor. Search the web for "STL Documentation" and find youself a better set.
If you can't be biffed to learn STL (its worth it in the end) then just grap a free string class from CP etc - im sure there are 100's.
|
|
|
|
|
|
std:string is a class template for handle strings in STL.
If you only want a string class, I think that is good choice.
to use, simple add
#include <string>
using namespace std;
Also, the best string class outside MFC is CStdString.
http://www.codeproject.com/string/stdstring.asp
Enjoy it.
Rodrigo Pinho Pereira de Souza
|
|
|
|
|
Hi beautiful people,
we are two poor italian students, we have a big trouble with our thesis...
we have to implement an image selection function in our MDI application, and we succeed in drawing the focus rectangle but when mouse moves(to resize the rectangle) all the window is redrawed,because of the command invalidate() in the OnMouseMove function. we wish the application to redraw only the focus rectangle and not the whole background. we tried to use the instruction invalidate(FALSE) but is worst than the other one. please,HELP US!
Thank you so much for answers.
Bye Bye, Cruscoz
|
|
|
|
|
Its more about your OnDraw method. I suspect what you are doing now is redrawing the entire view when OnDraw gets called. What you need to do is find out what area of the CDC passed in is invalid, and only repaint that area.
Look up CDC::GetClipBox which should get you started.
In this case, you would need to call GetClipBox and only repaint what lies within this box.
Also lookup InvalidateRect.
|
|
|
|
|
Drawing a fucus rectangle while the mouse is being moved is one of the very, very few operations where you might draw directly instead of in OnDraw.
Basically, you:
draw and save using the initial mouse position in OnLButtonDown
erase the saved rect, updating it, drawing the ract and save it again in OnMouseMove
erase the saved rectangle in OnLButtonUp
You might want to use DrawFocusRect, which uses XOR as the drawing operation (that is, erases the rectanle if it is already drawn).
|
|
|
|
|
If you are drawing the focus rect using DrawFocusRect, then you would just capture the mouse, and when it moves, call DrawFocusRect with the old coordinates (which will erase the old focus rect) and call it again with the new coordinates to draw the new one. Very fast and no flicker.
onwards and upwards...
|
|
|
|
|
CWnd::Invalidate - This method invalidates the entire client area of CWnd.
Maybe you should only invalidate the rectangle that is the union of where you 'were' and where you 'are', which might be a LOT less than the entire client area of your window.
When you invalidate the entire client area of your window, your OnDraw will get a paint message with the ENTIRE client area of your window in the rcPaint of the PaintStruct. Not good, if you moved a little rectangle down in the lower right corner of your window.
|
|
|
|
|
i have a buetooth sockets project which i program under Visual .NET under Windows XP (bluetooth is supported only fros WinXP SP1 or later).
from the MSDN, i read i have to include the Ws2bth.h and the BluetoothAPIs.h , bt none of them exist on my disk...
i really don't know where it can come from.
does anybody have an idea ?
TOXCCT >>> GEII power
|
|
|
|
|
I would say SERIES 60 SDK 2.1 FOR SYMBIAN OS
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
don't be influenced by my bio.
i am programming on Visual C++ 7 cause the target of my program is Windows...
and you don't answer me. i wrote something i found in the MSDN, so it might exist !
TOXCCT >>> GEII power
|
|
|
|
|
...and more, our project is not fo nokia but for Sony/Ericksson... ;P
TOXCCT >>> GEII power
|
|
|
|
|
So its not windows after all its a symbian OS
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
|
Man dont get angry easy
Try to download the Feb 2003 platform sdk
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|