please please Give me ur suggestion regarding a global function declaration
Hai ,
I have created an MFC appwizard.exe project , it has all collection of files
my problem i need to call a single function from any where in all the programs , like from viewfile , doc file or all the related files to this project , i need to call a function writetodisk(), WHERE WILL I DECLARE AND DEFINE THIS FUNCTION
I KNOW I HAVE TO DEFINE GLOBALLY BUT WHERE I DON'T KNOW
please help me !!
Re: please please Give me ur suggestion regarding a global function declaration
you can put as a static method of your application.
CMyApp.h
=============================
class CMyApp : public CWinApp
{
............
public :
static void writetodisk();
}
CMyApp.cpp
========================
void CMyApp::writetodisk()
{
......
}
now you can use anywhere :
to call it : CMyApp::writetodisk()
Re: please please Give me ur suggestion regarding a global function declaration
Thanx a lot , but inside static function i can use only static variables is it?
but my writedisk(cstring,cstring,int) takes 3 input parameter and sending one output parameter like cstring writedisk(cstring,csring,int)
what will i do in this case
sorry i could have mentioned that this function takes 3 parameter
Re: please please Give me ur suggestion regarding a global function declaration
you can put the method no static, but still plublic.
and a anyttime you can call like :
CString sResult = ((CMyApp*)AfxGetApp())->writedisk ("string1", "string2" 1);
Re: please please Give me ur suggestion regarding a global function declaration
Wow , it is working fine ,thanx a lot
Asha
Re: please please Give me ur suggestion regarding a global function declaration
Consider to make a class that handles your file. In that class you can make a method WriteToDisk.