|
I am not sure about VC++ 2005, but the raw APIs should still be there. As far as I know INI files are still called INI files, it is just that they where replaced by the registry when Win95 came out. It is not that you could no longer use INI files, it was just that the registry was the new and recomended way to save the same information. The raw APIs could now be used to write/read the registry or an INI file.
They seem to be wanting to replace everything with XML files, so I do not know what [all] they are doing with them at the moment.
Try looking up WriteProfileString() and see where that leads you.
Good Luck!
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
As Yaron say, WritePrivateProfileXXX is good, it will use either an INI file or the registry depends on the version of Windows. I believe now the default is the registry.
Look around on CP and there are INI file classes as well.
Elaine
The tigress is here
|
|
|
|
|
Fritzables wrote: I am fairly new to Visual C++ (2005). Up until now I have been using the Borland product, both Delphi & C++.
BTW, have you moved to VC++ 2005 as a result of Borland's recent decision to sell their IDE business?
Kevin
|
|
|
|
|
Kevin McFarlane wrote: Borland's recent decision to sell their IDE business?
I have heard this rumor for 2 years or more.
Maxwell Chen
|
|
|
|
|
Well, it's actually an official announcement now. Was the rumour of two years ago also an official announcement?
Kevin
|
|
|
|
|
|
G'Day All,
Thanks for the help on this one.
Actually I may stay with creating an INI file instead of having to change a registry setting when ever I want to change a value.
No, I didn't know Borland was getting out if the IDE side of things - very interesting indeed. Is this a recent announcement ?
Pete
|
|
|
|
|
It was announced a couple of months ago. There's various articles on BDN about it, and much discussion on the borland.cppbuilder.* groups.
If Kevin's interested in my answer to his question: I've been using C++Builder almost exclusively since version 3 came out, but I started the move to VS 2003/2005 last autumn. I won't be completing the move for several years at least, since I have many current C++Builder applications to support and many more legacy apps I'll be supporting for a long time to come. The "DevCo" announcement just made me feel better about making the change -- I'm tired of using an IDE that's always a poor stepsister to Delphi.
|
|
|
|
|
Hi
i,m ravindra new member of your team,
i, have a some problem these are.
How i can add my Zoom In and zoom out function in VC++ using MFC in 2d graphics like rectanle?
how can added rotate function in above problem which give a 3-d graphics?
it is a very urgent
ravindra
kannojia_123@rediffmail.com
-- modified at 8:21 Sunday 30th April, 2006
|
|
|
|
|
Go to the GDI section of codeproject, you will find some articles on programs that require that kind of functionality.
In order to zoom in and out you need to use the StretchBlt() function.
Something else that may come in handy is JrsCExBitmap.asp[^], which has information on 2D rotaion as well as providing an undo/redo feature to graphics editors.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
i have a doubt regarding reading text from text files.
i have used CStudioFile and its Read() function to read. But, the String returned is in some other format.
please help regarding this.
does that text needs any conversion ?
Or any other classes are to be used ?
P. Kumaraghuru
|
|
|
|
|
What kind of text are you trying to read? Is the application being compiled in Unicode or Ansi? Is the text file in Unicode or Ansi?
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
i wrote the text into the file using
CStdioFile f1;
if( f1.Open( pFileName, CFile::modeCreate
| CFile::modeWrite | CFile::typeText ) )
{
f1.WriteString(_T(szSampleText));
f1.Close();
}
i need to read the same string.
please help me,
if there is any method to read the string?
|
|
|
|
|
kumaraghuru wrote: CStdioFile f1;
if( f1.Open( pFileName, CFile::modeCreate
| CFile::modeWrite | CFile::typeText ) )
{
f1.WriteString(_T(szSampleText));
f1.Close();
}
how about doing the same thing :
CStdioFile f1;
if (f1.Open(pFileName,CFile::modeRead))
{
f1.ReadString(szSampleText));
f1.Close();
}
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
i have tried giving the same thing as specified by Mr. YaronNir
but, if the szSampleText array is printed, it returns some kind of irrelevant value.
is any type conversions are needed to fit this one.
|
|
|
|
|
show me the exact code including the definition of the szSampleText string....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
i tried to give the same thing as specified by Mr. YaronNir
but the string it returns is in some other irrelevant form.
are there any type conversions or any other method to get the original string in a correct format
|
|
|
|
|
sir, the text file was in unicode sir
Kumaraghuru
|
|
|
|
|
CStdioFile reads/writes Multi-Byte ANSI text to the file even if the source code is compiled as UNICODE.
Visual Studio 2005 supports UNICODE/UTF-8 files with the buffered I/O series of CRT functions (fopen, fwrite, etc.), many which are used by CStdioFile. However, CStdioFile does not directly support these (due to how it opens files--it doesn't actually use fopen().)
Another option is to use the class from this article: http://www.codeproject.com/file/stdiofileex.asp[^]
I have not used nor tested this class, but I've looked at it and it seems to do what you want.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
This will load a text file formatted in ANSI or UNICODE. It's meant to be used in a Doc/View app but you may find it useful to build on. It is in no way complete and it's kinda messy but it gets the data read in nonetheless...
// Assumes compiling for MBCS.
CString m_DataString // Member of document object so view can get to data
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
ar.Flush(); // Need to get rid of Mr. Hanky before
// calling CArchive::GetFile(). Hidee Ho!
CString sResult="";
CString sFileData="";
int nFlags=IS_TEXT_UNICODE_SIGNATURE;
const CFile * file=ar.GetFile(); // Get a const file pointer from CArchive
int nLength=file->GetLength();
LPSTR pBuffer=sFileData.GetBuffer(nLength+2); // Need 2 bytes for unicode
// null terminator, just in case
ar.Read(pBuffer,nLength); // Read the data in raw
// Append a unicode null terminator to prevent
// one of lifes little oopsees...Don't assume anything
pBuffer[nLength]='\0';
pBuffer[nLength+1]='\0';
nLength+=2; // Adjust 2 bytes for unicode null terminator
if (::IsTextUnicode(pBuffer,nLength,&nFlags)) { // Unicode encoded file
// Get the required buffer size for multibyte buffer
int nResultLength=::WideCharToMultiByte(CP_ACP,0,(PWSTR)pBuffer,-1,
NULL,0,NULL,NULL);
// Do the conversion and save it in member variable for when
// the view is ready to load
::WideCharToMultiByte(CP_ACP,0,(PWSTR)pBuffer,-1,
m_DataString.GetBuffer(nResultLength),
nResultLength,NULL,NULL);
m_DataString.ReleaseBuffer();
sFileData.ReleaseBuffer(); // pBuffer no longer valid
m_DataString.Delete(0,1); // Remove what used to be the
// Unicode byte-order mark 0xFEFF
} else { // File not encoded
sFileData.ReleaseBuffer(); // pBuffer no longer valid
m_DataString=sFileData; // Save it in member variable for when
// the view is ready to load
}
}
-- modified at 11:07 Sunday 30th April, 2006
|
|
|
|
|
I have created a project not supporting activeX controls,but now i must
use activex control,which item should i update in .vcproj file to make the project supportting active controls? Or i have to create a new project and inport all files ?
|
|
|
|
|
when you mark the check box in the wizard to support ActiveX controls,
a method is being added to your InitInstance function. the method is called AfxEnableControlContainer
just add it at the begining of your init instance function.
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
hi,
i need a lot of help with this. i am trying to set and get the text in a RichEdit20W of another application. i know the window title and nothing else. i'm pretty sure this is possible (anything is?) but i've tryed a lot of things but haven't had any luck.
i don't need the whole answer (although it would be nice ), im just looking for a point in the right direction.
thanks in advance.
|
|
|
|
|
|
use SPY++ application (shipped with Visual Studio) to determine the relation ship between the main window and the rich edit. meaning is it a child of a child or a child of a child of a child.
once you've figured it out, use GetWindow() method with GW_CHILD parameter, until you've got the proper HWND that points to the rich edit control....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|