Hey, was wondering if anyone could help me accomplish getting a selection from a list box to copy to the clipboard.
I've tried
invoke OpenClipboard,hWin
invoke EmptyClipboard
and then a bunch of stuff with SetClipboardData and some other stuff (figured id try to get it to work before asking questions)
so yeah if anyone could help that would be great.
I've tried
invoke OpenClipboard,hWin
invoke EmptyClipboard
and then a bunch of stuff with SetClipboardData and some other stuff (figured id try to get it to work before asking questions)
so yeah if anyone could help that would be great.
Have you ever tried LVM_GETNEXTITEM with LVNI_SELECTED flag?
Ignore! I was thinking of listview! Sorry!
/siddhartha
Ignore! I was thinking of listview! Sorry!
/siddhartha
Hi,
First you need to get the text from the listbox then copy it to the clipbard:
First you need to get the text from the listbox then copy it to the clipbard:
; Find the length of the string
invoke SendMessage, [hListbox], LB_GETTEXTLEN, [nItem], 0
inc eax
mov [nLen], eax
invoke OpenClipboard, [hWin]
or eax,eax
jz >>.DONE
invoke EmptyClipboard
invoke GlobalAlloc,GMEM_MOVEABLE + GMEM_ZEROINIT, [nLen]
mov [hClipData],eax
invoke GlobalLock,[hClipData]
invoke SendMessage, [hListbox], LB_GETTEXT, [nItem], eax
invoke GlobalUnlock,[hClipData]
invoke SetClipboardData, CF_TEXT, [hClipData]
invoke CloseClipboard
.DONE
Oh, and before the inevitable next question, "how do I get the text from the clipboard ?", here's the answer:
invoke IsClipboardFormatAvailable, CF_TEXT
or eax,eax
jz >P2
invoke OpenClipboard, [hWin]
or eax,eax
jz >P2
invoke GetClipboardData, CF_TEXT
or eax,eax
jz >P1
push eax
invoke GlobalLock,eax
; ############
; EAX points to the text buffer, do what you want with it here
; ############
pop eax
invoke GlobalUnlock,eax
P1:
invoke CloseClipboard
P2:
alright man thanks, I'll inform you how it went when I get back on my own computer