Code updated for 5.20+ (same as SetClipboardText())
Restored from previous forum. Originally posted by wayne1.
see example below
Edited by - wayne1 on 05 October 2001 17:10:16
SetClipBoardData()
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
Hi Wayne1,
sorry but this example is not working on my machine (W98SE). Neither as exe.
Can't set a new Clipboard text.
With the line:
MessageRequester("ClipBoard Text", peeks(hMem), 0)
I get always a old text.
Add this line:
MessageRequester("Needed Text", peeks(p), 0)
before the line:
MessageRequester("ClipBoard Text", peeks(hMem), 0)
and you will see that the Messagebox will be empty. (funny thing...)
Have a nice day...
Franco
Hi Wayne1,
sorry but this example is not working on my machine (W98SE). Neither as exe.
Can't set a new Clipboard text.
With the line:
MessageRequester("ClipBoard Text", peeks(hMem), 0)
I get always a old text.
Add this line:
MessageRequester("Needed Text", peeks(p), 0)
before the line:
MessageRequester("ClipBoard Text", peeks(hMem), 0)
and you will see that the Messagebox will be empty. (funny thing...)
Have a nice day...
Franco
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by wayne1.
Edited by - wayne1 on 05 October 2001 23:45:41
Code: Select all
;simple clipboard example
;This sample will copy to, then show the text in the clipboard
*Memory = AllocateMemory(3000)
OpenClipboard_(#Null);Handle to the window to be associated with the open clipboard.
;If this parameter is NULL, the open clipboard is associated with the current task.
EmptyClipboard_()
text$ = "This a test of copying to the clipboard";this string will be in the clipboard
PokeS(*Memory, text$)
SetClipboardData_(#CF_TEXT, *Memory)
h = GetClipboardData_(#CF_TEXT);text format
MessageRequester("ClipBoard Text", PeekS(h), 0)
CloseClipboard_()
;EmptyClipboard_();for reference
;The EmptyClipboard function empties the clipboard
;and frees handles to data in the clipboard.
;The function then assigns ownership of the clipboard
;to the window that currently has the clipboard open.