|
When click button use of
CEdit m_Edit;
CString str;
m_Edit.GetWindowText(str);
MessageBox(str);
And if you want to set a value dynamicly for editbox use of SetWindowText
|
|
|
|
|
Use WM_KILLFOCUS for your text box and get the text using GetWindowText . I hope this is you want.
|
|
|
|
|
Hai,,
I cant really understand i brief my question..
Iam entering the values in edit box during runtime and displaying it...
CEdit m_ce;
m_ce.GetWindowText();
TCHAR szMsg[256];
wsprintf(szMsg,_T("hEIGHT: %ld "),m_ce);
MessageBox(szMsg,NULL,MB_OK);
error C2661: 'GetWindowTextA' : no overloaded function takes 0 parameters
Thanks For Spending Your Precious Time
Harshadha
|
|
|
|
|
int GetWindowText( LPTSTR lpszStringBuf, int nMaxCount ) const;<br />
void GetWindowText( CString& rString ) const;
Use as below
CEdit m_ce; <br />
CString str;<br />
m_ce.GetWindowText(str);<br />
TCHAR szMsg[256];<br />
long lValue = _ttol((LPCTSTR)str);<br />
wsprintf(szMsg,_T("hEIGHT: %ld "),lValue);<br />
MessageBox(szMsg,NULL,MB_OK);
-- modified at 6:26 Thursday 8th March, 2007
|
|
|
|
|
Hai,
Iam sorry for troubling you again but iam getting memory error like asking
whether to retry or abort...
If i click ignore its displaying msgbox with 0 in it..
Thanks
Harshadha
|
|
|
|
|
have you done validation on the text box like the input is only numeric value and not alphabet nor alphanumeric...
|
|
|
|
|
|
Hi,
I think u havent created a member variable for the editbox. Simply you would have written like
CEdit m_ce;
It ll not work out.
First you need to create a member variable for the edit box using class wizard with the control type as Edit.
say, the member variable is m_editChar. then,
CString str;
m_editChar.GetWindowText(str);
MessageBox(str);
now, the str ll give u the value entered by the user in the edit box.
Hope this ll solve your problem.
Thanks & Rgds,
Sri..
|
|
|
|
|
|
I wrote for you an exmaple and also GetWindowText needs to a parameter for hold values
|
|
|
|
|
harshadha wrote:
TCHAR szMsg[256];
wsprintf(szMsg,_T("hEIGHT: %ld "),m_ce);
So then why are not using CString with your MFC application?
harshadha wrote: MessageBox(szMsg,NULL,MB_OK);
Consider using AfxMessageBox() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hai,
Thanks a lot to all...
i got the output....
Harshadha
|
|
|
|
|
I hope you got your answer with best way
|
|
|
|
|
Hi,
If iknow the filename and its path i hould be able to open and display that file.if any ideas on how to do it please let me know..
harsha
|
|
|
|
|
Which? Open a file or get path of a file?
|
|
|
|
|
i should be able to open and display the contents to the user ..
harsha
|
|
|
|
|
|
Have you tried the following:
Open File
HANDLE CreateFile(
LPCTSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile
);
Read Contents:
BOOL ReadFile(
HANDLE hFile,
LPVOID lpBuffer,
DWORD nNumberOfBytesToRead,
LPDWORD lpNumberOfBytesRead,
LPOVERLAPPED lpOverlapped
);
Read File[^]
Open File[^]
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
i dont want to read or open or create a file.. i want to display a file to the user say when user clicks a button. will this help in that regard ?
harsha
|
|
|
|
|
harsh_2961 wrote: i dont want to read or open or create a file.. i want to display a file to the user say when user clicks a button. will this help in that regard ?
If you want to see file's content you have to open it. There is no other way than opening given file to read it, and if you want to display it's content you have to read it first.
Unless you are talking about viewing file's... name?
|
|
|
|
|
Hope I understood your question
use of a CFileDailog and when he clicks ok button show file name(Is your purpose)
|
|
|
|
|
If its a simple text file using CEditView will do, try creating simple SDI application and choose baseclass as CEditView in last step of app wizard.
|
|
|
|
|
its a ".chm" (Compiled Html file)..
harsha
|
|
|
|
|
|
Have you considered using ShellExecute(..., "open", "file.chm", ...) ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|