|
Tagamoga wrote:
myAnimal Bear(2, 4);
fout.write((char*) Bear, sizeof Bear);
myBird Tweety(6, 2);
fout.write((char*) Tweety, sizeof Tweety);
fout.close();
// to read:
how do I know which class is now read from the file?!?!?!
myAnimal Bear(2, 4);
int type = 1;
fout.write((char *) &type, sizeof(int));
fout.write((char*) Bear, sizeof Bear);
myBird Tweety(6, 2);
type = 2;
fout.write((char *) &type, sizeof(int));
fout.write((char*) Tweety, sizeof Tweety);
fout.close();
would be one way, but it is a bit clunky. I'd recommend serialization, but without knowing more about what you are doing, that's a tentative recommendation.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Dont you need MFC for Serialization?
This little program has to be platform independant.
What do you need to know to help me? This is not a special project, I am only learning. I haved programmed for more than 5 years MFC. But soon I will work for project, that is platform independant, so I try to learn such topics and their problems before.
Serialization with MFC is easy, but how do I realize ist without MFC?
Thanks for help.
Taggi
How do you know, that Tagamoga has been assimilated by the borg?
"Recistunce ist fiutille."
Sorry for violating the english language.
|
|
|
|
|
Tagamoga wrote:
Dont you need MFC for Serialization?
Yes (it might be possible, albeit more difficult, outside the scope of MFC, but I've never tried). Your initial post did not mention platform independence, which is why I suggested serialization.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Oh, i am sorry, that I did not mentioned.
But I have thought, that nobody will use fin and so on with MFC...
Thanks for help.
Taggi
How do you know, that Tagamoga has been assimilated by the borg?
"Recistunce ist fiutille."
Sorry for violating the english language.
|
|
|
|
|
I need help coding. I am new to C++ and learning.
i have a dialog box with a "connect" button that i need to code to bring/call a .exe application.
this connect button is connected to an edit box and whatever is in the edit box (ip address), that's the address the .exe application is supposed to connect to.
i hope it is not confusing, cause it is for me.
help, please
g.r.
|
|
|
|
|
CABS wrote:
i have a dialog box with a "connect" button that i need to code to bring/call a .exe application.
In the button's handler function, use CreateProcess() or ShellExecute() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
prefer a CIPAddressCtrl to be sure the IP Address you type in is valid.
then, open a socket, connect it to that ip with whatever port you want...
here is the connect button override...
TOXCCT >>> GEII power
|
|
|
|
|
hi,
I'm trying to use id3lib for manipulating ID3 tag, I need to store data in Comment field but as far as I've understood id3lib only takes text into that field.....anyone knows if there're some other libraries that permits to work on id3 tag or is experienced it it's use? thanks
Paolo
|
|
|
|
|
I am running a VC++ MFC based application using Visual Studio .NET, as it starts up it loads most of it's DLLs & then freezes so it never really starts the application it stays in this frozen state. The only way out of it is by killing it. I rebooted my machine, plus rebuilt my application but it didn't work.
What can be causing this to happen?
|
|
|
|
|
Sounds a little bit like a virus scanner or a firewall..
Jens
|
|
|
|
|
Thanks but that's not the case here, could it be some static initialization that's a bit corrupted? just a guess
|
|
|
|
|
Well, maybe, but not very likely?!?
Is this the case with EVERY application or just with one specific app?
Jens
|
|
|
|
|
just this one specific app
|
|
|
|
|
Try to isolate the problem.
If you're loading special DLLs add them one by one
to a new "dummy" project until it happens to this
app also.
Jens
|
|
|
|
|
It's not the DLL, the DLL where it's freezing at, seems to load fine, it seems only to be happening on my machine, my co workers are able to run the same application just fine. What could have happened? I did a repair/reinstall on my VS but it didn't help.
|
|
|
|
|
Does this happen only during a ShellExec type call where you double click on a file whose associated program is the one hanging?
onwards and upwards...
|
|
|
|
|
it happens when I run it from the Visual Studio. NET in debug mode.
|
|
|
|
|
Hi Guys,
I have little problem with the scroll bars. I have Displayed the bitmap on the DialogBOx. I want to Scroll bars to available depending on the dimensions of scroll bar. Problem is I am not able to calculate what to keep the Page size. I tired to keep the width and height as Scroll bar Range. But still Page size is nor properly set. Its giving flickering like problem to me.
Please can any one tell me how to calculate the scroll bars page size depending on the range.
bbye
"Thanks in Advance"
|
|
|
|
|
Hi.
I have problems with the ListBox control, (class CListBox), 'cause I have a Access 2000 database with text in russian. When I show the data in an EditBox or even in a Button, everything work fine, but when I want to show the data in a ListBox, it shows something like "??????????" or "|||||||".
The listbox have not UNICODE support?.
I think that the problem is with the method AddString() maybe it convert the text to ANSI.
What is the solution?. There's is an alternative listbox?
Thank you.
Demian.
|
|
|
|
|
Send a message to the ListBox directly and use
SendMessageW. Then it will interpret LPARAM/WPARAM
as unicode parameters.
Jens
|
|
|
|
|
Hi!
Thank you for your answer.
I have write something like that
<br />
::SendMessage(m_lstText.GetSafeHwnd(), LB_ADDSTRING, 0, (LPARAM)(LPCTSTR) field);
And I have the same problem, the listbox can't show the info.
field is a CString variable, that one line before is asigned to an editbox that shows well the text in russian. At the beginning of the procedure the variable field was filled with the field of the database.
I dont know what I doing wrong.
Thank you very much for your support.
Demian.
|
|
|
|
|
Hi Demian,
Do you compile your app with UNICODE support?
If no, then you cannot use CString because it will
internally use ANSI characters.
Jens
|
|
|
|
|
Yes the application is support UNICODE.
Remember that I can see the data in the editbox.
Demian.
|
|
|
|
|
I compiled a small sample app.
And RChin got the trick right from the beginning.
The font is the problem.
A ListBox uses the MS Sans Serif font, which obviously does not support Unicode.
Set the font to a different type, the it will work, like the following MFC sample code:
<br />
<br />
CFont *pFont = m_ctrlList.GetFont();<br />
LOGFONT lf = {0};<br />
pFont->GetLogFont( &lf );<br />
::lstrcpyn( lf.lfFaceName, _T("Tahoma"), sizeof( lf.lfFaceName ) / sizeof( lf.lfFaceName[ 0 ] ) );<br />
<br />
m_font.CreateFontIndirect( &lf );<br />
m_ctrlList.SetFont( &m_font );<br />
<br />
That should do the trick...
Jens
|
|
|
|
|
In addition to the comment above^, ensure that the font used by the listbox for display supports your russian UNICODE characters.
I Dream of Absolute Zero
|
|
|
|