|
String strLine;
while ((strLine = inData->ReadLine())) != null)
{
}
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
If you're allowed to use the standard library, an ifstream would actually allow you to read them as ints, no problems at all.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
nah... have to use it at this .net gayness haha... so i guess is use streamreader??
k
|
|
|
|
|
I suppose so. What idiot is making you use C++.NET ? If you want to use .NET, use C#.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
it's actually a school assignment... and the gayness of my school... lets do C++ .NET for the first C++ class... but the Object Oriented C++ next semester will be in standard code.... it makes no sense...
k
|
|
|
|
|
They probably think that the .NET framework will make the jump into C++ less painful. I still think C# would have given the same effect with more long term benefit.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Do I have to write out the registry key in order to write out an ini file? In my code I'm using the WritePrivateProfileString API passing the section name, key and the path with file name. The file gets created but nothing is written.
In the example in the MSDN lib they show calls made to registry settings. But I just want to write out the file and not making any reg settings.
Here's a snippet of my code:
<br />
for(int i = 0; i < NumItems; i++)<br />
{<br />
if (ListView_GetCheckState(m_cColumnList.GetSafeHwnd(), i))<br />
{ <br />
WritePrivateProfileString ("Columns", m_cColumnList.GetItemText (i,0), NULL,CurrentDir); <br />
}<br />
}<br />
All I want to do is write out the SQL column names to an ini file. So each key will be a column name with no value.
Any help would be appreciated.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
If the third parameter to WritePrivateProfileString() is NULL, the specified key (the second parameter) will be deleted.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Is there a way to write out a key without a value?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Sure, just ensure that the third parameter is non-NULL .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Haha....duh. How come you always seem to make me see the light and it's right in front of me?
Thanks again
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Is it possible to put keys in there with out the '=' sign after them. Would I have to open this file like a normal file?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote:
Is it possible to put keys in there with out the '=' sign after them.
Not and be able to use the ini-related functions.
Tom Wright wrote:
Would I have to open this file like a normal file?
What constitutes normal is how the file is used, not what it contains. You can store the data in a .ini file, but you'd then need to use fscanf() , CFile::Read() , or CStdioFile::ReadString() to operate on it. To avoid future confusion, you might want to make it a .cfg file.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
In all honesty, if I were you, run, don't walk, from WritePrivateProfileString and its ilk. Just open the file like a regular text file. I'm sure there are libraries to handle INI files here on CodeProject, if not, writing your own isn't that big of a deal and will pay off in the long run.
Why don't I like WritePrivateProfileString?
It can fail on 95/98/Me if your file is too big (> 64K)
As you have noticed, it is not very flexible.
I believe the OS may use some funky memory mapping to write the file, so attempts at reading it as a nomral file after calling WritePrivateProfileString may be unpredictable.
Remember, even if you win the rat race, you're still a rat.
|
|
|
|
|
Navin wrote:
I'm sure there are libraries to handle INI files here on CodeProject, if not, writing your own isn't that big of a deal and will pay off in the long run.
It would be silly to reinvent the wheel. It makes no sense to use something other than WritePrivateProfileString() when writing to a .ini file. If that function does not do what you want, perhaps what you want requires a different tool (I'm thinking of an Abraham Maslow quote here).
Navin wrote:
It can fail on 95/98/Me if your file is too big (> 64K)
If more than 64KB needs to go in such a file, it's time to rethink the design.
Navin wrote:
As you have noticed, it is not very flexible.
Only if you don't know how to use it, or use it for something for which it was not intended.
Navin wrote:
I believe the OS may use some funky memory mapping to write the file, so attempts at reading it as a nomral file after calling WritePrivateProfileString may be unpredictable.
Why use a .ini file if you are not going to use ini-related functions on it?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I am not getting how to transfer a .BMP file from one machine to another using sockets. Plz help me
|
|
|
|
|
Well can u clearly tell what problems u r having , is there some problem regarding socket programming or something else.
Unmanaged in a .NET world
|
|
|
|
|
In my code On one machine there is a .bmp file
I created one object of CFile & opened that file in binary mode
then one byte pointer is pointing to start of file, for .txt file this pointer holds the pointer to the string, but in my case it is holding header
so i can not send that data on network
If CArchive can be used plz guide me.
|
|
|
|
|
Just wondering if its possible to create a web page snapshot. Check this example:
http://www.pcworlddownload.com/internet/browser-utilities/IESnap.htm
This tool adds a button to IE toolbar and when clicked it saves the web page as png file.
I'm working on a similar project but can't solve this part. I need to create a web page snapshot and email/ftp it to the server.
Any help is appreciated.
Thanks.
|
|
|
|
|
Try using WM_PRINT or WM_PRINTCLIENT, most likely IE supports those messages
Edward
|
|
|
|
|
THanks for the reply.
Actually I'm not that good in VC++. Could you please send some examples?
Thanks.
|
|
|
|
|
Sorry, don't have any examples.
Here is an idea:
HWND hSnapShotWnd = ??; // This is the window for the snapshot (IE)
//create memory dc:
HDC hWinDC = GetDC(NULL);
hDC hMemDC = CreateCompatibleDC(hWinDC);
RECT rcClient;
GetClientRect(hSnapShotWnd , rcClient);
//create bitmap for the snapshot of the client area of the window
HBITMAP hBitmap = CreateCompatibleBitmap(hWinDC, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top);
HBITMAP hOld = SelectObject(hMemDC, hBitmap);
SendMessage(hSnapShotWnd, WM_PRINTCLIENT, (WAPRAM)hMemDC, PRF_ERASEBKGND|PRF_CLIENT|PRF_CHILDREN);
//after that hBitmap contains the picture of the client area of the hSnapShotWnd (if window supports WM_PRINTCLIENT).
SelectObject(hMemDC, hOld);
DeleteDC(hWinDC);
DeleteDC(hMemDC);
HTH,
Edward
|
|
|
|
|
Hello everyone, I just wanted to know how to create a dailog program that would call another dialog. I have looked at the articles supplied at the site, which are very good, but have not seen a simple example. Most of them are just to complex for me to understand since i have just started programming in mfc. I was wondering if anyone know a simple skelaton example where a dialog based mfc program calls another dailog.
My main problem is not creating the second dialog or the main dialog but its how to declare it in the main dialog, and just the technical stuff.
Thank you.
|
|
|
|
|
You'll need two dialoog templates in the project's .rc file. You'll also need two CDialog -derived classes (e.g., DialogA, DialogB), one for each template. Use ClassWizard to create these. In the OnInitDialog() method of DialogA, create an instance of DialogB and call its DoModal() method. Something like:
BOOL DialogA::OnInitDialog()
{
DialogB B;
B.DoModal();
return TRUE;
}
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Not sure if the other post helps, but I'll try and break it down. Basically you are going to add a new dialog resource. Call it what ever you want for the window title. After you add your new dialog resource, the easiest thing is to open Class wizard. It will ask you if you wish to add this to an existing class or make a new one. Choose make a new one. Then here you will be given a chance to create your class for this dialog as well as the .CPP and .H files (you'll see what I'm talking about when you get there). Now in your main program add the newly created header file. Then create a reference to that class. Lastly, to open that new dialog just do a DoModal and there you are.
Hope this gets you going. From there you can find tons of ideas as to what you can do.
Tom Wright
tawright915@yahoo.com
|
|
|
|