Hello, I've tried to alter the example2\poplist sample from Hutch so that a dblclick would put the item in the clipboard.

I've tried the following code:


.elseif uMsg == WM_LBUTTONDBLCLK

szText msgText,"Put your message here if you need it."
invoke SendMessage, hWin, LB_GETCURSEL, 0, 0
invoke SendMessage, hWin, LB_GETTEXT, eax, addr msgText
invoke CopyClip, ADDR msgText
;CopyClip is a proc I made that copies the string to the clipboard
; invoke MessageBox,hWin,ADDR msgText,ADDR szDisplayName,MB_OK

and it works when I debug it with ollydbg, but copies the original string when I run the program normally.

Is it because I send a message inside a message loop?
Posted on 2002-03-27 12:34:11 by Silas
Silas,

As I heard...

"szText" Macro, writes in ".code" setion (Is it write?)
so you buf "msgText" is "READONLY" caz it's in .code section.

======
szText msgText,"Put your message here if you need it."
invoke SendMessage, hWin, LB_GETCURSEL, 0, 0
invoke SendMessage, hWin, LB_GETTEXT, eax, addr ItemBuffer
invoke CopyClip, ADDR ItemBuffer
======

so, use writable buffer, instead "msgText'.. like below
it works fine.

==
invoke SendMessage, hWin, LB_GETTEXT, eax, addr ItemBuffer
invoke CopyClip, ADDR ItemBuffer
==
Posted on 2002-03-27 18:42:20 by muzidowa
Thanks a lot! :alright:

It's so simple, yet I never would have find it.

I'm still a newbie in asm so I didn't knew the code section was read-only. Next time, I'll do the declaration the old fashion way like I've learned instead of the ready to use vb style...

Thanks again!
Posted on 2002-03-27 19:31:17 by Silas