Pelles C forum

C language => Windows questions => Topic started by: CommonTater on January 12, 2011, 10:18:32 AM

Title: Shell interfaces in C....
Post by: CommonTater on January 12, 2011, 10:18:32 AM
Is there a way to get at the shell's interfaces from plain C?

In particular I would like to use the iQueryCancelAutoPlay interface but it would be helpful to understand this in general as well...

http://msdn.microsoft.com/en-us/library/bb761373(VS.85).aspx

Title: Re: Shell interfaces in C....
Post by: Stefan Pendl on January 12, 2011, 11:08:37 AM
COM interfaces are available to plain C source code.

You will have to initialize COM and release it afterwards.

John should have some COM code examples at his site.
Title: Re: Shell interfaces in C....
Post by: Stefan Pendl on January 12, 2011, 11:23:15 AM
Can't you use the following http://msdn.microsoft.com/en-us/library/cc144204%28VS.85%29.aspx ?

Depending on the type of your window, dialog or regular, you need to use different ways to return the result.
Title: Re: Shell interfaces in C....
Post by: CommonTater on January 12, 2011, 12:26:21 PM
Can't you use the following http://msdn.microsoft.com/en-us/library/cc144204%28VS.85%29.aspx ?

Depending on the type of your window, dialog or regular, you need to use different ways to return the result.

Yes, I know about that.  I would like to use it, and have experimented with it, but it only works on windows in the foreground.  Background or hidden windows do not receive the message.  The problem is that my little server is never a foreground window. 




Title: Re: Shell interfaces in C....
Post by: CommonTater on January 12, 2011, 12:27:48 PM
John should have some COM code examples at his site.

Hey thanks for that... I'll check it out.

I also found the article on Code Project referenced in an earlier article and am studying it.
Title: Re: Shell interfaces in C....
Post by: TimoVJL on January 12, 2011, 12:29:48 PM
Here is something in C++:
http://groups.google.com/group/borland.public.cppbuilder.nativeapi/msg/bfbaa539ba22fee5 (http://groups.google.com/group/borland.public.cppbuilder.nativeapi/msg/bfbaa539ba22fee5)
http://msdn.microsoft.com/fi-fi/magazine/cc301341(en-us).aspx (http://msdn.microsoft.com/fi-fi/magazine/cc301341(en-us).aspx)
Title: Re: Shell interfaces in C....
Post by: CommonTater on January 12, 2011, 03:25:12 PM
Here is something in C++:

Thanks timovjl... I saw the second one in my journeys... that first one is going to take a while to get my head around... Whew!  

I'm starting to think it might just be easier to outright disable autoplay on the account the server runs in and call it quits.... That I can do with a couple of quick registry writes...

Of course the problem is that if someone inserts a DVD or CD while the player is running, it either steals the media player (leaving the user with the wrong remote control) or pops up a dialog that won't go away, right in the middle of the movie. Very frustrating...