CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13

Threaded View

  1. #1
    Join Date
    Dec 2011
    Location
    Bucharest, Romania
    Posts
    29

    Lightbulb classes in visualstudio

    Hi,
    I`m using msvcc6 and start writing a program that relates to dx-audio. Msdn says to make use of error codes such as display windows for translating the error codes into error messages so I setup a (class) cError method w public members:

    file:cpterr.cpp
    [code]
    [size=-2][center]
    ====================================================================
    Code:
    #include"cpterr.h";
    #include <windows.h>;
    void crep::mb(CHAR* msg, CHAR* ttl){
    PSTR temp;
    	MessageBoxA(0, msg, ttl, MB_OK);
    	if (lstrcmpi(ttl, __TEXT("exit")))
    	MessageBoxA(0, "please shut down", ttl, MB_OK);
    }
    
    DWORD crep::getrr(DWORD ol,LPSTR nume2){
    	CHAR ctemp[127]="\0";
    	if (ol!=0l) {
    		mciGetErrorString(ol, ctemp,sizeof(ctemp));
    		wsprintfA(ctemp,"return err#:&#37;d;\napi mesage:%s;\ninterpret %s",ol,ctemp,nume2);
    	MessageBoxA(0, ctemp, "line12-getrr", MB_ICONQUESTION);
    	};
    	return (ol);
    }
    
    void *crep::operator new( size_t stAllocateBlock, char chInit ){
        void *pvTemp = malloc( stAllocateBlock );
        if( pvTemp != 0 )
            memset( pvTemp, chInit, stAllocateBlock );
        return pvTemp;
    }[\code]
    ====================================================================
    [\center][\size]

    ,prototypes in:"cpterr.hhh"
    [size=-2][center]====================================================================
    Code:
    //#include"cpterr.cpp"
    typedef public class creptag{
    public:
    	void *operator new( size_t stAllocateBlock, char chInit );
    	crep(void);
    	~crep();
    	DWORD getrr(DWORD ol,LPSTR nume2);//explicitare erori mci?////prototip elem. nou adaugat
    	void mb(CHAR* msg, CHAR* ttl);	//message box
    
    private:
    	int classe;
    } CREP;
    ====================================================================
    [\center][\size]-twas declaration-matrix


    [size=-2][center]
    =================================================================
    Code:
    "main.cpp"
    #include "cpterr.h"				//classs w fatale__class
    #include "ext4.cpp"				//global vars
    #include "ext3.cpp"				//dx7 procs
    ;
    =================================================================
    [\center][\size]


    By now I have acces build use a cerro variable in another file:
    [size=-10][center]
    =================================================================
    Code:
    "ext3.cpp"
    // Global Variables:
    //fw declaration of procss:
    //ATOM
    //...
    //file accessing whit err
    BOOL StartWrite(TCHAR* /*pszFileName*/);//write chunk
    BOOL StopWrite(void);				//!!
    HRESULT WaveOpenFile(LPSTR /*strFileName*/, HMMIO /*phmmioOut*/,//!=0!
    				 WAVEFORMATEX* /*pwfxDest*/,
    				 MMCKINFO* /*pckOut*/,
    				 MMCKINFO* /*pckOutRIFF*/);	
    BOOL WaveStartDataWrite(HMMIO /*phmmioOut*/,
    			MMCKINFO* /*pckOut*/,//initializes one datachunkfor fileflush
    			MMIOINFO /*pmmioinfoOut*/ );
    HRESULT WaveWriteFile( HMMIO hmmioOut, UINT cbWrite, BYTE* pbSrc,
                           MMCKINFO* pckOut, UINT* cbActualWrite, 
                           MMIOINFO* pmmioinfoOut );
    HRESULT WaveCloseWriteFile( HMMIO* hmmioOut,  MMCKINFO* pckOut, MMCKINFO *pckOutRIFF,   
                                MMIOINFO *pmmioinfoOut, 
                                DWORD dwSamples );
    BOOL StreamToFile(void);	//copiaza bloc din buffer2 in fisier
    
    [size=-2]//#globale-vars
    CREP cerro;		//typedef for error variable
    //scope of main
    main(void){
    //....
    cerro.mb("mesage for autostart record","title");
    //....
    }
    =================================================================
    [\center][\size]

    [size=-2][center]
    ====================================================================
    Code:
    "main.cpp"
    #include "cpterr.h"			//define errorclass
    #include "ext3.h"				//defs  around-scop1
    #include "ext4.h"				//defs  another scope
    ;/eof
    ;====================================================================
    [\center][\size]

    But after it reports any kind of error and can`t instanciate cerro, starting w/

    [i]*<right side of .'mb' must be struct/class/union>
    *<'CREP ': missing storage class>...
    *<main.cpp(5)><unespected eof>[\i]


    Whole program use only 'the error reporting' class and spans over 3 files so far and class CREP is w/ no function container other than it shows. How to declare a CREP class for cerro-variable and make use its member *.mb like across var funct. Is a declaration
    CREP cerro; legal? How to use 'cerro globally?'

    =========================================================
    red tomato and patatoes for your kitchen @1pound
    Last edited by john wiley; December 30th, 2011 at 03:53 PM. Reason: i made this, ite

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured