|
Ok im going to sound like an idiot asking this... But im having trouble figuring this out.. I'm trying to get it when i click "Button A" It will some words in "Text Box A" Yea im a newb i look like a newb i feel like a newb! Just someone help me please!
|
|
|
|
|
DarkRaven41 wrote:
Ok im going to sound like an idiot asking this... But im having trouble figuring this out.. I'm trying to get it when i click "Button A" It will some words in "Text Box A" Yea im a newb i look like a newb i feel like a newb! Just someone help me please!
Give control IDs to your button and edit box. Then handle the BN_CLICK event for your button and add a variable of the CString type to your edit box. Then in your button's BN_CLICK event handler function type something like (assuming "m_strText" is the name of the variable you added to your edit box):
m_strText = "Yea im a newb i look like a newb i feel like a newb!";
UpdateData(FALSE); // Update the UI.
That should do it. Good luck in your programming efforts!
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
Like i said i am a NEWB! i got most of what you said but its still not working... I know im doing it wrong and thats why can you maybe explain it a little better? Thanks for your time!
|
|
|
|
|
Ok. Let me try explaining from the begining step by step.
1. Create an MFC project using the Dialog application type (I assume that is what you are doing).
2. Add a Edit Box and a Button from the Toolbox to your Dialogbox.
3. Using the Property window, change the Edit Box's ID to IDC_MESSAGE and the Button's ID to IDC_MESSAGE_BTN.
4. Using the Property window, change the Button's Caption to "Show Message".
5. Right-click on the Edit Box and click "Add Variable...". Change the Category to "Value" and then the Variable Type to "CString". Name the variable "m_strMessage". Click the Finish button. You will be directed to the code view. Go back to the dialog editor.
6. Right-click on the Button control (the one you renamed earlier) and click "Add Event Handler...". Make sure the Message Type is "BN_CLICKED" and click the "Add and Edit" button.
7. Delete the comment (the line beginning with the "//") and type in its place:
m_strMessage = "Hello World! I am a beginner in Visual C++ .NET!";
UpdateData(FALSE); // Updates the controls.
8. Compile and run the program. It should work. Enjoy!
If you are interested, you could go to Amazon.com and buy the book: Sams Teach Yourself Visual C++.NET in 21 Days (2nd Edition), ISBN- 0672321971, URL-http://www.amazon.com/exec/obidos/tg/detail/-/0672321971/qid=1086480839/sr=1-1/ref=sr_1_1/102-3025056-5268100?v=glance&s=books[^]
It will help you from a beginner level to knowing your way around the environment pretty well. Hope this helps.
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
First you'll need a CEdit control variable (e.g., m_edit ). Then in the handler for the button, just make a call to m_edit.SetWindowText("some text") .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
I'm a newbie C++ programmer, and I'm wondering one thing: How do I use optional parameters in my methods?
|
|
|
|
|
well, if you mean this:
void function1 (a=0)
{
cout >> a;
}
if you call the function this way:
function1;
the result is that 0 will be printed
if you call the function this way:
function1(9);
the result is that 9 will be printed
|
|
|
|
|
|
Yeah, I knew it wasn't to hard Just had some trouble finding it. Thanks!
|
|
|
|
|
when i statically link the MFC libarary
i get this warning when i go to build the release
LINK : warning LNK4089: all references to "SHELL32.dll" discarded by /OPT:REF
what can i do about this?
|
|
|
|
|
There is nothing to do.
- Linker told to link to shell32.dll.
- Linker told not to link to modules where no functions are being used.
- Linker found that module being compiled does not use any functions from shell32.dll.
- Linker telling you this.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Go to the command line linker options and add /IGNORE:4089. (This warning is purely informational. Ignoring it causes no problems.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
How would one convert a float to an int without rounding it? Currently:
float f = 1.9;
int i = (int)f;
i would equal 2. How do I get it to not round, and have i equal 1 in the above example? Any help is appreciated.
-Dev578
|
|
|
|
|
As defined by the C++ standard, floating to integer conversions truncate. So 1.9 would convert to 1.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
int i = (int)(f + 0.5);
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
You expression rounds, which I think is the opposite of what he wants, which is simple truncation.
Software Zen: delete this;
|
|
|
|
|
i would not equal 2. Simple 'C'-style casts truncate, so you will see i == 1 .
Software Zen: delete this;
|
|
|
|
|
Ok, i cannot get of this stupid error
Process ViewerDlg.cpp(151) : error C2664: 'EnumWindows' : cannot convert parameter 1 from 'int (struct HWND__ *,long)' to 'int (__stdcall *)(struct HWND__ *,long)'
None of the functions with this name in scope match the target type
Line 151: EnumWindows( GetWindows, 0 );
and my definition of GetWindows
BOOL CALLBACK GetWindows( HWND hwnd, LPARAM lParam );
Note: this is an MFC project
|
|
|
|
|
sure about that CALLBACK part? It provides exactly the __stdcall part the compiler is missing. Search your project for other occurences / definitions of GetWindows
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
its not the GetWindows name, i even tried renaming the function
and i dont know what to do about the CALLBACK do you?
|
|
|
|
|
Sorry, I meant: please double check that the "CALLBACK actually is there.
What platform are you compiling for? Win32 / Intel?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
ohh, yes, the CALLBACK is there,
i even tried replacing CALLBACK with __stdcall
i have never had any problems using EnumWindows outside of MFC projects,
if it comes down to it i may just use GetTopWindow()
and GetNextWindow();
although i really prefer not too
|
|
|
|
|
Do you use the CALLBACK function as a member-function of your dialog class?
In case you do, take a look at this article
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
This worked fine for me:
BOOL CALLBACK GetWindows( HWND, LPARAM )
{
return 0;
}
BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
EnumWindows(GetWindows, 0);
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
I've been trying desperately integrating the new compiler into the VC++ 6.0 IDE. I put the directories (bin, include and lib) of the toolkit at top of the list and the new compiler compiles
But now I get either linker errors (LNK2001, over 300 times...) for all the STL-Stuff or - if i change the order of the directories - get over 1000 compiler errors in the header files of the toolkit.
has anybody successfully integrated the toolkit to vc6 or knows good links about this topic (i searched the web but didn't manage to find something useful)
|
|
|
|