detect new service with bonjour sdk - visual-studio-2010

i have sucesfully implement the bonjour sdk in visual c++ dialog application. the application brows all services and show them in the "Tree", but I want to know if there is a method in bonjour sdk to detect if new service was added and then refresh the content.
thx

Assuming you are using the Bonjour SDK supplied by Apple availible for Windows this is actually taken care of automatically.
Look closely at the method for browsing services: DNSServiceBrowser. It has a callback parameter that will get called when there is a new service found. Just make sure to call DNSProcessResults when needed. You can either block in this call, or use Poll/Select to detect when the file desciptor has data to read.

Related

Windows 8 protocol activation of Desktop app from a Modern App

I have two versions of my custom software. The Modern/Metro app (AppM) and my legacy Desktop application (AppD). I have created a custom protocol for AppM using the manifest that is well understood. I've edited the registry to make a custom protocol handler for AppD and have tested that I can indeed launch AppD using protocol activation from the Run dialog (WIN+R) by supplying the protocol and hitting enter, "AppD://" in this case. I'd like to be able to launch AppM from AppD and AppD from AppM. I've added handlers for each. In AppD I'm using Process.Start(uri) and in AppM I'm using Launcher.LaunchUriAsync(uri). I can get AppM to launch from AppD but I never get AppD to launch from AppM. I've googled and can't find any references to this. I'm assuming it's not possible and might very much have to do with permissions. As this assignment has fallen to me on the project, I need to either prove that it's not possible or find a solution.
I've tested this out using C#/XAml as well as HTML/JS and it's interesting to find that Launcher.LaunchUriAsync(uri).when() success function is called, but the success flag is false. there is no error (or at least the err function is never hit). I'd like to get a better error message and I'm currently trying to dig down that way.
So help with the actual issue, or help with how to debug this would both be greatly appreciated.
Update: To eliminate my own code, I downloaded and installed the launch by association example and simply changed the var uriToLaunch= "http://bing.com" to var uriToLaunch= "AppD:" and it fails every time. This protocol is associated in the registry and the method that I'm using to verify this is by running it using WIN+R from the desktop and the app launches just fine.
BatRT is an application which allows you to run a batch file from a metro app, utilizing URI calls. This should solve your problem.
Simply create a batch file within your metro app, then utilize BatRT to execute the batch file. Code snippets are available at the link above.

Detecting and launching an external application from within a Windows Phone 7.1/7.5 application

I need to write an application that can detect if the "Bing - Get me there" application is installed on the current phone and if so, launch it.
Is this possible? The app would need to do this for other external applications as well, so a generic method or interface for this would be helpful.
Applications run in a sandbox on Windows Phone and there is no way to tell if other applications are installed unless you are writing both of them and you use a method to announce to other applications that you are installed and they know how to read that announcement.
2 approaches to such announcements would be:
Have both (all) apps synchronise with a web server and report which devices they have been installed on. The apps can the query which other apps have been installed on that device.
Have all apps write a file to a location where all apps can access. The only place to do this is the PicturesLibrary so you have to embed the identifier in the name of the image or in its contents and be able to query all images to identify the other installed apps. The user could manually delete any images you create in this way though.
Beware, neither method can tell if the other app has subsequently been uninstalled though so this is far from foolproof.
As far as I know, there's no way to do that.
Applications on Windows Phone run in complete isolation, and can not act with other applications, other than some highly specialized apps (i.e. for playing media).

Accessing WebService From Windows Mobile

I want to access Web service from windows mobile application and want to process data returned by it. I am not finding any step by step guide to it. I found some articles relevant but they don't clearly mention what setting are required to run in the emulator and what setting are required in order to run on the physical device. Please suggest me best way.
Beginner always need guidance from scratch so there should be some step by step article.Thanks in advance.
I don't have any detailed instructions but I've done heaps of this soft of thing. It's exactly the same as connecting a normal Windows app to a web service. You way want to try this first using a simple WinForms app so you understand the basics of creating a web reference.
The only complication is that your emulator or mobile device will need to be able to connect to the machine running the web service but this should also be pretty easy. Just set up a simple html test page on your PC and ensure you can browse to this using the emulator.

Where can I find a good description on how to use COM with Windows Services?

I'm looking to pass parameters into a Windows Service not only upon launch but while it's still running as well. I've heard the best way to do this would be through the COM but I have no idea where to even get started. Are there any good places you can recommend where I can find some helpful information about how to get started with the COM and Windows Services? Thanks in advance!
You can't just get a piece of duct tape and magically "attach COM" to any Windows service. While it is true that you can host a COM object in COM+ and activate it in a Windows service process, but this is not just adding new functionality - it will change the behavior significantly.
In addition to named pipes you can use RPC - start RPC server in the service and make calls to it from the other process.

Atl service not registering

I'm trying to register an atl service using
ExeName.exe /service
as described here: http://msdn.microsoft.com/en-us/library/74y2334x(VS.80).aspx
After doing so though, it's not appearing in my services control panel (the one that I get to by typing Services in the start box on vista).
I've tried to dig through the atl code to see where it handles the /service switch, but can't find it, although I can find code to handle /RegServer and /UnregServer
This used to work, I've somehow managed to register this service before. But, now I've moved its location and can't get it registered again. When I run ExeName.exe /service, it does start up as a Local Server if I do a /RegServer first, but I want it installed as a service.
Am I missing something, and do you know where the handling of the /service switch is done?
Running with the CAtlServiceModule::Install method out of the box, you must use the correct capitals on each argument - "/Service", "/UnregServer", etc.
Shot in the dark: Are you running on Vista? If so make sure you are running with full admin privleges. Otherwise it's possible you're registering this app via virtualization.
Same as JaredPar did, try command with Power Shell with full admin privileges.
Check that you haven't accidentally typed some characters in the name of the function ParseCommandLine in class CAtlServiceModuleT defined in atlbase.h
If you do so, there's a version of this function also in the base class which will mean eveything will compile nicely, and it could take you all day to spot this daft mistake!
;-)

Resources