|
swaapu says:can extern be used for passing value of any string variable from one class to another?
No it is not possiable using extern.
extern is for different purpose.
if you want to declare later and but if you want to use before itself then use key word extern.
Nice talking to you.
|
|
|
|
|
Hello,
The extern keyword is used to say to the compiler that you are using a variable declared in another translation unit. See the following for example:
You have one translation unit where you define your variable
int g_nSomeInt = 0;
And another one where you want to use the variable
extern int g_nSomeInt;
void DoFoo()
{
g_nSomeInt++;
}
This is how extern can be used. It is adviced though too use accessor functions instead of the extern keyword.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
The extern keyword simply states that the variable or function is declared in a seperate translational unit. That is it is declared and defined in a seperate file from the one that depends on it.
Declaring a function prototype as external, only serves to inform the coder that it is declared and defined in another file.
Defining a variable as external, informs the complire that it is declared and defined golobaly in another file. The difference between a function protype and a global variable, is that a global variable must be declared external and a prototype is external by default.
I've workd with C code that required alot on global variables (dealing with hardware specific addresses). In that case a file was set off to the side to define all the hardware specific data (global variables), which needed to be declared as extern.
INTP
Every thing is relative...
|
|
|
|
|
Hi
Urgent plz. Help me in how to use ADO to store and retrieve image data from Oracle using VC++.
Thanks in Advance
|
|
|
|
|
|
Hi
How to use CByteArray to store images into PostgreSQL database from VC++.
Help me.
Thanks
|
|
|
|
|
Hello,
does anybody here know a good C++/C Implementation of the GNFS(General Number Field Sieve) or the SNFS (Special Number Field Sieve) Algorithm ?
With best regards,
Benedikt
|
|
|
|
|
Hi!!
I am working on an SDI MFC application. I have two dialog boxes. I want to pass some File name from one dialog box to another on clicking OK command button. The file name has to be displayed on the text box of second dialog, when the second dialog appears on the screen .
Can any body tell me , how to declare variables and wat functions to use. I am new to MFC.
Thanx
|
|
|
|
|
there are two methods
(1)use CWnd::SendMessage( UINT message,
WPARAM wParam = 0,
LPARAM lParam = 0
);
(2)you can add a variable in the CMainFrm. pass the File name of the first Dialog to the variable.then the second
Dialog access it.
libo
|
|
|
|
|
Hi!
Thanx for giving responses to my problem.
You had told me:
"add a variable in the CMainFrm. pass the File name of the first Dialog to the variable.then the second
Dialog access it."
But, please tell me , that ,"how to pass the file name of the first dialog to the variable..."
Can u tell me some code as I am new to mfc programming
Thanx a lot for ur valuable time
|
|
|
|
|
You have probably two classes derived from CDialog for your dialogs. Let them be (it's just an example) CYourDlg1 and CYourDlg2.
I guess you are using them like that (supossing they are modal):
CYourDlg1 dlg1;
.
.
dlg1.DoModal()
and
CYourDlg2 dlg2;
.
.
dlg2.DoModal()
respectively.
Now, let's say you want to pass some CString data (containing a fully qualified name of some file), which you get from dlg1, to dlg2.
You must add some data member to each of those two classes: CString m_strFile .
In the OnOK() function of CYourDlg1 you add the line:
m_strFile = ... with the dots replaced by something you are using there ( ).
Before calling dlg2.DoModal() , you initialize the data of dlg2 with data from dlg1:
dlg2.m_strFile = dlg1.m_strFile
SkyWalker
-- modified at 3:13 Sunday 9th October, 2005
|
|
|
|
|
Hi All
I am writing one simple application atht will read unicode data from one file. For this i change project setting to _UNICODE. but it gives me error.
So tried solution given in MSDN : THe lines are as given below
Note The Unicode versions of the MFC libraries are not copied to your hard disk unless you select them during a Custom installation. They are not copied during other types of installation. If you attempt to build or run an MFC Unicode application without the MFC Unicode files, you may get errors.
To copy the files to your hard disk, rerun Setup and click Add/Remove Features. Click Language Tools, click Visual C++, and click Visual C++ Class & Template Libraries, and select both ATL MFC Shared Libraries Unicode and ATL MFC Static Libraries Unicode.
but when i run setup(or rerun setup) i doesnot get Add/Remove Features
option anywhere during installation.
CAn ny body help me what to do.
I am installing Micrisoft Visual C++ 6.0
Thanks in advance
Regards
Amit
|
|
|
|
|
which OS version U have???
Bye the way tell what exact error it gives..
bye
Supriya Tonape
-- modified at 4:37 Saturday 8th October, 2005
|
|
|
|
|
i have windowsXP. when try to bulid it gives error MFC42UD.Lib not found.& when i set its path , it gives eroor mfc42UD.dll not found.
thanks for responce
Waiting
Regards
Amit Patil
|
|
|
|
|
Have U installed Platform SDK ???
also if possible show Ur code snippet.
Supriya Tonape
|
|
|
|
|
Wht do u mean by Platform SDK, can u plz explore it?
Code snippet is
// Byte-order mark goes at the begining of the UNICODE file
_TCHAR bom = (_TCHAR)0xFEFF;
CFile* pFile = new CFile();
pFile->Open( strFile, CFile::modeCreate | CFile::modeWrite );
pFile->Write( &bom, sizeof(_TCHAR) );
pFile->Write( LPCTSTR(strText), strText.GetLength()*sizeof(_TCHAR) );
pFile->Close();
Actually i am trying stdiofileEX ex given under heading
Easy text document conversion - ANSI/Unicode and Unicode/ANSI
By darkoman
Waiting
Regards
Amit Patil
|
|
|
|
|
TRy doing this,
GOto to Ur project properties -> General -> USe of MFC -> Here select the option as "Use MFC in a Shared DLL".
let me know if it works
Supriya
|
|
|
|
|
Sorry it does not works it gives following error
"Failed to satrt project. MFC42UD.dll not found.Reinstalling the application can solve the problem"
Let me know wht it means .
May i forward u the .zip of project
Regards
Amit Patil
|
|
|
|
|
Search for this file in Ur PC "MFC42UD.dll" n let me know soon
if its not there then,
"http://www.microsoft.com/msdownload/platformsdk/sdkupdate/"
Go to the above link, you will be automatically redirected to the download page or click on the 'Click here' link.
On the redirected page there is a link for
PSDK-x86.exe
Click on the link and install the SDK. It takes some time for install.
I m too busy n cant look into Ur prob neatly.still U can send me Ur proj.
I might see once I m finished up with my work.
BYe
Supriya Tonape
|
|
|
|
|
Ok i will try it.
Thanks 4 u kind attention.
i am forwarding .zip 4 ur suggetions.
Let me know that if it will run on ur system.
Plz reply when ur free.
Thanks again
Bye
Amit Patil.
|
|
|
|
|
Supriya Tonape wrote:
Have U installed Platform SDK ???
As fas as I know, MFC libraries are not part of the Platform SDK...
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Supriya Tonape wrote:
which OS version U have???
Err... I know you are well intentioned, but this is about Visual C++ installation of MFC libraries; it has nothing to do with the OS...
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Amit j Patil wrote:
but when i run setup(or rerun setup) i doesnot get Add/Remove Features
What do you see in the first screen? Do you see options for 'Typical' and 'Custom' installations?
Try going through the Control Panel - Add or Remove Programs, locating your Visual Studio installation there and invoking the setup from there.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
while installing the VS you need to choose to install unicode libs so that you can develop unicode supported application.
-prakash
|
|
|
|
|
but how to select to install unicode libraries?
|
|
|
|