look at this tutorial http://www.winprog.org/tutorial/
you will find this function
BOOL SaveTextFileFromEdit(HWND hEdit, LPCTSTR pszFileName)
{
HANDLE hFile;
BOOL bSuccess =3D FALSE;
hFile =3D CreateFile(pszFileName, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile !=3D INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength =3D GetWindowTextLength(hEdit);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
LPSTR pszText;
DWORD dwBufferSize =3D dwTextLength + 1;
pszText =3D (LPSTR)GlobalAlloc(GPTR, dwBufferSize);
if(pszText !=3D NULL)
{
if(GetWindowText(hEdit, pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten=
,
NULL))
bSuccess =3D TRUE;
}
GlobalFree(pszText);
}
}
CloseHandle(hFile);
}
return bSuccess;
}
----- Original Message -----=20
From: "Jarren Long" <vb...@gm...>
To: <dev...@li...>
Sent: Thursday, July 21, 2005 6:34 PM
Subject: [Dev-C++] Getting Text
Hey everyone. I need to be able to get the text from an edit control
after I click a button. Here'swhat I have so far:
case WM_CREATE:
button=3DCreateWindowEx(0,"BUTTON","Graph",WS_CHILD|WS_VISIBLE|BS_DEFPUSH=
BUTTO
N,
0,0,100,17,hwnd,NULL,g_hInst,NULL);
entry=3DCreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","Function",
WS_CHILD|WS_VISIBLE|WS_BORDER,100,0,99,17,hwnd,NULL,g_hInst,NULL)=
;
break;
How would I go about getting the text from the edit control after I
click the button?
--=20
Jarren L.
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dick
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
--=20
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.9.2/55 - Release Date: 21/7/2005
|