NO

Author Topic: Shell interfaces in C....  (Read 5533 times)

CommonTater

  • Guest
Shell interfaces in C....
« 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


Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: Shell interfaces in C....
« Reply #1 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.
---
Stefan

Proud member of the UltraDefrag Development Team

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: Shell interfaces in C....
« Reply #2 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.
---
Stefan

Proud member of the UltraDefrag Development Team

CommonTater

  • Guest
Re: Shell interfaces in C....
« Reply #3 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. 





CommonTater

  • Guest
Re: Shell interfaces in C....
« Reply #4 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.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
May the source be with you

CommonTater

  • Guest
Re: Shell interfaces in C....
« Reply #6 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...

« Last Edit: January 12, 2011, 03:28:05 PM by CommonTater »