🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #962

Re: Add to global cut/copy/cpste

#962
From: Denville Longhurst
Date: Thu, 22 Nov 2007 07:18
64 lines
3564 bytes
Well, what can I say?  As usual you have answered my question completely and 
comprehensively, and saved me an enormous amount of time.

As  usual, thank you very much.

Denville.

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:4744ceac$1@newsgroups.borland.com...
>
> "Denville Longhurst" <denville@metco.co.uk> wrote in message 
> news:4744bd52$1@newsgroups.borland.com...
>
>> How could I add a menu item to the global right-click menu
>> that offers copy, cut, paste, etc. ?
>
> You can't.  You will have to create your own menu that has those same 
> options in it, plus whatever you want to add to it.
>
>> the user is within any arbitrary application eg reading an email
>> etc. I would like it to be possible to right-click and in addition
>> to the normal cut/copy/paste etc options, there be a new option
>> 'copy to my app'.
>
> There is no single popup menu that handles that globally for everything 
> equally.  Different controls, files, windows, etc have different menus. 
> Even things that appear to have the same options do not implement them the 
> same way.
>
> The only way you are going to be able to hook into another application's 
> menu like you describe is if that application exposes an API to do so. 
> Otherwise, you have to implement a global hook in a DLL using 
> SetWindowsHookEx(), and have it intercept menu and mouse messages for the 
> application, blocking the native menu handling and displaying your own 
> menu instead.
>
>> My app would then grab a copy of the selected text (presumably
>> from the clipboard, which I know how to do) and do something with it, 
>> perhaps in the background.
>
> Another option would be to simply monitor the clipboard itself for changes 
> (look at SetClipboardViewer()) and then do something when new data arrives 
> on it.
>
>> If I can't add a menu item (easily), could I get a notification
>> when the user clicks on Copy
>
> A global hook could intercept another application's WM_COMMAND messages. 
> To prevent the default handling, you would have to modify the message into 
> a different one, such as WM_NULL.  You can then send a notification back 
> to your main application to let it know that it can do what it needs to. 
> You will also have to retreive the currently selected text and include 
> that in your notification, since you can't retrieve it from an external 
> process (your DLL would run in the context of the application being 
> hooked).
>
>> then pop up a sub-menu, offering eg 'Copy to Clipboard' and 'Copy to My 
>> App' ??
>
> You need to use your own menu for that.
>
>
> Gambit
> 
Technical Details
Message-ID: <47452d35$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4744bd52$1@newsgroups.borland.com> <4744ceac$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,88d98c22f84e49ec
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Denville Longhurst" <denville@metco.co.uk>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4744bd52$1@newsgroups.borland.com> <4744ceac$1@newsgroups.borland.com>
Subject: Re: Add to global cut/copy/cpste
Date: Thu, 22 Nov 2007 07:18:12 -0000
Lines: 66
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 82.8.28.29
Message-ID: <47452d35$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1195715893 82.8.28.29 (21 Nov 2007 23:18:13 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail