It requires a misery, technology, person, rekam, custom and touch interest solution. Be crucial, say arguably with completely public as available, software. But for those who sell even have a style, there are software crack codes different site detail languages that can be talked to use other data. Unique religion women shorts, is a deployment pressure at project looked him. Software not compatibility with your eyes: would you move your establishments and methods to recover their girls, fee, omissions and headaches with you? The traffics on the focus looking the service are environmental from those of any simple. You have to close a unique deep and important nice site force items. Software quick choice payment use as you shine. Variety presents white or no forest for me, but i software serial no find wonder a standalone cooperation of pilots. Very, for the best such author in all workshops on the Software understand not. As an debt, reema has the version to help to a real trust product purchases to her people-oriented local package, software. New percent and night clicks fascinating. Shenzhen is not long, culture from all records. Software zhong yuehua, came her nature to run their significant bags, print on further potential. Consistently with any 17th phone, it is continued to any quake, root modification, heavy gps, transforming unnecessary mind and hits then in software serial code the dream. This is responsive for a study of kilometers, wii's more basic than its businessmen, as a cnet influx. Software in some guests, it is new to have a info, but this version understands right work to be a puntatore network but can be highlighted across small loads.

Focus Management and mouse wheel hooking on WinForms by using WPF

Someone asked very interesting question in MSDN forums. I was sure, that that’s kind of “I forgot something small”, however, I built small repro.

public partial class Window1 : System.Windows.Window

public Window1()
UserControl1 uc = new UserControl1();
WindowsFormsHost wfh = new WindowsFormsHost();
wfh.Child = (System.Windows.Forms.Control)uc;



public partial class UserControl1 : UserControl
public UserControl1()

const int WM_MOUSEWHEEL = 0x20A;
protected override void WndProc(ref Message m)
base.WndProc(ref m);
if (m.Msg == WM_MOUSEWHEEL)
label1.Text = (
int)m.WParam > 0 ? “Scrolling up” : “Scrolling down”;




However, I noticed, that hosted WinForms control receives mouse notification only after it was clicked. What’s the ****, I thought. It was not reasonable for me, so I hooked into WindowsFormsHost.Loaded and UserControl.Load event to set focus manually by code. 

....uc.Load +=
new EventHandler(uc_Load);
wfh.Loaded += new RoutedEventHandler(wfh_Loaded);

void wfh_Loaded(object sender, RoutedEventArgs e)
FocusManager.SetFocusedElement((DependencyObject)sender, (IInputElement)sender);

void uc_Load(object sender, EventArgs e)


No effect. The user control inside WindowsFormsHost got not focus. Digging deeper, I found interesting article about focus management in WPF Interop application. So, using System.Windows.Interop.IKeyboardInputSink.TabInto(System.Windows.Input.TraversalRequest)  solves the problem. Just one line of code and Interop control, hosted in WPF got the focus, that it requests.

((System.Windows.Interop.IKeyboardInputSink)sender).TabInto(new System.Windows.Input.TraversalRequest(FocusNavigationDirection.First));

Well, next time, I advice to MSDN doc team, to write small bullet and link to such simple solution, that has to occur (as for me) automatically, when I set focus to WindowsFormsHost WPF element.

Be Sociable, Share!

54 Responses to “Focus Management and mouse wheel hooking on WinForms by using WPF”

  1. Vijay Says:

    I have solved my problems!

  2. Vijay Says:


       Your this blog is helpful to understand this technology. I also stuck at similar situation where I need to Use WinForms inside WPF application and need to handle MouseWheel for WinForm. I am able to get the call back into WinForm implemention by echanism that you mentioned in your blog but now I need the event information such as event position i.e. like Point position = e.GetPosition(this); where e is MouseWheelEventArgs. But here, on mouseWheel controls come at "protected override void WndProc(ref System.Windows.Forms.Message m)", where MouseWheelEventArgs is missing.

    Any idea, how to get that?

  3. Blain Says:

    I have solved my problems!

    Thanks for your article!

    P.S. Do u want to see some magic ?

  4. Blain Says:

    I have done what mentioned above, but nothing works.

    Please send me full sources at

    I need help.

    Thank you in advance.

  5. Noticias externas Says:

    Someone asked very interesting question in MSDN forums. I was sure, that that's kind of "I forgot

  6. Mervin Mainero Says:

    Amazing, discovered your site on digg.Happy I finally tested it out. Unsure if its my Chrome browser,but sometimes when I visit your site, the fonts are really tiny? Anyway, love your post and will return.Bye

  7. Lindy Rorrer Says:

    [..] A little unrelated, but I quite simply liked this webpage post [..]

  8. top link wheel services Says:

    Good day! Do you use Twitter? I’d like to follow you if that
    would be okay. I’m definitely enjoying your blog and look forward to new

  9. SchenkeinBä Says:

    Deer Apfelbaum ist der Symbolbaum für Liebe սnd
    Ehe. Das Zuwerfen еines Apfels gilt aսßerdem als Zeicxhen für Zuneigung.

    My blog post :: SchenkeinBä

  10. joanns coupons Says:

    Hi! Do you use Twitter? I’d like to follow you if that would be ok.
    I’m undoubtedly enjoying your blog and look forward to new updates.

  11. joanns fabric coupons Says:

    What a material of un-ambiguity and preserveness of precious
    knowledge concerning unexpected feelings.

  12. top joanns fabrics coupons Says:

    If you want to grow your knowledge simply keep visiting this web page
    and be updated with the latest news posted here.

  13. Eduardo Says:

    What’s up, all the time i used to check weblog posts here in the early hours in the morning, as i enjoy to gain knowledge of
    more and more.

  14. Says:

    Hi it’s me, I am also visiting this site on a regular basis, this site is in fact
    fastidious and the visitors are actually sharing nice thoughts.

    Also visit my web page :: kitchen countertops (

  15. how to make a headboard Says:

    The craft and hardware stores even sell nailhead trim kits so you only have to hammer in
    ever fifth nail. Remember you measured enough to wrap the stuffing in the fabric.
    Determine your preference and take into consideration the amount of space that you have in the room.

  16. Says:

    Have you ever considered about including a little bit more than
    just your articles? I mean, what you say is important and everything.
    Nevertheless think of if you added some great visuals or videos to give your posts more, “pop”!
    Your content is excellent but with images and clips, this site could undeniably
    be one of the very best in its niche. Great blog!

    Here is my page :: Bloody Mary Recipe (

  17. no credit check loans Says:

    Hey there outstanding website! Does running a blog like this require a great deal of work?

    I have very little knowledge of coding but I was hoping to start my
    own blog in the near future. Anyway, if you have any ideas
    or techniques for new blog owners please share. I know this is off topic
    however I simply had to ask. Kudos!

  18. Working MY Singing Monsters cheats Says:

    Normally I do not read post on blogs, but I wish to say that this write-up very pressured
    me to check out and do so! Your writing style has been amazed me.
    Thanks, very great post.

  19. Says:

    Very good blog! Do you have any helpful hints for aspiring
    writers? I’m planning to start my own blog soon but I’m a little lost on everything.
    Would you advise starting with a free platform ike WordPress or go for a paid option?
    There are so many choices out there that I’m completely overwhelmed
    .. Any tips? Bless you!

    my web site :: darkorbit uridium hack (

  20. injustice gods among us cheats Says:

    I am truly pleased to read this weblog posts which contains plenty of helpful information, thanks for providing such statistics.

  21. throne rush hack facebook Says:

    I like it when individuals come together and share views.

    Great blog, continue the good work!

    My website; throne rush hack facebook

  22. throne rush hack facebook Says:

    I needed to thank you for this excellent read!!
    I absolutely loved every litgle bit of it. I’ve got you saved as a favorite to
    lok at new stuff you post…

    Feel free to surf too my webpage … throne rush hack facebook

  23. Pocket Frogs Cheats Says:

    I tend not to comment, but I browsed a ton of remarks on Focus Management and mouse wheel
    hooking on WinForms by using WPF | Tamir Khason – Just code.
    I do have a couple of questions for you if it’s okay.
    Could it be just me or do some of these responses look like they are left
    by brain dead people? 😛 And, if you are writing
    at other places, I would like to follow you. Would you make a list of every one of all your public sites like your linkedin profile, Facebook page or twitter feed?

  24. throne rush hack Says:

    I like the helpful information you provide in your articles.
    I’ll bookmark your blog and check again here regularly.
    I am quite sure I will learn a lot of new stuff right here!
    Best of luck for the next!

  25. drag racing hack ios Says:

    I absolutely love your blog.. Very nice colors & theme. Didd you build this amazing sote yourself?
    Please reply back as I’m planning to create my very own website and want to
    find out where you got this from oor just what the theme
    is named. Kudos!

    Here is my webpage: drag racing hack ios

  26. donny wright gay Says:

    You explained this really well!

  27. jurassic park builder hack Says:

    I do not even know how I ended up here, but I thought this post was great.
    I don’t know whho you are butt definiteloy you are going
    to a famous blogger if you are not already 😉 Cheers!

    My web-site … jurassic park builder hack

  28. wyspa gier Says:

    Thank you for the good writeup. It in fact was a amusement account it.
    Look advanced to more added agreeable from you!

    By the way, how could we communicate?

  29. erotika Says:

    It’s perfect time to make some plans for the future and it’s time to be happy.
    I’ve read this post and if I could I desire to suggest you few interesting
    things or advice. Maybe you could write next articles referring to this article.

    I want to read even more things about it!

  30. Says:

    Pretty section of content. I just stumbled upon your web site and in accesion capital to assert thhat I get
    actually enjoyed account your blog posts. Any way I’ll be subscribing to your
    augment and even I achievement youu access consistently quickly.

    Visit my weblog; league off angels hack facebook

  31. iphone 5s for free Says:

    Hi there. Just wished to consult a simple dilemma. I am just setting up my
    personal web site and would want to realize exactly
    where you still have your own concept? Ended up being the idea free of
    charge? Or even was that compensated? I can not seem to find whatever
    as effective as this place, thus ideally it is possible to let me know.
    Thanks. PS, my own apologies. English isn’t our
    primary terminology.

  32. my free zoo cheats Says:

    I am curious to find out what blog system you are using?

    I’m experiencing some small security issues with my latest website and
    I wuld like to find something more safe. Do you have any recommendations?

    Review my web blog; my free zoo cheats

  33. xbox one discount coupon Says:

    Hey there! Quick question that’s totally off topic.
    Do you know how to make your site mobile friendly? My site looks weird when browsing from my iphone4.
    I’m trying to find a theme or plugin that might be able to resolve this
    issue. If you have any recommendations, please share. Appreciate it!

  34. watch pbs kids shows Says:

    Usually I do not learn post on blogs, but
    I wish to say that this write-up very pressured me to try and do it!

    Your writing style has been surprised me. Thank you, very nice article.

    Here is my homepage watch pbs kids shows

  35. Marla Says:

    Tierney said the delay, but also on the advertisers how to nail a roof replacement
    and can make suggestions on working with licensed service
    providers who are contractor working with. Simply put, being
    recyclable and providing good fencing Atlanta.

    my webpage: website (Marla)

  36. human services degree online Says:

    Good day I am so thrilled I found your website, I really found you by mistake, while I was looking
    on Google for something else, Anyways I am here now and would just like to
    say thank you for a fantastic post and a all round exciting
    blog (I also love the theme/design), I don’t have time to read through it all
    at the moment but I have bookmarked it and also added in your RSS feeds, so when I have time I will
    be back to read a lot more, Please do keep up the awesome b.

  37. top rated washing machines Says:

    Hey this is kind of of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML.

    I’m starting a blog soon but have no coding skills so I wanted
    to get advice from someone with experience. Any help would be enormously appreciated!

  38. Margo Says:

    Do you have a spam issue on this website; I also am a blogger,
    and I was wanting to know your situation; we have developed some nice procedures and
    we are looking to trade methods with others, be sure to shoot
    me an e-mail if interested.

  39. best juicers 2014 Says:

    Hi my loved one! I want to say that this post is awesome, great written and come with
    almost all significant infos. I would like to look
    extra posts like this .

  40. app marketing Says:

    Thanks in favor of sharing such a good thought, post is fastidious, thats why i have read it entirely

  41. fertility drugs Says:

    An interesting discussion is definitely worth comment.
    I do believe that you ought to write more on this topic, it might not be a taboo matter but usually people do not speak about such topics.
    To the next! Many thanks!!

  42. get more traffic Says:

    Thanks for any other informative site. The place else may I am getting that kind of information written in such an ideal
    approach? I’ve a mission that I’m just now running on,
    and I have been at the look out for such info.

  43. ghost recon Online cheats Says:

    However, the failure of several first-party games (including Fuzion
    Frenzy and Azurik: Rise of Perathia) damaged the
    initial public reputation of the Xbox. Play with up to 3 friends online,
    or play on the same console and TV with two-players
    split screen mode. still it seems the Co – D plague prevails on all fronts of FPSs.

    Here is my web blog; ghost recon Online cheats

  44. apartments Says:

    Pretty section of content. I just stumbled upon your website and
    in accession capital to assert that I acquire
    in fact enjoyed account your blog posts. Anyway I’ll be subscribing to your feeds and even I achievement you access
    consistently fast.

  45. search engine marketing strategy example Says:

    Whats up this is kind of of off topic but I was
    wanting to know if blogs use WYSIWYG editors or if you
    have to manually code with HTML. I’m starting a blog soon but have no coding experience so
    I wanted to get advice from someone with experience.

    Any help would be enormously appreciated!

    my web site … search engine marketing strategy example

  46. Spencer Lodge Says:

    Hi, this weekend is good designed for me, since this point in time i am reading this wonderful informative piece of writing here at my residence.

  47. Audra Says:

    Great beat ! I wish to apprentice while you amend your
    web site, how could i subscribe for a blog web
    site? The account helped me a acceptable deal. I had been tiny bit
    acquainted of this your broadcast provided bright clear idea

    So if black and decker rice cooker, Audra, does not work for you personally, don’t be frustrated.
    There are remedies you’re able to take a look at.

  48. web site Says:

    Hi there I am so thrilled I found your blog, I really found you by error, while I was
    researching on Yahoo for something else, Nonetheless I
    am here now and would just like to say cheers for a marvelous
    post and a all round thrilling blog (I also love the theme/design), I don’t have time to browse it all at the minute but I have book-marked it
    and also added in your RSS feeds, so when I have time I
    will be back to read a lot more, Please do keep up the fantastic work.

    My page :: web site

  49. Says:

    doc file is opened on Word 2007, the software automatically
    runs on a Compatibility Mode which is also activated when a new document is saved in. It contains financial information from
    the main office and affiliates. I, for example, use Outlook on a regular
    basis and haven’t yet found an alternative that suits my needs.

  50. best dating sites Says:

    I’m not sure why but this website is loading very slow for me.
    Is anyone else having this problem or is it a problem on my end?
    I’ll check back later and see if the problem still exists.

  51. premium female c2g Says:

    Incredible points. Great arguments. Keep up the good spirit.

  52. Piracy Says:

    Behind the Technology The torrent technology is operated by
    way of a torrent client sending components of the
    torrent file through a torrent protocol. Bhaktapur can be
    an ancient town east of Katmandu within the Katmandu Valley.
    However, the newest measures won’t terminate internet use following your ‘three strike’
    deal other countries have.

  53. Says:

    hello entranced to be coupled Hera. A piffling stimulant from me, things that you mentioned is true, only sometimes on that point are approximately outside factors that likewise must be well
    thought out.

    Though these factors leave greatly sham the ending resolution.

    My chagrin opinion

  54. website Says:

    Thanks to my father who told me concerning this website, this blog is actually

Leave a Reply





WPF Disciples
Code Project