|
-
May 20th, 1999, 05:56 AM
#1
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 !!
-
May 20th, 1999, 06:14 AM
#2
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()
-
May 20th, 1999, 06:35 AM
#3
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
-
May 20th, 1999, 06:42 AM
#4
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);
-
May 20th, 1999, 07:24 AM
#5
Re: please please Give me ur suggestion regarding a global function declaration
Wow , it is working fine ,thanx a lot
Asha
-
May 20th, 1999, 08:46 AM
#6
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|