Buchempfehlung
Visual Basic 6 Kochbuch
Visual Basic 6 Kochbuch
Viele praktische Tipps zum Programmieren mit Visual Basic 6, die sich oft auch auf FB übertragen lassen. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

Windows Copy/Paste Text

Uploader:MitgliedEternal_Pain
Datum/Zeit:03.03.2014 14:40:02

#include once "windows.bi"

Function GetClipboardText() as String
    Dim as Integer   ok = OpenClipboard(NULL)
    Dim as HANDLE    hData = GetClipboardData(CF_TEXT)
    Dim as ubyte ptr pchData

    pchData = GlobalLock(hData)

    Function = *pchData

    GlobalUnlock(hData)
    CloseClipboard()
End Function

Sub SetClipboardText(Byval text as String)
    Dim as Integer   ok = OpenClipboard(NULL)
    Dim as HGLOBAL   hClipboardData
    Dim as ubyte ptr pchData

    EmptyClipboard()

    hClipboardData = GlobalAlloc(GMEM_DDESHARE, len(text)+1)

    pchData = GlobalLock(hClipboardData)

    for cpy as Integer = 0 to len(text)-1
        pchData[cpy] = text[cpy]
    next cpy

    GlobalUnlock(hClipboardData)
    SetClipboardData(CF_TEXT,hClipboardData)
    CloseClipboard()
End Sub




'SetClipboardText("das isxyvxyvyxvyxvyxvt ein test")
?GetClipboardText()

sleep