|
Handle the WM_ERASEBKGND message sent the view.
the wParam will contain an HDC if you are programming with the SDK, or the OnEraseBkGnd function will have an HDC that you should use to paint on.
You will be able to use any format that you can find or write code to load into an HBITMAP object. Try searching this site, there are a number of utilities to help with image loading.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
suppose i begin two threads in my process by _beginthread(),now i wanna terminate one thread from another,how shall i?(i dont wanna use MFC)
thanks
It's a good day today
|
|
|
|
|
How are you synchronizing between your two threads?
I would create an event and have the second thread periodically check for that event to be set, then terminate itself with a call to _endthread .
Or if you have a MessagePump, you could also send a message to that thread informing it that it should shut down. In order to send a message to another thread you need to use PostThreadMessage .
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks.
In fact i am writting for my homework--transfer files by TFTP protocol.The two threads,one is used to receive data packet,the other serves as a timer.If the first thread has been waiting for too long a time,the 2nd shall timeout and abort the first one.So will event still work in this case?Because before data packet arrives,the first one just stop there,waiting;so it perhaps can not periodically check messages.
The other problem is that i write my program in C,but i notice that PostThreadMessage is a method of a class CWinThread.Are there other ways?
God blessing me...
|
|
|
|
|
Look again at your documentation: there's a C only version of PostThreadMessage (the MFC is merely a wrapper around this.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi.
I have a dialog box. When Windows draws the dialog box, I want to to focus to a specific CEdit object (window). For example, let say the dialog box asks the user for a username and password. I would like Windows to focus the username window when it first draws the dialog box.
What is the best way to do that?
Thanks,
Kuphryn
|
|
|
|
|
use SetFocus() in OnInitDialog() , and return FALSE .
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
If you don't want to set focus programatically (i.e. if the edit control will always have focus), just set it to be first in the dialog's tab order.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks.
I presume the coding technique applies to modal dialog box and modeless dialog box.
Kuphryn
|
|
|
|
|
Thanks.
I saw at least two responses about overriding OnInitDialog().
Here is the solution:
...OnInitDialog()
{
...
GetDlgItem(the CEdit window's ID)->SetFocus();
...
return FALSE;
}
Kuphryn
|
|
|
|
|
I've read an article but this use a ReBar so i don't need that the rebar to be docckable, i need only the toolbars, and controlbars, does anybodi know how?
|
|
|
|
|
Hi all,
I have a question on closing window. I have obtained a third party dll that pops up a window at the end of using it. Therefore, I would like to know how to write a program that uses this dll, and kill that popup window automatically without any user input.
Thanks,
Sunny
|
|
|
|
|
MyWindow.DestroyWindow();
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
|
|
|
|
|
Have you tried sending it WM_CLOSE ? Otherwise, DestroyWindow() should do it.
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
LPNMTREEVIEW itemOld
Is there a command within MFC to obtain the Old Item from the WM_NOTIFY message.
GetSelectedItem provides the New Item, is there an equivalent for the Old Item.
Sara
|
|
|
|
|
??? It is given as a member of the NMTREEVIEW structure for those messages that use it. This structure is passed to your notification handler in MFC; you just need to cast the NMHDR ptr to it.
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
Hey, I know some of what these are... but i dont know all of what they are... "if you know what i mean" "I get the basics, i got a slight glimps, but not the full picture"
Here are the questions:
1. #Define : Why do i use this, and how in an example.
2. #ifndef : what the heck is this "I have no idea what this is"
3. callback : No idea
4. hwnd : somthing with windows what does h mean in front of it?
5 what version of Microsoft Visual C++ 6.0 do i have? Borland? or that other one? kindof confused.
6. I got the book Tricks of the Windows Game Programming Gurus, what does the word Gurus mean?
Thanks for your help!
|
|
|
|
|
Anonymous wrote:
1. #Define : Why do i use this, and how in an example.
Ex. #define NAME "Jack"
This is to tell the preprocessor to change all occurances of NAME to "Jack" so you can now use NAME anywhere in your code and the preprocessor will replace it with "Jack" before compiling. This makes it easy to change your name throughout all of your code if you set it up this way in the beginning.
Anonymous wrote:
2. #ifndef : what the heck is this "I have no idea what this is"
#ifndef NAME
#define NAME "Jack"
#endif
This means if not defined and is kind of self explanatory. You can also use #ifdef.
Anonymous wrote:
3. callback : No idea
A callback function is a function that gets passed to another function which then calls the callback function when it has some useful data. Callbacks are used in some Windows API functions such as EnumWindows()
Anonymous wrote:
4. hwnd : somthing with windows what does h mean in front of it?
An HWND is a handle to a window (so the H means handle).
Anonymous wrote:
5 what version of Microsoft Visual C++ 6.0 do i have? Borland? or that other one? kindof confused.
Borland is a different company than Microsoft and they make a totally different compiler. If you say you have MS VC++ 6.0 then that is what you have.
Anonymous wrote:
6. I got the book Tricks of the Windows Game Programming Gurus, what does the word Gurus mean?
guru - n. [Unix] An expert. Implies not only wizard skill but also a history of being a knowledge resource for others. Less often, used (with a qualifier) for other experts on other systems, as in `VMS guru'. See source of all good bits.
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
Thanks for the help! I getting a better grasp on c++ every day...
I ment to ask this in the last post, but forgot... what does
Inline do... and how does it do it...
Thanks!
|
|
|
|
|
inline is a *suggestion* to the compiler that it write the function in place when it writes the code, so that the overhead of a function call is no longer present. The compiler is free to ignore it, and will ignore anything but the simplest of functions, which it may inline without the suggestion.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
|
|
|
|
|
So, using the inline function:
inline int name
is that how i would use it?
Thanks!
|
|
|
|
|
inline int GetScore()
{
return score;
}
every where you call GetScore() in your program, it will place the code inside of the brackets where you call the function instead of calling the function. This will save you the time of all of the setup work that is required when you call a function. Typically you only use inline for very simple functions.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hello!
Has anyone used OleSavePictureFile? Any sample code about this function?
Thanks!
marcela bovio
|
|
|
|
|
I am looking for some good examples showing how to handle the MS Mediaplayer events( buffering, playing, etc) using VC6 and ATL. All the examples I can find concentrate on handling the events from HTML. Any help is appreciated. thanks in advance
|
|
|
|
|
Hey...say I want to make a window be hidden, as I show another window...
I figure I have to SendMEssage to the window's handle...what's the parameter I have to send using SendMessage to make the window hide or disappear? Thanks =) - Dave
|
|
|
|