gpt4 book ai didi

c# - Windows Server 2008 中没有气球工具提示关闭按钮

转载 作者:太空狗 更新时间:2023-10-29 23:51:53 25 4
gpt4 key购买 nike

我的程序在应用程序中使用气球通知气泡来引导用户,在 Windows XP 中,气球窗口的右上角有小“X”以在单击时关闭窗口,如果您单击内部的任何位置,窗口也会关闭即使您不点击“X”也是如此。

但是,当程序在 Windows Server 2008 上运行时,会出现气球但没有“X”按钮,并且在我单击它们时也不会关闭。

我偶然删除了一个包含以下内容的 .MANIFEST 文件,成功地复制了 Windows XP 中的行为:

<?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>

当我删除此 list 并在 Windows XP 中运行我的程序时,气球的行为就像在 Windows Server 2008 中一样。我假设这可能意味着与 Windows Server 2008 中的 Common Controls v6 存在某种不兼容。

有谁知道可能导致气球在点击时不关闭并且没有“X”关闭按钮的原因?

更新:这是气球创建代码:

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);

Windows 构建信息:Windows Server Standard,SP2,32 位

最佳答案

这可能无济于事,我不想轻描淡写,但我遇到过一些问题,其中应用程序由于文件/文件夹权限而无法访问 DLL,并且还看到文件在传输时在哪里被锁定计算机之间(甚至是同一域内的计算机)。要取消阻止它,您必须通过 Windows 资源管理器进入文件的属性,在“高级”下并取消阻止文件。

关于c# - Windows Server 2008 中没有气球工具提示关闭按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14343828/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com