Skip to content

Clipboard.GetDataObject need singleton #20

@BBUBBA

Description

@BBUBBA

image

If Hook WM_DRAWCLIPBOARD Multiple Process

Hook event is good work Data is Empty. -_- ( It's Sometime )
( WM_CLIPBOARDUPDATE is Same Trouble )
( I tried Global Mutex Control Critical Section = Same Trouble)
( I Think Just One Process and need IPC Communication )

It's OS Stupid But we need Solve that...

and we need use WM_CLIPBOARDUPDATE if over Windows Vista....

if WM_DRAWCLIPBOARD Die about Chain Clipboard is Stupid ( About Another Process )

it's My dirty Code....
( Warning : My english is not good...)

class ClipboardManager : ClipboardCommon, IClipboardManager
{

    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
    protected override void WndProc(ref Message m)
    {
        switch (m.Msg)
        {
            case NativeConstant.WM_CLIPBOARDUPDATE:
                ClipboardChange_Proc();
                //Trace.WriteLine("ChangeClipboard");
                break;
        }
        base.WndProc(ref m);
    }

    public ClipboardManager()
    {
        RegisterClipboardViewer();
    }

    public override void RegisterClipboardViewer()
    {
        Native.AddClipboardFormatListener(this.Handle);
    }

    public override void UnregisterClipboardViewer()
    {
        try
        {
            Native.RemoveClipboardFormatListener(this.Handle);
        }
        catch (ObjectDisposedException ex) { }
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions