C++ Serialization

I was wondering how would you save and open the contents of a editBox (text field) into a directory.
[100 byte] By [bigsaadi] at [2007-11-19 7:30:02]
# 1 Re: C++ Serialization
I was wondering how would you save and open the contents of a editBox (text field) into a directory.
Don't wonder. :p

Some people would get the text from the box using GetDlgItemText (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/getdlgitemtext.asp), or GetWindowText (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/getwindowtext.asp) and save it to a directory/file of their choice using a Windows API or a standard calls like ones discussed in a few posts before this one.
Siddhartha at 2007-11-11 0:27:17 >
# 2 Re: C++ Serialization
I was wondering how would you save and open the contents of a editBox (text field) into a directory.There are many ways. Depends largely on whether you're using the Win32 API directly, or MFC.
gstercken at 2007-11-11 0:28:17 >
# 3 Re: C++ Serialization
thanks guys for the replies, I m using MFC
bigsaadi at 2007-11-11 0:29:18 >
# 4 Re: C++ Serialization
after interting these codes I encouter an error " 'GetDlgItemTextA' : redefinition; different type modifiers "
the codes:

void CLEDUserSoftwareDlg::ClickBsave()
{
UINT GetDlgItemText(HWND hDlg,int nIDDlgItem,LPTSTR lpString,int nMaxCount);

}
bigsaadi at 2007-11-11 0:30:23 >
# 5 Re: C++ Serialization
after interting these codes I encouter an error " 'GetDlgItemTextA' : redefinition; different type modifiers "
the codes:

void CLEDUserSoftwareDlg::ClickBsave()
{
UINT GetDlgItemText(HWND hDlg,int nIDDlgItem,LPTSTR lpString,int nMaxCount);

}

Hey man! You are supposed to be passing parameters to the method, not declaring it!

This is how it should be -
GetDlgItemText (hMyDlg, ID_MYEDITCTRL, lpszBuffer, BUF_LENGTH);
Siddhartha at 2007-11-11 0:31:22 >
# 6 Re: C++ Serialization
I've never tried that before, could you give me something I could start with ( a little example or something)
bigsaadi at 2007-11-11 0:32:25 >
# 7 Re: C++ Serialization
I've never tried that before, could you give me something I could start with ( a little example or something)Say that again - you are using MFC (a class library and framework in C++) and you have never passed an argument to a function (which is one of the most basic things any C++ programmer does)? :confused:
gstercken at 2007-11-11 0:33:28 >
# 8 Re: C++ Serialization
I've never tried that before, could you give me something I could start with ( a little example or something)
There are many samples and tutorials available online.
Please go through them.

Besides that, my first post contains links to the documentation of the APIs that will help you - read them.

MFC Fundamentals (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_mfc_fundamentals.asp)

Also, the way you used the API makes it look like you are new to C/C++ too! If that is true, you will need to brush up your C/C++ skills as a pre-requisite to learning MFC.

All the best. :thumb:
Siddhartha at 2007-11-11 0:34:24 >
# 9 Re: C++ Serialization
If that is true, you will need to brush up your C/C++ skills as a pre-requisite to learning MFC well.I'd rather say: As a prerequisite to using MFC at all.
gstercken at 2007-11-11 0:35:22 >
# 10 Re: C++ Serialization
ok, Im actually a college student, and I only need to make a GUI application to run my Electronic project (LED Dot Matirx Module)that I m working on.
thanks guys.

P.S
basically, I need to write a text in the editBox(Text field) , and save it in the windows directory and later retieve it and then through the seial port send the text to the LED display. that would be it.
bigsaadi at 2007-11-11 0:36:23 >
# 11 Re: C++ Serialization
ok, Im actually a college student, and I only need to make a GUI application to run my Electronic project (LED Dot Matirx Module)that I m working on.
thanks guys.

P.S
basically, I need to write a text in the editBox(Text field) , and save it in the windows directory and later retieve it and then through the seial port send the text to the LED display. that would be it.

Perhaps something simple like WriteProfileString would work for you.
GCDEF at 2007-11-11 0:37:25 >