|
I'm developing a project in VC++6.0 MFC.
Is there any way to make an editbox the default output device so that a printf statement prints to it? My goal by doing this is to take advantage of all the formatting that comes along with printf.
Thanks.
|
|
|
|
|
if you want, but non with printf()
use SetWindowText() instead (and you'll have a look at the MSDN to see how this function is working.. )
TOXCCT >>> GEII power
|
|
|
|
|
|
The best solution:
Use "wsprintf(...) " print a formatted line to a string and display that string in an edit BOX as follows:
char str[100];
int i=10;
float f=12.0045;
CEdit wEdit;
wsprintf(str, "This is formatted string with %.2f and %d. lol", f, i);
wEdit.SetWindowText(str);
wsprintf
The wsprintf function formats and stores a series of characters and values in a buffer. Any arguments are converted and copied to the output buffer according to the corresponding format specification in the format string. The function appends a terminating null character to the characters it writes, but the return value does not include the terminating null character in its character count.
CHECK MSDN www.msdn.com[^] FOR FURTHER DETAILS
Hope that works 4 u. Tell me if u love my solution
...Avenger
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
The sprintf idea works great with MFC CString Edit Boxes.
I could not get SetWindowText() to work with the CString Edit Box in MFC. Probablly just my lack of VC experience....
Thanks for the suggestions.
|
|
|
|
|
you only had to cast your CString object into a C-style string with (LPCTSTR)MyStringObject;
TOXCCT >>> GEII power
|
|
|
|
|
I create application-bar and Buttons by CToolBar.
1.Create(///);
2.SendMessage(TB_SETEXTENDEDSTYLE,0,TBSTYLE_EX_DRAWDDARROWS);//DropDown-EX
3.TBBUTTON -- AddButtons
4.TBBUTTONINFO -- SendMessage(TB_SETBUTTONINFO ,BUTTON_ID,(LPARAM)&m_tbutton_info);
I can customize some buttons at No.4.
But I can't create each free bitmap-width button.
CToolBarCtrl::SetBitmapSize() is to influence All buttons!!
Please Help me !!
|
|
|
|
|
But I can't create each free bitmap-width button.
CToolBarCtrl::SetBitmapSize() is to influence All buttons!!
Better tell what u mean by these. Be more specific. Someone will definitely answer u
...Avenger
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
Thank you for advice.
For Example,
- using CToolBarCtrl::SetBitmapSize(),
- The toolbar has 3 butons.
I want to modify 1st button's bitmap size in OnCreate function.
This is,
1st button is 10w*20h bitmap.
2nd button is 10w*10h bitmap.
3rd button is 10w*10h bitmap.
Ofcource,The size of each button is also changed.- using CToolbarCtrl::SetButtonInfo
I want to modify one button's bittmap size on the toolbar.
please help me
|
|
|
|
|
look my profile , my ID is 33378
I want to change Myself..Can u help me? ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
waw Renjith, that's funny !!! lolllll
one time, i try such thing... i abandonned ;P
TOXCCT >>> GEII power
|
|
|
|
|
yeah..now i am in trouble, i can't even access my profile..
now i became an anonymous.;P
I want to change Myself..Can u help me? ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Try sending e-mail to webmaster@codeproject.com.
Software Zen: delete this;
|
|
|
|
|
lemme try..thank you
I want to change Myself..Can u help me? ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
I want to change Myself..
into what ?
|
|
|
|
|
Hey chris..
funny..i tried to add an image to my display name. Look my profile now...........
I want to change Myself..Can u help me? ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
should not do what you are not supposed to do ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
-----Everything is possible---
Many inputs -- one result >>> A BUG FREE WORLD..!!!!
I want to change Myself..Can u help me? ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
renjith_sree wrote:
-----Everything is possible---
yep, even stupidity.
|
|
|
|
|
Ya..please print it in your product's USER MANUAL also...
" Dont give any stupid input in any of your input fields.."
Enter Name ( mandratory - but not stupid inputs )
wahhh what an IDEA...!!!!!!
;P
I want to change Myself..Can u help me? ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
renjith_sree wrote:
Ya..please print it in your product's USER MANUAL also...
" Dont give any stupid input in any of your input fields.."
Enter Name ( mandratory - but not stupid inputs )
yeah that need to be printed somewhere in codeproject webpage and you should read that not twice, but 10 times everytime you login. ![Sigh | :sigh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_sigh.gif)
|
|
|
|
|
Mr.Prakash wrote:
yeah that need to be printed somewhere in codeproject webpage
if so it will be better to ask microsoft to rewrite their controls, ie, when focus is on , a SUDDEN messageBox "AVOID STUPID INPUTS".. well done prakash..thanks for your idea...!!!!
INVENTIONS..!!! -
I want to change Myself..Can u help me? ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
well your welcome,
but you know, microsoft comes with newer version of OS so that even the most moron of ppl can use the computer without having problems, but man nothing is foolproof.
|
|
|
|
|
ok. buy one and install on your computer...happy computing..!!
I want to change Myself..Can u help me? ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Actaully, its you who badly needs it, firstly not to put some image where you are supposed to put ur name, and secondly not to post problems related to ur stupidity in visual c++ forum.
|
|
|
|