002
24.07.2003, 14:28 Uhr
~Fuat
Gast
|
ok. mein problen ist das.
Create a project, either manually or using the AppWizard. Derive classes, as needed, from the ToolKit classes. The MIDI input, MIDI output, and sync device classes include virtual functions, so derived classes are needed if these functions are redefined. Add all the necessary files to the project, including the MxMidi32.lib import library file and any ToolKit class implementations of classes that are used. Define conditionals for each of the ToolKit classes that the program uses. Use the ToolKit classes to implement MIDI support in the program. It is amazingly easy to create the application skeleton using AppWizard. It creates all of the basic files and classes that are needed to build a working MFC application. Granted, the resulting program is shockingly dull, since it doesn't do anything useful, but it gets the ball rolling. Let's create one of these dull-as-rock programs and take a look at the organization of the code that the AppWizard generates. Once we understand the "free" boilerplate code, we can start adding MIDI support to make the program do something useful.
The Application Framework All of the C++ examples in this book will begin life in the same way. In each case, we'll use the AppWizard to create the simplest possible program framework. For our first example, let's walk through all of the steps to create a proto-app. This is the only time we will do this; in every other example only the changes will be shown. All of the files for this project and all of the other examples in the book are included on the accompanying disk.
To build this first program, create a new project workspace by selecting New... from the Developer Studio's File menu. Highlight Project Workspace in the dialog box and click OK. In the next dialog, choose MFC AppWizard (exe) as the project type and give it a name. For this example, call it Ch10Ex1. Click OK to create the project and start the AppWizard.
Page 137
Choose the simplest possible options for the program in each of the six steps of the AppWizard. No Toolbars, no printing, no Status Bar. Databases, MAPI, OLE, ActiveX controls and sockets need not apply, either. Of course, you are free to use any or all of these features in your own programs, but for the purposes of these examples, simplicity is best. Following the Prime Directive, select Single Document for the application type and choose the appropriate resource language in AppWizard's Step 1 dialog. (English is the default setting.) Click Next to move to Step 2. There, select None for the database support and click Next. In Step 3, select None for OLE container support, clear the ActiveX controls checkbox, and click Next again. Step 4 lists features and support options. Deselect everything except 3D Controls, which will provide that nifty chiseled look. Click Next to move to the next step.
In Step 5, select "No, thank you" to eliminate the source file comments, and choose Shared DLL for the MFC library. AppWizard will add useful TODO comments to the source code if source file comments are selected. These comments can serve to remind you of things to add to the framework. However, for readability, these comments do not appear in the example projects supplied on the accompanying diskette.
The example programs link to the MFC library in its DLL form--instead of as a static library--to reduce the size of the executable. This requires that the proper version of the MFC DLL be installed on the system. Since there is a different version of this DLL for each version of the Microsoft compiler, you may wish to reduce the chance of confusion by linking to the MFC library statically. However, this will greatly increase the size of the executable. After making appropriate selections, click Next to move to the final step.
Step 6 shows the names of the classes and files that AppWizard will create and allows the base class name to be changed. Normally, the default names are readable enough. Click Finish, then click OK to make AppWizard create the files and open the new project.
Build the project to be sure everything came out correctly. For real excitement, run the resulting executable. Wow.
The AppWizard creates more than 15 files, but the most interesting ones are the four C++ source files. These files (Ch10Ex1.cpp, MainFrm.cpp, Ch10Ex1Doc.cpp, and Ich gehe so vor
1. ich erstelle ein neues Dialog projekt.
2. Dann register Dateien und klicke mit der rechten maus taste QuellcodeDateien. dann Dateien zum projekt hinzufügen. (MIDI input, MIDI output, and sync device ) die .cpp
3. nachdem das geschehen ist füge die .h dateien
4. dann füge ich noch die MxMidi32.lib genau so wie oben .wenn ich es compielire dann erhalte ich 281Fehler.
Was Mache ich Falsch ?
--------------------Konfiguration: Fuat seq - Win32 Debug-------------------- Kompilierung läuft... CMidiOutDeviceMenu.cpp CMaximum MIDI\MFC Classes\CMidiOutDeviceMenu.cpp(12) : error C2653: 'CMidiOutDeviceMenu' : Keine Klasse oder Namespace CMaximum MIDI\MFC Classes\CMidiOutDeviceMenu.cpp(14) : error C2065: 'Create' : nichtdeklarierter Bezeichner CMaximum MIDI\MFC Classes\CMidiOutDeviceMenu.cpp(15) : warning C4508: 'CMidiOutDeviceMenu' : Funktion sollte einen Wert zurueckgeben; Ergebnistyp 'void' angenommen CMaximum MIDI\MFC Classes\CMidiOutDeviceMenu.cpp(20) : error C2653: 'CMidiOutDeviceMenu' : Keine Klasse oder Namespace CMaximum MIDI\MFC Classes\CMidiOutDeviceMenu.cpp(21) : error C2373: 'Create' : Neudefinition; unterschiedliche Modifizierer CMaximum MIDI\MFC Classes\CMidiOutDeviceMenu.cpp(26) : error C2065: 'hPopupMenu' : nichtdeklarierter Bezeichner CMaximum MIDI\MFC Classes\CMidiOutDeviceMenu.cpp(26) : error C2440: '=' : 'struct HMENU__ *' kann nicht in 'int' konvertiert werden |