Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipboard paste error code #65

Open
csitGenny opened this issue Jan 5, 2021 · 0 comments
Open

Clipboard paste error code #65

csitGenny opened this issue Jan 5, 2021 · 0 comments

Comments

@csitGenny
Copy link

csitGenny commented Jan 5, 2021

Non English programs, clipboard paste error code solution:

  1. Move "#include <Clipbrd.hpp>" from "Misc.cpp" to "Misc.h"

  2. In Misc.h add:
    //Add by ZGL--------------------------------------------------------------
    class TUnicodeClipboard : public TClipboard
    {
    private:
    WideString __fastcall GetAsUnicodeText();
    void __fastcall SetAsUnicodeText(const WideString Value);
    public:
    __property WideString AsUnicodeText = {read=GetAsUnicodeText, write=SetAsUnicodeText};
    };
    //---------------------------------------------------------------------------

  3. In Misc.cpp add:
    //Add by ZGL--------------------------------------------------------------
    WideString __fastcall TUnicodeClipboard::GetAsUnicodeText()
    {
    WideString res;
    Open();
    HANDLE data = GetClipboardData(CF_UNICODETEXT);
    try
    {
    if (data)
    res = (wchar_t *)GlobalLock(data);
    else
    res = "";
    }
    __finally
    {
    if (data) GlobalUnlock(data);
    Close();
    }
    return res;
    }
    //Add by ZGL----------------------------------------------------------------
    void __fastcall TUnicodeClipboard::SetAsUnicodeText(const WideString Value)
    {
    SetBuffer(CF_UNICODETEXT, (wchar_t *)Value, (wcslen(Value) + 1) * sizeof(WideChar));
    }
    //---------------------------------------------------------------------------

  4. Then, all "Clipboard()->AsText =" in the program are changed to:
    “((TUnicodeClipboard *)Clipboard())->AsUnicodeText =”;

All "Clipboard()->SetTextBuf (??)" are changed to:
"((TUnicodeClipboard *)Clipboard())->AsUnicodeText =??"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant