سلام دوستان
چجوری میشه متن انتخاب شده (سلکت شده) رو بدون دستور خاصی به clipboard فرستاد . یعنی وقتی کاربر متنی رو در هر جایی از ویندوز انتخاب کرد بطور خودکار وارد clipboard بشه
ساده ترين راه شبيه سازي ctrl + c هست
اما توش مشكل داره مثلا اگر فايل هم انتخاب كرد كپي ميشه ، مي توني مقدار قبلي رو كه تو كليپ بورد وجود داشته نگه داري ، مقدار جديد كه وارد كليپ بورد شد در صورتي كه غير از متن بود خالي بشه و مقدار قبلي برگرده
اين راه بدون كدش بود
اما يك راه ديگه استفاده از API كه برنامه گوش بزنگ باشه هر وقت select انجام شد اون رو كپي كنه
به احتمال زياد يكي از API كه اين كار رو انجام ميده همون getmessgae
ديگه باقيش رو اطلاع ندارم
كسي از دوستان جواب اين سوال رو نداره ؟
احتمالا با هوک کردن پیغامهای مربوط به select کردن text میتونین این کارو انجام بدین
کد:
After selecting an edit control, the user can select text in the control by using the mouse or the keyboard. An application can retrieve the starting and ending character positions of the current selection in an edit control by sending the control an EM_GETSEL message. The return value for the ending position is one greater than the last character in the selection (that is, the position of the first character following the last selected character).
An application can also select text in an edit control by sending the control an EM_SETSEL message with the starting and ending character indices for the selection. For example, the application can use EM_SETSEL with EM_REPLACESEL to delete text from an edit control.