Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,677 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Sir I have a unicode file created in notepad
I refer to this link
copy-unicode-text-clipboard
I want to copy file contents to _clipboard, so I am trying to use these codes
tcUnicodeText=FULLPATH(GETFILE('txt'))
DO CopyUnicodeText2Clipboard WITH tcUnicodeText
&& Copy Unicode text into Clipboard
FUNCTION CopyUnicodeText2Clipboard(tcUnicodeText)
LOCAL lnDataLen, lcDropFiles, llOk, i, lhMem, lnPtr, lcUnicodeText
#DEFINE CF_UNICODETEXT 13
&& Global Memory Variables with Compile Time Constants
#DEFINE GMEM_MOVABLE 0x0002
#DEFINE GMEM_ZEROINIT 0x0040
#DEFINE GMEM_SHARE 0x2000
&& Load required Windows API functions
=LoadApiDlls()
llOk = .T.
lcUnicodeText = tcUnicodeText + CHR(0)+CHR(0)
lnDataLen = LEN(lcUnicodeText)
&& Copy Unicode text into the allocated memory
lhMem = GlobalAlloc(GMEM_MOVABLE+GMEM_ZEROINIT+GMEM_SHARE, lnDataLen)
lnPtr = GlobalLock(lhMem)
=CopyFromStr(lnPtr, @lcUnicodeText, lnDataLen)
=GlobalUnlock(lhMem)
&& Open clipboard and store Unicode text into it
llOk = (OpenClipboard(0) <> 0)
IF llOk
=EmptyClipboard()
llOk = (SetClipboardData(CF_UNICODETEXT, lhMem) <> 0)
&& If call to SetClipboardData() is successful, the system will take ownership of the memory
&& otherwise we have to free it
IF NOT llOk
=GlobalFree(lhMem)
ENDIF
&& Close clipboard
=CloseClipboard()
ENDIF
RETURN llOk
FUNCTION LoadApiDlls
&& Clipboard Functions
DECLARE LONG OpenClipboard IN WIN32API LONG HWND
DECLARE LONG CloseClipboard IN WIN32API
DECLARE LONG EmptyClipboard IN WIN32API
DECLARE LONG SetClipboardData IN WIN32API LONG uFormat, LONG hMem
&& Memory Management Functions
DECLARE LONG GlobalAlloc IN WIN32API LONG wFlags, LONG dwBytes
DECLARE LONG GlobalFree IN WIN32API LONG HMEM
DECLARE LONG GlobalLock IN WIN32API LONG HMEM
DECLARE LONG GlobalUnlock IN WIN32API LONG HMEM
DECLARE LONG RtlMoveMemory IN WIN32API As CopyFromStr LONG lpDest, String @lpSrc, LONG iLen
RETURN
Codes runs successfully but when I paste data into MS.Word then this data appears
폇쟡⃣飭⃣臂頠폭Ÿ炙?뷑ᄐ芖g﹌䛦覒蠀
instead of this data
اسلام علیکم
آپ کیسے ہیں
How is it possible to copy unicode data to _clipboard.
Please