none
how to iterate clipboard viewer chain RRS feed

  • Question

  • how to iterate clipboard viewer chain

    that is to know:
     1. how may viewers in the chain?
     2. get the values of the viewer from first to last?

    right now, i can just get the value of the first viewer in the chain

    • Changed type Nancy Shao Monday, July 20, 2009 6:36 AM OP does not follow up
    • Changed type nobugzModerator Monday, July 20, 2009 9:30 AM marking answered
    Monday, July 13, 2009 2:43 AM

Answers

  • That's not possible.  Only the first window in the chain is stored by Windows.  The rest of the chain is implemented by the various programs that registered a viewer and stored the return value of SetClipboardViewer() and call SendMessage() to pass on WM_DRAWCLIPBOARD.

    Hans Passant.
    • Marked as answer by gangti_zyf Tuesday, July 14, 2009 2:40 AM
    • Unmarked as answer by gangti_zyf Tuesday, July 14, 2009 3:05 AM
    • Marked as answer by nobugzModerator Monday, July 20, 2009 9:30 AM
    Monday, July 13, 2009 9:44 AM
    Moderator

All replies

  • That's not possible.  Only the first window in the chain is stored by Windows.  The rest of the chain is implemented by the various programs that registered a viewer and stored the return value of SetClipboardViewer() and call SendMessage() to pass on WM_DRAWCLIPBOARD.

    Hans Passant.
    • Marked as answer by gangti_zyf Tuesday, July 14, 2009 2:40 AM
    • Unmarked as answer by gangti_zyf Tuesday, July 14, 2009 3:05 AM
    • Marked as answer by nobugzModerator Monday, July 20, 2009 9:30 AM
    Monday, July 13, 2009 9:44 AM
    Moderator
  • That's not possible.  Only the first window in the chain is stored by Windows.  The rest of the chain is implemented by the various programs that registered a viewer and stored the return value of SetClipboardViewer() and call SendMessage() to pass on WM_DRAWCLIPBOARD.

    Hans Passant.

    Thanks.

    Another question:

    I have a programme that do the common things to use clipboard mechanism. e.g. call SetClipboardViewer() to add itself to the chain, and deal with the messags: WM_CHANGECBCHAIN/WM_DRAWCLIBOARD. Finally, it remove itself from the chain by calling ChangeClipboardChain() when received WM_DESTROY message.

    It works pretty well in Windows 2003, Windows XP. But in Vista with UAC on,  when Clipboard Chain looks like following:


    ...      ←   My_Window    ←   Other_Window
                                                        ↑
                                              first of the chain


    If I close Other_Window, the function ChageClipboardChain() called by Other_Window returns error code: 5, which means "access is denied", at the same time, the clipboard viewer chain is destroyed.

    What's the problem with the procedure of My_Window? How to solve it? And why does it work well when UAC is off?

    By the way, I fetch all the clipboard related code from my programme, and do a model. It works even if UAS is on in Vista system.
    Tuesday, July 14, 2009 3:00 AM
  • What's the relation of Other_Window to My_Window?  Does your process actually own Other_Window?

    Hans Passant.
    Tuesday, July 14, 2009 4:28 AM
    Moderator
  • What's the relation of Other_Window to My_Window?  Does your process actually own Other_Window?

    Hans Passant.

    No any relations.
    My programme own My_Windows.
    Other_Window blongs to any other programmes that conform to the clipboard mechanism. If you like, you can open "Services"/"Computer Administration"... in the "Administration Tool" of Control Panel, and take it as Other_Window.

    Tuesday, July 14, 2009 10:22 AM
  • Why are you closing a window that you don't own?

    Hans Passant.
    Tuesday, July 14, 2009 10:39 AM
    Moderator
  • Why are you closing a window that you don't own?

    Hans Passant.

    That is what the customer do. And then some features of my programme doesn't work.

    I make a model, something like Other_Window. When I close Other_Window, I found that ChageClipboardChain returns with error code 5.

    Don't you think that this is a bug of my programme?
    Tuesday, July 14, 2009 11:10 AM
  • No, I think it is a bug in Other_Program.  You're kinda stuck.

    Hans Passant.
    Tuesday, July 14, 2009 12:34 PM
    Moderator
  • No, I think it is a bug in Other_Program.  You're kinda stuck.

    Hans Passant.


      It doesn't matter which programme the bug belong to.

    The most important that i care is that how to fix it?

    by the way, Other_Programme includes all the windows that can be opened in the control panel, administration tools,

    do you mean that the bugs own to windows itself ?

    Tuesday, July 14, 2009 2:33 PM
  • Well, that would be unlikely.  This is still thick as mud.  How do you even know that the other app is getting error 5 on calling ChangeClipboardChain()?  Post your implementation of your WM_CHANGECBCHAIN message handler.

    Hans Passant.
    Tuesday, July 14, 2009 4:42 PM
    Moderator
  • Hi,

    We are changing the issue type to “General Discussion” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by opening the Options list at the top of the post editor window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

    Thank you!

    Best Regards,
    Nancy


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, July 20, 2009 6:36 AM
  • Hi,

    We are changing the issue type to “General Discussion” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by opening the Options list at the top of the post editor window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

    Thank you!

    Best Regards,
    Nancy


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


    Well, I felt some disapointed about the answers here.

    Just as I described above about the questions, the code runs well in all os except vista.
    I take the clipboard related code into an example programme, and I runs well in all os includig vista.

    Considering all these, is there any need to post the code of ChangeClipboardChain?
    I know the return code is 5 because my examples code returns it. ( I swear that this is not the first time I provide this infomation)

    Thanks, anyhow
    Friday, July 24, 2009 3:19 AM