|
-
Feb 26th, 2001, 09:40 PM
#1
Thread Starter
Junior Member
I know how to make message boxes and how to quit the program...but how do I make the program do different things?
 Forger
As in creator, not copier.
-
Feb 26th, 2001, 09:44 PM
#2
Frenzied Member
I think that wins the award for "most general question ever", congratulations.
You make the program do different things by using different code in different ways, so that users can take different actions.
Ask a silly question, get a silly answer
Harry.
"From one thing, know ten thousand things."
-
Feb 26th, 2001, 09:54 PM
#3
Thread Starter
Junior Member
-
Feb 26th, 2001, 10:40 PM
#4
Frenzied Member
Are you new to C/C++? If so you would be better off sticking to console apps for a while. If you're not new to it though, well it depends on whether you want to use MFC or just plain API.
I know how to create controls for Windows apps, but to be honest I don't take much more interet in it beyond that, I do almost all my stuff in DirectX. I'm sure someone else here will know the details though,
Harry.
"From one thing, know ten thousand things."
-
Feb 26th, 2001, 10:46 PM
#5
Thread Starter
Junior Member
-
Feb 27th, 2001, 06:45 AM
#6
Monday Morning Lunatic
If you look at the Platform SDK on MSDN Under User Interface->Windowing there's lots of info on different control types.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 27th, 2001, 04:30 PM
#7
Thread Starter
Junior Member
Sorry but I'm having a hell of a time finding it...can you show me a link when you have time?
 Forger
As in creator, not copier.
-
Feb 27th, 2001, 04:34 PM
#8
Monday Morning Lunatic
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 27th, 2001, 04:45 PM
#9
To change the caption of a label, send the WM_SETTEXT message.
Code:
SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) "MyText");
-
Feb 27th, 2001, 05:23 PM
#10
Thread Starter
Junior Member
-
Feb 27th, 2001, 05:26 PM
#11
Frenzied Member
Welcom to the C++ world.
Your not in VB anymore.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Feb 27th, 2001, 05:26 PM
#12
Monday Morning Lunatic
Yep. It does. However, you can use Resources, which are a great time-saver.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 27th, 2001, 05:28 PM
#13
Thread Starter
Junior Member
how would I make a resource file?
 Forger
As in creator, not copier.
-
Feb 27th, 2001, 05:33 PM
#14
Monday Morning Lunatic
Add new file, and choose Resource Script. However, you really need to get to grips with Windows' event handling model before you do. Also, the Platform SDK is a prerequisite for doing any serious Windows C++ stuff.
There's an example here: http://www.parksie.net/RawDlg.zip
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 27th, 2001, 05:44 PM
#15
Thread Starter
Junior Member
Is it possible to make my own class for the controls? Possibly add that to a header? Or should I start memorizing...
 Forger
As in creator, not copier.
-
Feb 27th, 2001, 05:46 PM
#16
Monday Morning Lunatic
You could if you really wanted to I am, but it's nowhere near finished.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 27th, 2001, 05:59 PM
#17
Thread Starter
Junior Member
the example on msdn shows how to animate a picture in the static control....can you show me how to just add text? (sorry about so many questions)
 Forger
As in creator, not copier.
-
Feb 27th, 2001, 07:05 PM
#18
Code:
SendMessage(hWnd_Of_Static, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) "MyText");
-
Feb 28th, 2001, 02:37 PM
#19
Monday Morning Lunatic
Megatron, if you're going to use LPCTSTR then you must surround the constant in _T():
Code:
SendMessage(hWnd_of_static, WM_SETTEXT, 0, (LPCTSTR)_T("MyText"));
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 28th, 2001, 06:20 PM
#20
Thread Starter
Junior Member
-
Feb 28th, 2001, 06:23 PM
#21
Frenzied Member
Originally posted by parksie
Megatron, if you're going to use LPCTSTR then you must surround the constant in _T():
Code:
SendMessage(hWnd_of_static, WM_SETTEXT, 0, (LPCTSTR)_T("MyText"));
Why the _T parksie? I have never had to use it before.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Feb 28th, 2001, 06:30 PM
#22
Monday Morning Lunatic
It's all to do with Unicode. For example, you have the following code:
Code:
TCHAR *pStr = _T("Hello!");
Normally, it would resolve to:
Code:
char *pStr = "Hello!";
...but if you define Unicode:
Code:
#define UNICODE
wchar_t *pStr = L"Hello!";
The L"Hello!" bit tells the compiler to allocate 2 bytes per character.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 28th, 2001, 06:30 PM
#23
Frenzied Member
I think it converts the string to Unicode, if it isn't already Unicode.
Harry.
"From one thing, know ten thousand things."
-
Feb 28th, 2001, 06:32 PM
#24
Thread Starter
Junior Member
Megatrons worked for me
 Forger
As in creator, not copier.
-
Feb 28th, 2001, 06:33 PM
#25
Frenzied Member
Learn something new every day
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Feb 28th, 2001, 06:34 PM
#26
Frenzied Member
Seems I was right 
So, Parksie, TCHAR is either char or wchar_t depending on whether you've #defined your code as being Unicode?
Also, I've never seen syntax like L"Hello!" before... anything else like that in C/C++? Anything not used with strings?
Harry.
"From one thing, know ten thousand things."
-
Feb 28th, 2001, 06:35 PM
#27
Monday Morning Lunatic
That's because the definitions change:
Generic: LPCTSTR == const TCHAR*
Normal: LPCTSTR == const char*
Unicode: LPCTSTR == const wchar_t*
So normally, you can mix-n-match and it will all work...however as soon as you define UNICODE, it all messes up
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 28th, 2001, 06:37 PM
#28
Monday Morning Lunatic
Originally posted by HarryW
So, Parksie, TCHAR is either char or wchar_t depending on whether you've #defined your code as being Unicode?
Also, I've never seen syntax like L"Hello!" before... anything else like that in C/C++? Anything not used with strings?
You're right on the TCHAR thing. You can take advantage of this with the STL by replacing string with basic_string<TCHAR>.
I don't recognise where the syntax comes from, either. It's slightly strange but I think it may be VC++ only...anyone with a different compiler got any info?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Mar 6th, 2001, 06:26 AM
#29
Hyperactive Member
Adding Resources
Hey all,
OK, I've read all the posts on this page, several times, and I got 1 main question. How do I add a resource to a Win32 program. I'm guessing that you just add it, design it, and then use the #include statement, but I could be wrong. Umm, what's the general standard, and if so, do I receive messages from it, the same as I would already do?? Also, does this mean that I have to include any DLL's?? If so which one's. Greatly appreciated all the help. Thanx
Visual Basic 6.0 Enterprise
Visual C++ 6.0 Professional
Wak 
-
Mar 6th, 2001, 09:30 AM
#30
Frenzied Member
If you check my other thread (Menus(API)), Parksie explains how to use resource files.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|