|
Use ADO or ODBC for multithreaded database access. It is possible (as I have done this in the past) with DAO but why waste time with technology that microsoft has quit developing 5 years ago...
John
-- modified at 22:07 Wednesday 31st May, 2006
|
|
|
|
|
Are the client and the server on the same machine?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
CString LString;
CString Win = GetWinampPath();
Win.Replace("Winamp.exe","winamp.ini");
AfxMessageBox(Win);
CStdioFile file;
CString Filepath = Win;
const int sz =100;
char buf[sz];
if (file.Open(Filepath,CFile::modeReadWrite|CFile::modeNoTruncate|CFile::modeCreate))
{ // what i have to add here?
file.ReadString(buf,100);
LString = (LPTSTR)buf;
if ( LString == "minimized=0")
{
file.Remove(LString);
file.WriteString("minimized=1");
}
}
file.Close();
|
|
|
|
|
Hi
I am not able to answer as per your question.
From your code it seems that you want to change the settings of INI file.
Then why not to try the functions ?
GetPrivateProfileInt
SetPrivateProfileInt
GetPrivateProfileString
SetPrivateProfileString etc...
Regards
Anil
|
|
|
|
|
oh ?
I got the winamp.ini file:
...
...
...
...
minimized=0 //the part i want to remove
...
...
Files.ini have different act than .txt etc?
|
|
|
|
|
In that case the above code seams a lot of things missing
What I think of is that in stead of using CStdioFile you use CFile.
In CFile you can read the whole file into a CString.
Then use CString remove command to remove the part of the string you want to remove.
Then write the string back to the file.
Other method is use a temporary file and read one line and write to temp file, Except the line you want to remove.
Then copy the temp file to .ini file.
Regards
Anil
|
|
|
|
|
thx
|
|
|
|
|
Immunity18 wrote: file.ReadString(buf,100);
Why use char here? A CString object (e.g., LString ) is a much better choice.
If you are changing the contents of a .ini file, why not use the appropriate functions?
GetPrivateProfileString()
WritePrivateProfileString()
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
i'll try that althought its first time i hear about these functions ( i am a (very) bit newbie
|
|
|
|
|
Hi all =)
Is there a way of forcing the operator new to fail?? I need to test something...
Best regards [[]]
hint_54
-- modified at 18:06 Wednesday 31st May, 2006
Oh.. and one more thing =D
If I overload the operator new then the class constructors will not be called when memory is allocated for them. How do I make it call the constructor?
Peace =)
hint_54
|
|
|
|
|
hint_54 wrote:
If I overload the operator new then the class constructors will not be called when memory is allocated for them. How do I make it call the constructor?
Placement new? new (ptr_to_memory) Class(args)
--
100% natural. No superstitious additives.
|
|
|
|
|
Overloading the new should not effect whether the constructor is called.
Steve
|
|
|
|
|
Yes.. It's working now, but it didn't work at first.. Don't know why..
regards
hint_54
|
|
|
|
|
hint_54 wrote: If I overload the operator new then the class constructors will not be called when memory is allocated for them.
How are you verifying this?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
I add a printf to the constructor.
But I don't get it.. it wasn't calling it and now it is! It must have been something else..
regards
hint_54
|
|
|
|
|
I am using this code to create a modeless dialog.
dlg.Create(CMainDialog.IDD, GetDesktopWindow());
dlg.ShowWindow(SW_SHOW);
However, It closes the modeless dialog as soon as it opens. Why is this? I get the debug message "Warning: calling DestroyWindow in CDialog::~CDialog --OnDestroy or PostNcDestroy in derived class will not be called"
Sorry for another stupid question. I swear I will catch on sooner or later.
Hey Maybe it will give you a chance to feel good about being able to answer an easy question, though make me feel even more stupid
-Brandy
|
|
|
|
|
Are you istantiating the dlg object inside a class method? If so, the problem is that as soon as the method exits, the dlg object gets destructed and your dialog is gone. The dlg object needs to live as long as you want the dialog to be displayed.
|
|
|
|
|
So where exactly am I suppose to declare it? I have tried placing it in all differnt locations and it says all of them are illegal.
|
|
|
|
|
Try:
CMainDialog *dlg = new CMainDialog;
dlg.ShowWindow(SW_SHOW); When you are done with it, call dlg->DestroyWindow() . Be sure and override PostNcDestroy() and delete the this pointer.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
That worked very nicely. Thanks a lot.
~Brandy
|
|
|
|
|
MDI project. User opens a few child windows.
And now I have to react on changing active child window.
One of the dialog bars is displaying some text and stuff that is unique for each document.
I have to change contents of this dialog bar when user is setting active other child window (I don't know if it calls "changing focus"?).
How can I do it?
~~~~
|
|
|
|
|
Luksky wrote: MDI project. User opens a few child windows.
And now I have to react on changing active child window.
One of the dialog bars is displaying some text and stuff that is unique for each document.
I have to change contents of this dialog bar when user is setting active other child window (I don't know if it calls "changing focus"?).
How can I do it?
CView::OnActivateView or CWnd::OnActivate
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
I tried something like this, but it's not working :/
void CChildFrame::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) <br />
{<br />
CMDIChildWnd::OnActivate(nState, pWndOther, bMinimized);<br />
<br />
BOOL bActivated = nState & WA_CLICKACTIVE;<br />
if( bActivated )<br />
AfxMessageBox("activate"); <br />
}
or like this
if( nState == WA_ACTIVE )<br />
AfxMessageBox("activate"); <br />
~~~~
|
|
|
|
|
Hello fellow men,
I am a former VB6 developer, turned VB.NET, turned C# developer. Now I'm facing troubles, cause I'm in for a big project that would be greatly weakened by a requirement to the end user, that a .NET framework would need to be installed.
Therefore, I've thought about immigrating to C++. How difficult would that be? How is the learning curve? How much time should I expect to put into it? What should I be aware of, when it comes to performance hits (going from a rapid ide to a non-rapid-ide) etc.?
Basically, I'd like to work with audio, file and network streams. And threading.
Any help, tips, guides or references to litterature would be greatly appreciated
PS. I hope this question hasn't been raised to many times before. At least, I didn't find any relevant posts in the search function.
|
|
|
|
|
matiasdk wrote: Basically, I'd like to work with audio, file and network streams. And threading.
Any help, tips, guides or references to litterature would be greatly appreciated
You are basically asking how hard it would be for you to go from a language that has these features pre-packaged for you, to one that gives you the ultimate flexibility with them (and are quite advanced topics at that). Going from C++ to any other language has a very small learning curve; not so for the other way around. The language syntax is similar to C#, but if you haven't been exposed to C++ before, I wouldn't try to jump into it with a project on a deadline.
As far as developing GUIs for your application, you won't notice much of a hit since Visual Studio has a very nice resource editor. However, you will notice that you don't get some of the cool features for free anymore (e.g. skinning, resizing controls when the window resizes, control arrays, etc).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|