5

My program uses balloon notification bubbles within the app to guide the user, in Windows XP the balloon windows have little 'X's in the top right corner to close the window when clicked, and also the window closes if you click anywhere inside of it even if you don't click the 'X'.

However when the program is running on Windows Server 2008 the balloons appear but have no 'X' buttons and do not close when I click on them either.

By accident I managed to replicate the behavior in Windows XP by deleting a .MANIFEST file that contains this:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity version="2.0.0.0" processorArchitecture="x86" name="SofrwareName" type="win32" />
    <dependency>
        <dependentAssembly>
            <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="<Removed>" language="*" processorArchitecture="x86" />
        </dependentAssembly>
    </dependency>
</assembly>

When I delete this manifest and run my program in Windows XP the balloon acts just like it does in Windows Server 2008. I'm assuming that this might mean some sort of incompatibility with Common Controls v6 in Windows Server 2008.

Does anyone know what might be causing the balloons not to close on click and to have no 'X' close buttons?

UPDATE: Here is the balloon creation code:

m_tool = new MessageTool(); //internal class MessageTool : NativeWindow {...}

CreateParams cp = new CreateParams();
cp.ClassName = TOOLTIPS_CLASS; //TOOLTIPS_CLASS = "tooltips_class32";
cp.Style =
    WS_POPUP |
    TTS_BALLOON |
    TTS_NOPREFIX |
    TTS_ALWAYSTIP |
    TTS_CLOSE;

m_ti = new TOOLINFO();
/*
[StructLayout(LayoutKind.Sequential)]
private struct TOOLINFO
{
    public int cbSize;
    public int uFlags;
    public IntPtr hwnd;
    public IntPtr uId;
    public RECT rect;
    public IntPtr hinst;
    [MarshalAs(UnmanagedType.LPTStr)]
    public string lpszText;
    public uint lParam;
}
*/

m_ti.cbSize = Marshal.SizeOf(m_ti);

m_tool.CreateHandle(cp);

m_ti.uFlags = TTF_TRACK |
    TTF_CLOSEONMOUSECLICK |
    TTF_TRANSPARENT |
    TTF_SUBCLASS |
    TTF_PARSELINKS;

m_ti.uId = m_tool.Handle;
m_ti.lpszText = m_text;
m_ti.hwnd = m_parent.Handle;

WindowsAPI.GetClientRect(m_parent.Handle, ref m_ti.rect);
ClientToScreen(m_parent.Handle, ref m_ti.rect);

WindowsAPI.SetWindowPos(
    m_tool.Handle,
    HWND_TOP,
    0, 0, 0, 0,
    (int)SetWindowPosFlags.SWP_NOACTIVATE |
    (int)SetWindowPosFlags.SWP_NOMOVE |
    (int)SetWindowPosFlags.SWP_NOSIZE);

IntPtr ptrStruct = Marshal.AllocHGlobal(Marshal.SizeOf(m_ti));
Marshal.StructureToPtr(m_ti, ptrStruct, true);

WindowsAPI.SendMessage(
    m_tool.Handle, TTM_ADDTOOL, 0, ptrStruct);

m_ti = (TOOLINFO)Marshal.PtrToStructure(ptrStruct,
    typeof(TOOLINFO));

WindowsAPI.SendMessage(
    m_tool.Handle, TTM_SETMAXTIPWIDTH,
    0, new IntPtr(m_maxWidth));

WindowsAPI.SendMessage(
    m_tool.Handle, TTM_SETTITLE,
    (int)m_titleIcon, ptrTitle);

SetBalloonPosition(m_ti.rect);

Marshal.FreeHGlobal(ptrStruct);
Marshal.FreeHGlobal(ptrTitle);

And Windows build info: Windows Server Standard, SP2, 32-bit

Kyle V.
  • 4,752
  • 9
  • 47
  • 81
  • Be more specific about the exact Server 2008 edition and the kind of tooltip you are using. A snippet that shows how the tooltip is displayed should be included too. – Hans Passant Jan 15 '13 at 18:04
  • @HansPassant Added snippet and Windows version info for you. – Kyle V. Jan 15 '13 at 18:43
  • @HansPassant I am mostly looking for known compatibility issues with Win2008 and Common Controls v6, so it's not "too localized". Hence why I initially didn't bother including code. – Kyle V. Jan 15 '13 at 19:06

1 Answers1

0

This may not help, and I hate to trivialize it, but I've had issues wherein the application did not have access to the DLLs due to file/folder permissions, and have also seen where a file becomes locked when transferring it between computers (even computers within the same domain). To unblock it, you have to go into the properties of the file via Windows Explorer, under Advanced and unblock the file.

Michael
  • 1,786
  • 5
  • 23
  • 42
  • Which .dll files would we be talking about in this case? – Kyle V. Jan 28 '13 at 14:28
  • Apologies, I assumed the balloon notification bubbles came as a control from Microsoft.Windows.Common-Controls; however re-read and you said the control loads excepting the x button, so it's likely not that. However, it's possible any external files referenced by that assembly (for example, a collection of icon files stored as a single ico file or even a simple gif) can not be accessed because the developers assembly when compiled assumed it had permission, as there was no concept of UAC. Assuming it's a control you're loading, are there any ChildControls or members that you can access... – Michael Jan 28 '13 at 19:05
  • ...to see if the x button is attempting to even load? It's also feasible and simple that the x is loading but is showing behind the balloon i.e. has a lower z-index than the balloon... Sorry I know this is nothing concrete but hope something helps. – Michael Jan 28 '13 at 19:06
  • It's a little more involved than just the X button not showing. For some reason the behavior we coded in where clicking ANYWHERE inside of the balloon window closes the balloon is broken too. Both when used in Win 2008 or when used in XP with the manifest file deleted. – Kyle V. Jan 28 '13 at 19:19
  • See this other post from stackoverflow: http://stackoverflow.com/questions/10330105/could-not-find-file-microsoft-windows-common-controls-version-6-0-0-0-culture – Michael Jan 28 '13 at 19:30
  • Unfortunately, you might just have to use a different control for notification balloons. Sorry I don't have better news. – Michael Jan 28 '13 at 19:31
  • Also see: http://www.codeproject.com/Articles/137552/WPF-TaskDialog-Wrapper-and-Emulator – Michael Jan 28 '13 at 19:32