Solved

Windows Message for F5

Posted on 1998-03-10
16
574 Views
Last Modified: 2012-05-04
What message is windows sending when the user hits F5 to update the desktop in WIN95?
0
Comment
Question by:SGC
  • 6
  • 4
  • 3
  • +3
16 Comments
 
LVL 8

Expert Comment

by:mrmick
ID: 1458813
The WM_KeyDown message indicating that the F5 Key was pressed.

0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1458814
I think he mean what message Windows95 sends IN ORDER to update the desktop
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1458815
MikeP, the desktop window procedure performs the update when the WM_KEYDOWN key specifying that the F5 key was pressed is received.  There are no special "messages" by design to cause this to happen.

0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 2

Author Comment

by:SGC
ID: 1458816
I understand that much, but Windows certainly must use some sort of function or message to inform the desktop to update itself, otherwise just pressing F5 would do nothing.
The reason I asked the question is because I can't seem to get the desktop to update itself by...
1) Obtaining the desktop handle using GetDesktopWindow
2) Giving the Desktop focus with SetFocusAPI
3) Setting the Desktop as the active Window with SetActiveWindow
4) Sending the WM_KEYDOWN with KEY_F5 with SendMessage(xx,WM_KEYDOWN,KEY_F5,&H18) to the Desktop (xx being the desktop handle)

This does not work, which is why I wanted to know what the message is. I've tried everything I can think of...including simulating mouse clicks on the desktop and telling the desktop with WM_ACTIVATE and WA_ACTIVE that it is in fact the active window.

Let me know if I'm doing something wrong, or rather, what I'm doing wrong.
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1458817
Well, I am a bit frustrated at this point because I did provide the correct answer to your question.  Apps written in C under the Windows OS respond to different messages (known as events in VB).  I used Microsoft Spy++ to learn the message that caused the desktop to update... so I'm certain that the WM_KeyDown message with Key_F5 is the message that initiates the refresh.

I now understand that it doesn't solve you're problem and I certainly don't wish to see anyone through away points; however, I'm bothered that you didn't spell out the problem the first time.  How do I know that if I take the time to play with this and find your answer that there are other details I don't know about that would make you reject a solution to the "current" problem.

0
 
LVL 2

Expert Comment

by:chris_a
ID: 1458818
I guess you want to get the desktop to redraw, look at sending an InvalidateRect (Win32 API) to NULL, to tell windows that all the windows need refreshing.
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1458819
Good answer chris_a, I would expect that to satisfy SGC's newly described problem.
0
 
LVL 2

Author Comment

by:SGC
ID: 1458820
mrmick...you did not provide the correct answer to the question, you merely provided me with something extremely obvious in the hopes that I would give you 100 points!
Of course Windows is going to recieve a WM_KEYDOWN when the users hits F5, as they would if they hit F1 or F2, which, as I'm sure you're aware achieve very different results. My question was phrased quite logically...MikeP seemed to understand what I was talking about, as did chris_a.
I came to this board to ask a simple question and instead, you treat me as a newbie who asked how to play a sound. I do not appreciate the attitude you take with your responses, and I'm sure there are others who feel the same way. Just because you rank number one in the experts list does not mean that you know all. Get used to it.
0
 
LVL 2

Author Comment

by:SGC
ID: 1458821
By the way, thanks Chris_a
0
 
LVL 2

Accepted Solution

by:
chris_a earned 100 total points
ID: 1458822
Do I get some points then (my first) !

0
 
LVL 8

Expert Comment

by:mrmick
ID: 1458823
That's fine SGC but I don’t claim to be an expert at reading minds and FYI - there isn't a "special message" just for updating the desktop as you and perhaps MikeP seem to think.  I though your question was quite clear and I find it rather funny that you would accuse me of treating you like a "newbie" for not seeing that when you ask: "What message is windows sending when the user hits F5 to update the desktop in WIN95?"...  I should have guessed right off that the correct response would be: "InvalidateRect (Win32 API)".  Do you suppose the "F5" Key automatically invokes the InvalidRect Function?

I stated that I didn't expect you to through away points and I do not want these points.  The answer I posted may have seemed "extremely obvious" to you in hindsight, but if that’s the way you feel, I think you might consider how "extremely obvious" it is that the answer was the correct and only answer to the question you posed - before you changed the question that is.  My beef is that you chose how and what you were asking and after getting the answer... you changed the question.

If you wish to continue this discussion, you may email me at mick@owen.wa.com

0
 
LVL 8

Expert Comment

by:mrmick
ID: 1458824
I don't know... that was a little harsh.  Sorry.  I don't have a problem with you.  I don't wish to cause you undue grief over a pet peeve of mine.

By the way, I can't return to review comments after you've accepted chris_a's answer so if you wish to communicate with me after grading chris_a's answer - it will have to be through email.



0
 

Expert Comment

by:LMSuporte
ID: 1458825
well, I have some source code that changes the desktop color and/or wallpaper and then refreshs itself. If you only change the registry to do such things the desktop will not refresh itself, but with the functions from these project it will do it. If you want to, I will send you the source code , or post it here ( no points needed)

0
 
LVL 2

Expert Comment

by:chris_a
ID: 1458826
LMSuporte, do you mean using the SystemParametersInfo API call?
0
 
LVL 2

Author Comment

by:SGC
ID: 1458827
Thanks guys.

.
0
 

Expert Comment

by:Saimon
ID: 7420438
How do you declare the InvalidRect function? I mean, in what library is it? I can't find it.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question