Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. WPF idle application freezes

WPF idle application freezes

Scheduled Pinned Locked Moved WPF
csharpwpf
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Camilo Sanchez
    wrote on last edited by
    #1

    Hi, I'm developing a WPF application that seems to work fine, but after an long inactivity period, when the user clicks something it freezes for a while then it runs normally. This is the only application running in that computer, so I don't know what could be causing this. In my application I need to check the time between user clicks so I'm intercepting Windows messages like this: void Window_Loaded(object sender, RoutedEventArgs e) { ResetTimeoutChecker();//reset the timer that does something HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle); source.AddHook(new HwndSourceHook(myWndProc)); } private static IntPtr myWndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if (msg == 0x0201)//if is a click then reset the timer that does something ResetTimeoutChecker(); return IntPtr.Zero; }

    L 1 Reply Last reply
    0
    • C Camilo Sanchez

      Hi, I'm developing a WPF application that seems to work fine, but after an long inactivity period, when the user clicks something it freezes for a while then it runs normally. This is the only application running in that computer, so I don't know what could be causing this. In my application I need to check the time between user clicks so I'm intercepting Windows messages like this: void Window_Loaded(object sender, RoutedEventArgs e) { ResetTimeoutChecker();//reset the timer that does something HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle); source.AddHook(new HwndSourceHook(myWndProc)); } private static IntPtr myWndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if (msg == 0x0201)//if is a click then reset the timer that does something ResetTimeoutChecker(); return IntPtr.Zero; }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Maybe you can use one of the WPF Preview... events on your Window. Since the Window will "see" the event before it happens, you can perform you checks there. Then you can remove all the above code.

      Cheers, Karl » CodeProject 2008 MVP My Blog | Mole's Home Page | XAML Power Toys Home Page

      Just a grain of sand on the worlds beaches.

      C 1 Reply Last reply
      0
      • L Lost User

        Maybe you can use one of the WPF Preview... events on your Window. Since the Window will "see" the event before it happens, you can perform you checks there. Then you can remove all the above code.

        Cheers, Karl » CodeProject 2008 MVP My Blog | Mole's Home Page | XAML Power Toys Home Page

        Just a grain of sand on the worlds beaches.

        C Offline
        C Offline
        Camilo Sanchez
        wrote on last edited by
        #3

        thanks man, I'm gonna try that right now, but I don't think its gonna make a difference

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups