🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
11 messages
11 total messages Started by Chris Sat, 19 Apr 2003 08:56
Long question I'm afraid
#16889
Author: Chris
Date: Sat, 19 Apr 2003 08:56
39 lines
2623 bytes
I have an app that registers itself with the shell allowing a user to right
click a file and then select an option from the Windows pop-up menu.

All works fine until the user selects a lot of files, at which point this is
the process the app follows:

1 Windows starts a first instance of the app which receives the first file
name as a command line arg.
2. Windows now starts a further instance of the app
3. This second instance uses a mutex to detect the first instance and if it
finds one it sends a usermessage to the first instance and then closes.
4.  The first instance has a message loop that receives these usermessages
and hence receives all further file names

All works fine but I want to present a message to the user asking whether
they want to carry out an operation on all X files.  Clearly I cannot
present this message until I know how many files there are.

Currently I use a TTimer set to 300ms.  When a filename is received  I
disable the Timer and re-enable it when the app has finished
counting/storing the file name for later use.

Most of the time 300ms is long enough but sometimes it isn't, for example I
select 200 files, right click and select the menu option, and most of the
time the app displays the correct message, sometimes (when Windows is busy
doing what ever it does) I might get only 100 files before the Timer fires.

I do not want to extend the timer interval if at all possible and instead
wondered:

(At last the actual question)
Is there a system message that I can check to find whether Windows is
reacting to the right click menu?

Thanks

Chris

PS I hope this is the correct group.
Re: Long question I'm afraid
#16891
Author: user
Date: Sat, 19 Apr 2003 14:11
28 lines
2444 bytes
Chris wrote:
> I have an app that registers itself with the shell allowing a user to right
> click a file and then select an option from the Windows pop-up menu.
> 
> All works fine until the user selects a lot of files, at which point this is
> the process the app follows:
> 
> 1 Windows starts a first instance of the app which receives the first file
> name as a command line arg.
> 2. Windows now starts a further instance of the app
> 3. This second instance uses a mutex to detect the first instance and if it
> finds one it sends a usermessage to the first instance and then closes.
> 4.  The first instance has a message loop that receives these usermessages
> and hence receives all further file names
> 
> All works fine but I want to present a message to the user asking whether
> they want to carry out an operation on all X files.  Clearly I cannot
> present this message until I know how many files there are.
> 

There are two ways to add a context menu handler to the Windows shell: 
The standard executable method and the COM shell extension -- 
IContextMenu -- method. The first way, which I assume you are using, is 
by far the easiest to implement, but it has limitations, and I think you 
may have reached them. I hate to suggest it, but because it allows for 
processing a list of files instead of passing them to your program one 
at a time, you may want to bite the bullet and look into writing a COM 
object.
Re: Long question I'm afraid
#16892
Author: Chris
Date: Sat, 19 Apr 2003 17:18
21 lines
1794 bytes
<user@domain.invalid> wrote in message
news:3EA158F8.7010707@domain.invalid...
>
> There are two ways to add a context menu handler to the Windows shell:
> The standard executable method and the COM shell extension --
> IContextMenu -- method. The first way, which I assume you are using, is
> by far the easiest to implement, but it has limitations, and I think you
> may have reached them. I hate to suggest it, but because it allows for
> processing a list of files instead of passing them to your program one
> at a time, you may want to bite the bullet and look into writing a COM
> object.
>

Guess you're right. (Short time later)  I've just scared myself looking at
MSDN on IContextMenu.  Don't suppose anyone can point me to a sample peice
of BCB code?

Thanks

Chris
Re: Long question I'm afraid
#16894
Author: Michael Harris
Date: Sat, 19 Apr 2003 22:20
1 lines
1117 bytes
http://bdn.borland.com/article/0,1410,26650,00.html
Re: Long question I'm afraid
#16896
Author: Chris
Date: Sat, 19 Apr 2003 23:18
17 lines
1744 bytes
"Michael Harris" <techonos@attbi.com> wrote in message
news:3ea1cbc0$1@newsgroups.borland.com...
> http://bdn.borland.com/article/0,1410,26650,00.html
>
>

I've had a quick look (I only checked the forums just before going to bed
which is after about 3 hours of trawling the web, reading books, trying VB
examples, messing in BCB) and so have not had chance to fully digest it.
But, my initial impression is THANK YOU.

One down side is that the sample code download is no longer available, but
hey, you can't have everything.

Many thanks and much appreciated,

Chris
Re: Long question I'm afraid
#16898
Author: Chris
Date: Sat, 19 Apr 2003 23:37
9 lines
1330 bytes
"Chris" <chris@chrischfmouseyREMOVE.karoo.co.uk> wrote in message
news:3ea1d93b@newsgroups.borland.com...
>
> One down side is that the sample code download is no longer available, but
> hey, you can't have everything.
>

Update: I found a working download
Re: Long question I'm afraid
#16900
Author: Asger J�rgensen
Date: Sun, 20 Apr 2003 01:15
18 lines
1418 bytes
Hi Chris

  In article <3ea1ddac$1@newsgroups.borland.com>,  Chris says :

> 
> "Chris" <chris@chrischfmouseyREMOVE.karoo.co.uk> wrote in message
> news:3ea1d93b@newsgroups.borland.com...
> >
> > One down side is that the sample code download is no longer available, but
> > hey, you can't have everything.
> >
> 
> Update: I found a working download

Where ??

Thanks in advance
Asger
Re: Long question I'm afraid
#16903
Author: Remy Lebeau (TeamB)
Date: Sun, 20 Apr 2003 06:52
15 lines
1540 bytes
"Chris" <chris@chrischfmouseyREMOVE.karoo.co.uk> wrote in message
news:3ea1d93b@newsgroups.borland.com...

> One down side is that the sample code download
> is no longer available

Yes, it is.  The download URL in that article is simply malformed, it as an
extra quotation mark at the end of it.  The correct download URL is:

Context Menu Shell Extension using COM
http://codecentral.borland.com/codecentral/ccweb.exe/listing?id=15503


Gambit
Re: Long question I'm afraid
#16904
Author: Asger J�rgensen
Date: Sun, 20 Apr 2003 07:49
6 lines
1173 bytes
Hi Remy

Thank You very much.

Best regards
Asger
Re: Long question I'm afraid
#16909
Author: user
Date: Sun, 20 Apr 2003 13:22
9 lines
1461 bytes
Michael Harris wrote:
> http://bdn.borland.com/article/0,1410,26650,00.html
> 

Of course, this example ignores all but the first file selected. In 
order to get the full list, you'll need to modify 
TMyContextMenuExtensionImpl::Initialize() to call DragQueryFile() with 
the iFile parameter set to 0xFFFFFFFF to get a count, and then again 
repeatedly to fetch each file name.
Re: Long question I'm afraid
#16913
Author: Chris
Date: Sun, 20 Apr 2003 20:38
15 lines
1545 bytes
<user@domain.invalid> wrote in message

> Of course, this example ignores all but the first file selected. In
> order to get the full list, you'll need to modify
> TMyContextMenuExtensionImpl::Initialize() to call DragQueryFile() with
> the iFile parameter set to 0xFFFFFFFF to get a count, and then again
> repeatedly to fetch each file name.
>

Thanks for the tip, still trying to get the example to work, but as soon as
I do I will look at modifying it.

Thanks to all

Chris
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads