|
The Simplest way to do so is to open the file again and then write your new data. Actually, I always did so in the following way...;P
SOMETYPE SomeFunction()
{
CFile l_File; // local CFile object
l_File.Open( "C:\\FileName.txt",
CFile::modeCreate | CFile::modeReadWrite );
// using the open flags CFile::modeCreate OR CFile::modeReadWrite
// wrting your file by calling CFile::Write()
...
}
|
|
|
|
|
Sir...
my existing create code is following..
void ARMManagementRecords::SaveDomains()
{
// For domains
BOOL bCanSave = FALSE;
UINT nFlags = CFile::typeBinary | CFile::modeWrite;
// file doesn't exist, so create it
if (_access(DATA_FILE_DOMAIN, 0))
{
nFlags |= CFile::modeCreate;
bCanSave = TRUE;
}
else
{
bCanSave = CanSerializeDomain();
}
if (bCanSave)
{
CFile file;
CFileException fe;
// file exists with read & write permissions
if (file.Open(DATA_FILE_DOMAIN, nFlags, &fe))
{
CArchive arDomain(&file, CArchive::store);
//CStringArray m_domainArray;
m_domainArray.Serialize(arDomain);
}
file.Close();
}
}
|
|
|
|
|
|
does anybody have an idea why c++ would not allow the following:
const char * * cp = NULL;
char * * p = NULL;
cp = p;
i'm getting really disappointed by the language... only intelligent ideas, please!
|
|
|
|
|
because if this would be allowed, you'll be able to modify the const objects.
See:
<br />
const char p1 = 'a';
char* p2;<br />
const char** p3 = &p2;
*p3 = &p1;
*p2 = 'b';
Normally C++ standard allows you to cast from char* to const char* as it only adds the const . But the conversion from char** to const char** is problematic as you can see above.
[example taken from compl.lang.c++]
|
|
|
|
|
|
//this is tree view class
//CLeftTreeCtrl class
void CLeftTreeCtrl::EditCategory()
{
CAddDlg dlg; //call dialog
dlg.GetDlgItem(IDC_COM1)->EnableWindow(FALSE);
}
when i run my mdi application,it have no error.
but i call dialog, my application is not work.
i don't know.what happen??
|
|
|
|
|
You need to call dlg.DoModal in order to make your dialog appear on the screen. But as DoModal doesn't return until the user close it, you'll need to call GetDlgItem(IDC_COM1)->EnableWindow(FALSE); in the OnInitDialog from your dialog.
Hope this helps...
|
|
|
|
|
-sometime EnableWindow is (FALSE)
-sometime EnableWindow is (TRUE)
how to control this??
OnInitDialog is only one time or not.
onther class is control dialog EnableWindow or not.
//my code
//LeftTreeCtrl.h
void CLeftTreeCtrl::EditCategory()
{
CAddCategoryDlg dlg;
dlg.m_strcom1=cry->m_strCom;
dlg.GetDlgItem(IDC_COM1)->EnableWindow(FALSE);
if (IDOK == dlg.DoModal())
{
//code
}
}
void CLeftTreeCtrl::AddCategory()
{
CAddCategoryDlg dlg;
dlg.m_strcom1=cry->m_strCom;
dlg.GetDlgItem(IDC_COM1)->EnableWindow(TRUE);
if (IDOK == dlg.DoModal())
{
//code
}
}
i wrote this two function.
this is not access.
Other class can not control other dialog class.
please answer me.
|
|
|
|
|
Yes, OnInitDialog is just called once when you call DoModal. But, when you create your dialog again, it is of course called again. If you want to enable or disable your control but without knowing it before, I suggest you to add a member variable to your class dialog (say bEnable for example) and add a member function:
void CYourDialog SetEnabled(BOOL bEn) { bEnabled = bEn; } . So you call this member function before calling DoModal (and after creating your dialog) and then, in OnInitDialog, add this:
...->EnableWindow(bEnabled);
|
|
|
|
|
thank you so much...
working my application..
|
|
|
|
|
Hi..
How to find any control on dialog has changed without tracking setfocus() lostFocus() of each control. As there are too many screens & too many controls on those screens. I just find out, if need for Save on OK Button or not needed.
I'm saving data when user press OK.. I want to check that if user changed something then only I run sql to update otherwise nothing should be done...
Can anybody help me?
Regards
Sumit Kapoor
Never consider anything impossible before trying to solve that..---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
Maybe another solution would be to have a member variable in your Dialog class that will be at TRUE hen something changed. So at initialization, this variable is set at FALSE and whenever you change something, set this variable to TRUE.
|
|
|
|
|
Sir Ji,
That's what I'm asking, When to set this variable TRUE, as your suggestion showing that I need to track all controls for changes..that I don't want to do. I just want to find out, User changed any control's value or Not? if changed then I have to save otherwise Ignore on OK Button.
Just Think & let mw know if any idea?
Thanks
Sumit Kapoor
Never consider anything impossible before trying to solve that..---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
I've built a client server application built in visual c++ sp5 inheriting from the CAsyncSocket class. Also i am spinning of a thread when my application starts which is used only for logging purposes. My problem is that the application sometimes just disappears without giving any error message. i've put try catch blocks everywhere and have been as defensive as possible but this is happening at random positions so am not sure what to do at this point. Any ideas why this might be happening? The operating system is windows 2000 server and using a intel P4 HTT machine.
|
|
|
|
|
Try rebuilding all once again . This happened to me .
Dharani babu S
redindian
|
|
|
|
|
I'm attempting to port a DirectSound application I wrote in VC# (.NET 2003) to VC++ (.NET 2003).
I've almost ported the entire code, but I'm stuck on one line, and would really appreciate it if somebody could help me out on this.
The line in C# is:
MemBuffer = (short[])(AppCaptureBuffer.Read(StreamCapBuffReadPos, typeof(short), LockFlag.None, 50000));
MemBuffer was previously declared as:
private short[] MemBuffer;
How would I do this in C++? My problem is with the "typeof" keyword in C#. It signifies the returned data type.
C++ doesn't appear to have the "typeof" keyword. How do I write this in C++?
Thanks!
|
|
|
|
|
can you guys help me to change the font of all the applications' window running in Windows.I tried to change the system font but i can't.
thanks
|
|
|
|
|
hi,use the api
SystemParametersinfo with nm_nonclientmetrics as type and fill in the desired font in nm strcture
|
|
|
|
|
thanks a lot.I knew this API function,but when i tried to change the font of one active application,it can't be done,it 's denied.Do you know the solution?Thanks again!!!
|
|
|
|
|
give sp_updateINIchange and sp_updatreginichange options
it will change aLL apps, i tested it was working
|
|
|
|
|
thanks,buddy,i 'll try again.
Hey if you have a YahooID we can talk directly,wot do yo think?
|
|
|
|
|
my yahoo id is
babu_ooty18
just make it as friend ,i am available now
|
|
|
|
|
I have a Exp file and lib file and dll,can anyone tell me how to get function declaration from it so that i dynamic load function from it.
I know the name of function but i have to retrieve parameter from it
Thanks for any help provided
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
You could try using depends to see the function exports. However I am guessing that all you are seeing are the mangled C++ names.
If this is so, without the header file I would find it hard to prototype the function names and parameter list.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|