void CFatture::message(HWND wnd,CString str,int type) { if(type==0){ MessageBox(NULL,str,"Info",MB_OK|MB_ICONINFORMATION); }else{ MessageBox(NULL,str,"Errore",MB_OK|MB_ICONEXCLAMATION); } } and i call this message function with (for example) theApp.message(NULL,e->Message,1); from class off "mydialog"