|
No... Im not using INI File to store confiq info...
IM USING INI FILE TO CREATE A PHONE DIRECTORY...
i know there r better methods...
BUT ITS MY ASSIGNMENT....
..........N ITS SAID THAT I USE ONLY INI FILE
|
|
|
|
|
anna mathew wrote: IM USING INI FILE TO CREATE A PHONE DIRECTORY...
As I already suggested, MFC object serialization, is far better for the purpose.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The following code snippet create two keys under the section 'General' of the File 'MyFile.ini', and then reads one of the keys, showing the value in a message box.
(of course error check is left to the reader...)
Please note 1: if the file doesn't exist, it creates both the file and the section.
Please note 2: I used WritePrivateProfileString and GetPrivateProfileString , otherwise the I/O would happen inside the registry.
const CString szINIFILE = _T("C:\\Documents and Settings\\anu\\beginning\\MyFile.ini");
CString szFirstName;
WritePrivateProfileString(_T("General"),_T("FirstName"), _T("Anu"), szINIFILE);
WritePrivateProfileString(_T("General"),_T("LastName"), _T("???"), szINIFILE);
GetPrivateProfileString(_T("General"), _T("FirstName"), _T(""), szFirstName.GetBuffer(MAX_PATH), MAX_PATH, szINIFILE);
szFirstName.ReleaseBuffer();
AfxMessageBox(szFirstName);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks....
this works....
but i put the same lines of code in my MFC
application....
still it works....
can u explain how?
WriteProfileString...... is a console function...
then how come it work with MFC?
|
|
|
|
|
WritePrivateProfileString is just a WIN32 API 's function: Console applications, as well as GUI (and MFC ) ones can profitably call it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
The control will popup a dialog box,
and when I press a buttion in the dialog,
I need the control fire a event?
I tried to do it as below:
CMyDlg::OnOk
{
CMyCtrl *pCtrl = dynamic_cast<>(GetParent());
...
pCtrl->OnUpdate(var);
}
How to solve it?
modified on Monday, November 3, 2008 7:03 AM
|
|
|
|
|
I would like to know how to configure the ip address of a notebook PC. I only want to configure the wireless network adaptor how can I identity it if I don't know the name of the wireless network adaptor.
Also, how to configure the adhoc mode in the notebook by Visual C++?
Please help!!!
|
|
|
|
|
1/ I doubt it's any different on a notebook to a normal one, other than needing changed more often.
2/ I had the same problem a while ago, as I was forever changing my IP address, so I wrote a little tray app to do it. Quick and dirty, but it worked.
I gave up trying to change it programmatically, and ended up using the
netsh interface ip set command instead, and CreateProcess to make sure that no dos prompt flashed up.
3/ I know nothing about adhoc wifi! Would be nice to learn some time...
Iain.
|
|
|
|
|
In the notebook PC, there are more than one network interface. How can I identify the wireless one from another? I know that we can change it with registry if we know the right one.
I can find the adhoc wifi setting in the registry. Can anyone give some hint of it??
Please help!
|
|
|
|
|
i want change the font size for existing createfont() handle without creating again.
Is it possible?
|
|
|
|
|
The answer looks no, or too complex to be the right way.
Why you doesn't like a solution like thi one?
LOGFONT LogFont;
m_Font.GetLogFont(&LogFont);
LogFont.lfEscapement=900;
m_FontVert.CreateFontIndirect(&LogFont);
in my code I'm rotating the font to have vertical text, but you can do the same on the same CFont variable to change other parameters as the font size.
Russell
|
|
|
|
|
I have created this socket xample application given in learn vc++ in 21 days which is successfully working. now my question is how do i connect to multiple ip addresses in my applicaion.
right now this is what is does
m_sConnectSocket.Connect("25.25.25.25", m_iPort);
this ic working. but i want to add multiple ipaddress.
Thanks in advance.
|
|
|
|
|
What do you mean exactly by multiple addresses ? Why can't you simply open several socket connections if you need ?
|
|
|
|
|
multiple address means multiple people. tried to open several connections. if i give 2 or more connections none of the connections are successful
|
|
|
|
|
But what about using multiple sockets instead of one ? How many connections do you need to open ?
|
|
|
|
|
i have not ventured much of socket programming.. so i dont know much about it.. infact i can tell u that it was the first application that i am trying in socket programming. well, when i am trying with one connection it is working. but if i am using multiple connections it is not. i want something like if i send a message then it should reach multiple people.. if multiple sockets can be used then i needs some leads for that.
|
|
|
|
|
Chandrasekharanp wrote: if multiple sockets can be used then i needs some leads for that
Why can't you simply use several different CSocket class instances ? What you did for your example, just do it again with another CSocket instance.
You still didn't answer: how many connections do you need to establish ?
|
|
|
|
|
ok. sorry for that.. right now i want to make 3 connections.
i shall certainly try doing it with ur leads. will get back to you soon..
|
|
|
|
|
Do you need multicast socket??
Look here[^] for example
I hope it helps..
Regards,
Sandip.
|
|
|
|
|
Hey thanks sandip.. looks like this will help me..
|
|
|
|
|
Hi all,
I have a stringstream, and I want to find the index of '<' sign contain in the stream. Actually first content.
<br />
stringstream str("y:<?xml version=\"1.0\" encoding=\"UTF-8\"?><Statistic>");<br />
<br />
int offset = str.str().find('<', 0);<br />
Then I want to remove all the content up to '<' sign and need to make a stream like this.
<?xml version=\"1.0\" encoding=\"UTF-8\"?><Statistic>
Can you help me to do this.
I appreciate your help all the time...
CodingLover
modified on Monday, November 3, 2008 1:53 AM
|
|
|
|
|
Extract the required part by substr() and update streambuffer. Have a look at code snippet.
stringstream str("y:<statistic>");
int offset = str.str().find('<', 0);
str.str( str.str().substr( offset ));
</statistic>
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Ok, thanks.
But how about this way?
str.str().substr(offset)
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: str.str().substr(offset)
str.str() is not returning reference to string. This statement will return back a temporary string object. Hence, It won't update the string stream buffer. For instance,
string temp = str.str().substr(offset);
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|