views:

606

answers:

2

We have written a C# command line app that gets run as the first step in a script that is executed when users launch our CRM system on citrix (it is a published app). The purpose of the command line is to find the outlook icon on the system tray and hide it. We do this via PInvoke calls to various WIN32 methods and it works great when testing in a non citrix environment.

When we roll this out to our Citrix test server and run via the published app script, our code is not finding windows for the SysPager and (more importantly) ToolbarWindow32 windows that we expect to see in the system tray. Anyone know why?

Sample Code:

IntPtr shellTrayHwnd = Win32.FindWindow("Shell_TrayWnd", null);
IntPtr sysPagerHwnd = Win32.FindWindowEx(shellTrayHwnd, IntPtr.Zero, "SysPager", null); //returns 0
IntPtr toolbarNotifyHwnd = Win32.FindWindowEx(shellTrayHwnd, IntPtr.Zero, "ToolbarWindow32", null);  //returns 0

As I said, this code works great when running in a non-citrix session, but once we run in citrix we seem to lose the ability to get these handles.

FYI: The ultimate goal here is to hide the outlook icon that gets sent to the client's system tray when our CRM software, which relies on outlook running in the background, is run. If we don't supress the icon, we get two outlook icons in the end-user's tray. One from their local outlook and one from the outlook that is running on citrix in the background for the CRM software to work (the CRM software does not use outlook in embedded mode because we need to be able to run VSTO plugins - which don't get loaded in embedded mode). If someone knows of an easier way, I'm all ears.

Thanks

+1  A: 

You may want to check your first line. You neeed to pass IntPtr.Zero instead of Null -- thats usually the best way to get the Desktop. The Shell Services Service should also be running (usually under a completely different name) and Explorer needs to be running as well... After that, I'd consider seeing if running Spy++ will Enlighten.

A: 

On my system, the hierarchy is

Shell_TrayWnd -> TrayNotifyWnd -> SysPager -> ToolbarWindow32

Jim C