Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1317
  • Last Modified:

How to send WM_HSCROLL message

In a simple dialog application how to send WM_HSCROLL message to change the position of the slider THUMBPOSITION and cause a WM_HSCROLL event.

I can simply control the CSlider directly but it doe not cause the ON_WM_HSCROLL message to be received.
0
hansw77041
Asked:
hansw77041
  • 6
  • 6
2 Solutions
 
evilrixSenior Software Engineer (Avast)Commented:
If you are just looking to raise a Windows message you can send one to your window using either:

SendMessage
http://msdn.microsoft.com/en-us/library/ms644950.aspx

PostMessage
http://msdn.microsoft.com/en-us/library/ms644944.aspx

Does this help? If not can you be a little more specific about your requirement?
0
 
hansw77041Author Commented:
I need to set the CSlider THUMBPOSITION from wthin my code.
That means the code needs to mimic the action of moving the slider.  
Simply sending or posting a message does not do the trick.

Here is what I got so far:

      SCROLLINFO info;
      m_cSlider1.GetScrollInfo( SB_HORZ, &info, SIF_ALL);
      info.nPos = NewThumbPos;

      m_cSlider1.SetScrollInfo( SB_HORZ, &info, TRUE);

 How does  PostMessage()  send the info to the Slider ?
   

0
 
hansw77041Author Commented:
OK I answered my own question:

PostMessage( WM_HSCROLL, (NewThumbPos << 16) + SB_THUMBTRACK, (long)m_cSlider1.m_hWnd);

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
evilrixSenior Software Engineer (Avast)Commented:
Objection: I gave the answer to the original question here {http:#24267557} A follow up question was then posted but before I was able to answer it the asker found their own answer but it is basically using the solution I suggested.
0
 
hansw77041Author Commented:
That's not correct.  
I did not ask what function is used to post or send messages ! (which was your answer)
I asked how to send a message to cause WM_HSCROLL event.

I posted thew correct answer
PostMessage( WM_HSCROLL, (NewThumbPos << 16) + SB_THUMBTRACK, (long)m_cSlider1.m_hWnd);

Whereas your links took me to PostMessage() and SensMessage() ..... Which I am totally familiar with.
Had you stated that the WPARAM needed to be shifted left and that the LPARAM needed to be the m_hWnd of the control then you would have answered the question.
0
 
evilrixSenior Software Engineer (Avast)Commented:
>> I asked how to send a message to cause WM_HSCROLL event
And I said, use either SendMessage or PostMessage, which you've done. You made no mention of the fact in the question that you were looking for help using PostMessage specifically, therefore I answered your question as it was stated. It would have helped if you'd stated specifically you were trying to use PostMessage or had tried to use it but couldn't figure out how, then I could have provided a more specific response (hence I stated in my answer, "Does this help? If not can you be a little more specific about your requirement?".

You then posted a follow-up for additional info but before I had an opportunity to assist you with your follow-up question you discovered your own answer.

Since there is nothing in the original question to indicate you had already considered using PostMessage, there is no way to know, subsequently, that my first answer wasn't what lead you to finding your solution and since it does answer the original question I see no valid reason to not accept my original (and I'd suggest also your follow-up answer) and the 2 answers that solve this problem. In other words, the equivalent of a points split (which is how this would probably be closed you both answers from experts).

Note for moderators, it is my opinion this Q should be closed as follows:

{http:#24267557} Assisted
{http:#24271690} Accepted

0
 
hansw77041Author Commented:
I did follow up with the question:

"How does  PostMessage()  send the info to the Slider ? "

So you think I'm supposed to standby and  wait for 8 hours before you to follow up...... NO and Hxll NO.

I found the solution 3 hours later.  

If it had been a different person that supplied the answer to the follow up question would you also have complained then ?

Remember multiple "experts" can reply and the first correct answer gets the bacon.

I find the correct answer, so it is within my rights to post it and accept it as a solution.

I'm on a yearly subscription so points mean nothing to me, however principle does.








0
 
evilrixSenior Software Engineer (Avast)Commented:
>> So you think I'm supposed to standby and  wait for 8 hours before you to follow up
I'm sorry I didn't response promptly but I do have a day job too!

Had your original Q asked for help using PostMessage your point would be valid, but since it didn't I have no way to know that my original post (which was not incorrect) wasn't what lead you to the answer. Had the answers been given by multiple experts then the correct thing to do (given the way the original Q was worded) would be to split the points.

>> I'm on a yearly subscription so points mean nothing to me, however principle does.
It may surprise you but they don't mean anything to me either... [a] I have more than enough and [b] assisting someone is what motivates me. Do feel free to check my answer history to see this is true. Feel free to start with this post to CS by me...

http://www.experts-exchange.com/Community_Support/General/Q_24366821.html
0
 
evilrixSenior Software Engineer (Avast)Commented:
BTW: at this point I don't really have anything else to add... it is up to the moderators to decide and I will be happy to accept whatever they decide.
0
 
hansw77041Author Commented:
OK I'll start the "self-close process" by canceling my subscription.
0
 
evilrixSenior Software Engineer (Avast)Commented:
Thanks Vee_Mod. It's all good here :)
0
 
hansw77041Author Commented:
I did NOT grade this as excellent.

The fact is I answered the question myself.

hansw
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now