Multiple desktops
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Multiple desktops

  1. #1
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,060

    Multiple desktops

    I use CreateDesktop(), SwitchDesktop, etc to manipulate multiple desktops.

    My problem is that hotkeys registered with RegisterHotKey works across multiple desktops. Example, I have two desktops named "Desk 1" and "Desk 2". On Desk 1 I start an application which registers a hotkey say Ctrl+Alt+N. When this hotkey is pressed a new window is created. Now I switch to Desk 2 and press this hotkey. Because the hotkey-program has been started on desk 1, the window will appear on desk 1 no matter which desktop is currently active.

    This is quite annoying. Also, I can't start the hotkey-program again on Desk 2 because the Ctrl+Alt+N hotkey has already been registered!

    Anyone knows a solution to this problem or is this by design and can't this be circumvented?

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,060

  3. #3
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    just a thought...

    when you call switchdesktop(...) call unregisterhotkey(...) then registerhotkey(...)

  4. #4
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,060
    Works perfectly if the hotkeys are registered in your own program, but not when another program registered the hotkey.

  5. #5
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    well no where in your post do you mention anything other than your process..but maybe that was implied...sorry been doing too much non-windowed coding as of late...be that as it may, I can sorta see the issue, maybe you should look at SetProcessWindowStation(...) or SetThreadDesktop(...) again...just a thought, I'd have to go fark around with it later to say definitely...

  6. #6
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,060
    Originally posted by Mick
    well no where in your post do you mention anything other than your process..but maybe that was implied...
    Sorry, it was implied :blush
    sorry been doing too much non-windowed coding as of late...be that as it may, I can sorta see the issue, maybe you should look at SetProcessWindowStation(...) or SetThreadDesktop(...) again...just a thought, I'd have to go fark around with it later to say definitely...
    SetThreadDesktop(...) does not work with GUI windows:
    Quote from MSDN:
    "The SetThreadDesktop function will fail if the calling thread has any windows or hooks on its current desktop (unless the hDesktop parameter is a handle to the current desktop)."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center