隐藏或显示托盘图标
如何隐藏程序

---- 为了处理图标回调消息,如鼠标左键双击、鼠标右键单击消息,我们重载WindowProc()函数。此外,我们还希望在主框架窗口最小化时图标不在任务栏的空白区出现,在此函数中同时作相应处理。
LRESULT CMainFrame::WindowProc
NIF_ICON 设置成员hIcon有效
NIF_MESSAGE 设置成员uCallbackMessage有效
NIF_TIP 设置成员szTiOTIFYICONDATA结构的保护成员变量
m_tnid,并在其OnCreate函数中return
语句前加入生成托盘图标的代码:
m_tnid.cbSize=sizeof(NOTIFYICONDATA);
m_tnid.hWnd=this-> m_hWnd;
//如果是用户定义的消息
if(lParam==WM_LBUTTONDBLCLK)
{ //鼠标双击时主窗口出现
AfxGetApp()-> m_pMainWnd->
ShowWindow(SW_SHOW);
}
else if(lParam==WM_RBUTTONDOWN){
NIM_DELETE 删除图标
NIM_MODIFY 修改图标
---- 三、托盘图标程序设计示例
return 0;
}
break;
}
return CFrameWnd::WindowProc
(message, wParam, lParam);
}
---- 为使应用程序退出时图标消失,映射WM_DESTROY消息,在OnDestroy()函数中加入:
::Shell_NotifyIcon(NIM_DELETE,&m_tnid);
显示隐藏工具栏快捷键

显示隐藏工具栏快捷键在日常使用计算机的过程中,经常会需要使用一些常用的工具栏进行操作,如文件操作、编辑、格式化等。
为了方便用户的操作,很多软件都提供了显示和隐藏工具栏的功能,并且还可以通过一些快捷键来实现,从而提高了操作效率。
本文将为大家介绍一些常见软件中显示隐藏工具栏的快捷键。
一、Microsoft WordMicrosoft Word是一款功能强大的文字处理软件,在书写、编辑文档时经常需要使用到各种工具栏。
下面是一些常见的显示隐藏工具栏的快捷键。
1. 显示/隐藏标准工具栏:按下Ctrl + Shift + N即可显示和隐藏标准工具栏。
2. 显示/隐藏格式化工具栏:按下Ctrl + Shift + F即可显示和隐藏格式化工具栏。
3. 显示/隐藏绘图工具栏:按下Ctrl + T即可显示和隐藏绘图工具栏。
4. 显示/隐藏状态栏:按下Ctrl + Shift + S即可显示和隐藏状态栏。
二、Adobe PhotoshopAdobe Photoshop是一款专业的图片处理软件,对于需要编辑和美化图片的用户来说,经常需要使用到各种工具栏。
下面是一些常见的显示隐藏工具栏的快捷键。
1. 显示/隐藏标准工具栏:按下Tab键即可显示和隐藏标准工具栏。
2. 显示/隐藏选项栏:按下Ctrl + Alt + Shift + H即可显示和隐藏选项栏。
3. 显示/隐藏图层面板:按下F7即可显示和隐藏图层面板。
4. 显示/隐藏历史记录面板:按下Ctrl + Alt + Shift + H即可显示和隐藏历史记录面板。
三、Adobe IllustratorAdobe Illustrator是一款专业的矢量图形编辑软件,对于需要设计和制作矢量图形的用户来说,经常需要使用到各种工具栏。
下面是一些常见的显示隐藏工具栏的快捷键。
1. 显示/隐藏工具栏:按下Tab键即可显示和隐藏工具栏。
2. 显示/隐藏控制面板:按下Ctrl + Shift + F2即可显示和隐藏控制面板。
系统托盘图标隐藏解决方法

系统托盘图标不见了,你没有办法判断现在的输入法、时间、甚至没有办法调节音量。
有网友可能就会问了,系统托盘图标是什么?在哪里?其实通常我们所说的系统托盘在我们操作系统桌面的右下角。
系统托盘图标“隐藏”了该怎么办呢?通常我们会采取以下途径解决问题。
输入法图标丢失
从“控制面板”下打开“区域和语言选项”-“语言”-“详细信息”-“语言栏”,“在桌面显示语言栏”前打上√就可以了。
如图1:
图1
音量控制图标丢失
从“控制面板”中打开“声音和音频设备属性”窗口,然后勾选“将音量图标放入任务栏”复选框就行了。
如图2:
图2
任务栏丢失
打开注册表编辑器,找到
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer下的StuckRects子键,将它删除后重新启动计算机就可以了。
c#win32Api接口隐藏第三方软件应用程序的右下角图标托盘图标

c#win32Api接⼝隐藏第三⽅软件应⽤程序的右下⾓图标托盘图标使⽤⽅法SetTrayIconVisible("qq", false);//获取托盘指针private static IntPtr TrayToolbarWindow32(){IntPtr h = IntPtr.Zero;IntPtr hTemp = IntPtr.Zero;h = Win32API.FindWindow("Shell_TrayWnd", null); //托盘容器h = Win32API.FindWindowEx(h, IntPtr.Zero, "TrayNotifyWnd", null);//找到托盘h = Win32API.FindWindowEx(h, IntPtr.Zero, "SysPager", null);hTemp = Win32API.FindWindowEx(h, IntPtr.Zero, "ToolbarWindow32", null);return hTemp;}//显⽰/隐藏单个系统托盘图标,由参数caption指定图标public static void SetTrayIconVisible(string caption, bool isShow){IntPtr vHandle = TrayToolbarWindow32();int vCount = Win32API.SendMessage(vHandle, Win32API.TB_BUTTONCOUNT, 0, 0);IntPtr vProcessId = IntPtr.Zero;Win32API.GetWindowThreadProcessId(vHandle, ref vProcessId);IntPtr vProcess = Win32API.OpenProcess(Win32API.PROCESS_VM_OPERATION | Win32API.PROCESS_VM_READ | Win32API.PROCESS_VM_WRITE, IntPtr.Zero, vProcessId);IntPtr vPointer = Win32API.VirtualAllocEx(vProcess, (int)IntPtr.Zero, 0x1000,Win32API.MEM_RESERVE | Win32API.MEM_COMMIT, Win32API.PAGE_READWRITE);char[] vBuffer = new char[256];IntPtr pp = Marshal.UnsafeAddrOfPinnedArrayElement(vBuffer, 0);uint vNumberOfBytesRead = 0;try{for (int i = 0; i < vCount; i++){Win32API.SendMessage(vHandle, Win32API.TB_GETBUTTONTEXT, i, vPointer.ToInt32());Win32API.ReadProcessMemoryEx(vProcess, vPointer,Marshal.UnsafeAddrOfPinnedArrayElement(vBuffer, 0),vBuffer.Length * sizeof(char), ref vNumberOfBytesRead);int l = 0;for (int j = 0; j < vBuffer.Length; j++){if (vBuffer[j] == (char)0){l = j;break;}}string s = new string(vBuffer, 0, l);if (s.IndexOf(caption) >= 0){if (isShow)Win32API.SendMessage(vHandle, Win32API.TB_HIDEBUTTON, i, 0);elseWin32API.SendMessage(vHandle, Win32API.TB_HIDEBUTTON, i, 1);}Console.WriteLine(s);}}finally{Win32API.VirtualFreeEx(vProcess, vPointer, 0, Win32API.MEM_RELEASE);Win32API.CloseHandle(vProcess);}}using System;using System.Collections.Generic;using System.Text;using System.Runtime.InteropServices;/********************************************************************************* 资料收集:Jonny Sun ,* ******************************************************************************/namespace HideIcon{/// <summary>/// 操作Windows窗体,系统托盘所⽤的API函数/// </summary>public class Win32API{public const int WM_USER = 0x400;public const int WM_CLOSE = 0x10;public const int WM_GETTEXT = 0x000D;public const int WM_SETTEXT = 0x000C;public const int STANDARD_RIGHTS_REQUIRED = 0xF0000;public const int SYNCHRONIZE = 0x100000;public const int PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF;public const int PROCESS_TERMINATE = 0x1;public const int PROCESS_VM_OPERATION = 0x8;public const int PROCESS_VM_READ = 0x10;public const int PROCESS_VM_WRITE = 0x20;public const int MEM_RESERVE = 0x2000;public const int MEM_COMMIT = 0x1000;public const int MEM_RELEASE = 0x8000;public const int PAGE_READWRITE = 0x4;public const int TB_BUTTONCOUNT = (WM_USER + 24);public const int TB_HIDEBUTTON = (WM_USER + 4);public const int TB_GETBUTTON = (WM_USER + 23);public const int TB_GETBUTTONTEXT = WM_USER + 75;public const int TB_GETBITMAP = (WM_USER + 44);public const int TB_DELETEBUTTON = (WM_USER + 22);public const int TB_ADDBUTTONS = (WM_USER + 20);public const int TB_INSERTBUTTON = (WM_USER + 21);public const int TB_ISBUTTONHIDDEN = (WM_USER + 12);public const int ILD_NORMAL = 0x0;public const int TPM_NONOTIFY = 0x80;public const int WS_VISIBLE = 268435456;//窗体可见public const int WS_MINIMIZEBOX = 131072;//有最⼩化按钮public const int WS_MAXIMIZEBOX = 65536;//有最⼤化按钮public const int WS_BORDER = 8388608;//窗体有边框public const int GWL_STYLE = (-16);//窗体样式public const int GW_HWNDFIRST = 0;public const int GW_HWNDNEXT = 2;public const int SW_HIDE = 0;public const int SW_SHOW = 5;[DllImport("User32.Dll")]public static extern void GetClassName(IntPtr hwnd, StringBuilder s, int nMaxCount);[DllImport("user32.dll", EntryPoint = "SetForegroundWindow", SetLastError = true)]public static extern void SetForegroundWindow(IntPtr hwnd);[DllImport("user32.dll", EntryPoint = "GetDlgItem", SetLastError = true)]public static extern IntPtr GetDlgItem(int nID, IntPtr phWnd);[DllImport("user32.dll", CharSet = CharSet.Auto)]public static extern int RegisterWindowMessage(string msg);[DllImport("kernel32", EntryPoint = "OpenProcess")]public static extern IntPtr OpenProcess(int dwDesiredAccess, IntPtr bInheritHandle, IntPtr dwProcessId);[DllImport("kernel32", EntryPoint = "CloseHandle")]public static extern int CloseHandle(IntPtr hObject);[DllImport("user32", EntryPoint = "GetWindowThreadProcessId")]public static extern IntPtr GetWindowThreadProcessId(IntPtr hwnd, ref IntPtr lpdwProcessId);[DllImport("user32.dll")]public static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);[DllImport("user32", EntryPoint = "SendMessage")]public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);[DllImport("user32", EntryPoint = "SendMessage")]public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, IntPtr lParam);[DllImport("kernel32", EntryPoint = "ReadProcessMemory")]public static extern int ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, ref IntPtr lpBuffer, int nSize, int lpNumberOfBytesWritten);[DllImport("kernel32.dll", EntryPoint = "ReadProcessMemory")]public static extern bool ReadProcessMemoryEx(IntPtr hProcess, IntPtr lpBaseAddress, IntPtr lpBuffer, int nSize, ref uint vNumberOfBytesRead); [DllImport("kernel32", EntryPoint = "ReadProcessMemory")]public static extern int ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, int nSize, int lpNumberOfBytesWritten);[DllImport("kernel32", EntryPoint = "WriteProcessMemory")]public static extern int WriteProcessMemory(IntPtr hProcess, ref int lpBaseAddress, ref int lpBuffer, int nSize, ref int lpNumberOfBytesWritten);[DllImport("kernel32", EntryPoint = "VirtualAllocEx")]public static extern IntPtr VirtualAllocEx(IntPtr hProcess, int lpAddress, int dwSize, int flAllocationType, int flProtect);[DllImport("kernel32", EntryPoint = "VirtualFreeEx")]public static extern int VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, int dwFreeType);[DllImport("User32.dll")]public extern static int GetWindow(int hWnd, int wCmd);[DllImport("User32.dll")]public extern static int GetWindowLongA(int hWnd, int wIndx);[DllImport("user32.dll")]public static extern bool GetWindowText(int hWnd, StringBuilder title, int maxBufSize);[DllImport("user32.dll", CharSet = CharSet.Auto)]public extern static int GetWindowTextLength(IntPtr hWnd);[DllImport("User32.dll", EntryPoint = "FindWindow")]public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);[DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true)]public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); [DllImport("user32.dll", EntryPoint = "ShowWindow", SetLastError = true)]public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);[DllImport("user32.dll", EntryPoint = "SendMessageA")]public static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);}}。
隐藏或显示托盘图标(Hideorshowthetrayicon)

隐藏或显示托盘图标(Hide or show the tray icon)Hide or show the tray icon.Txt my life A as B, your life is B S. Failure is not terrible, the key is not the mother of success. The students now not too much quality! Come copy feather, actually by shear! Free to study Feng Shui, after the death of a tomb is made up of living can't afford to buy a house.'definition statementOption ExplicitPrivate Const WM_USER = &H400Private Const = TB_BUTTONCOUNT (WM_USER + 24)Private Const = TB_HIDEBUTTON (WM_USER + 4)Private Const = TB_GETBUTTONTEXTA (WM_USER + 45)Private Const = TB_AUTOSIZE (WM_USER + 33)Private Const MEM_COMMIT = &H1000Private Const MEM_RESERVE = &H2000Private Const MEM_RELEASE = &H8000Private Const PAGE_READWRITE = &H4Private Const = PROCESS_VM_OPERATION (&H8)Private Const = PROCESS_VM_READ (&H10)Private Const = PROCESS_VM_WRITE (&H20)Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String ByVal lpWindowName As String As Long)Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long ByVal hwnd2 As Long ByVal lpsz1, As String, ByVal lpsz2 As String As Long)Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long ByVal wMsg As Long ByVal wParam, As Long, lParam As Any As Long)Private Declare Function VirtualAllocEx Lib "kernel32.dll" (ByVal hProcess As Long, lpAddress As Any, ByRef dwSize As Long ByVal flAllocationType, As Long, ByVal flProtect As Long As Long)Private Declare Function VirtualFreeEx Lib "kernel32.dll" (ByVal hProcess As Long, lpAddress As Any, ByRef dwSize As Long ByVal dwFreeType As Long As Long)Private Declare Function OpenProcess Lib "Kernel32" (ByVal dwDesiredAccess As Long ByVal bInheritHandle, As Long, ByVal dwProcessId As Long As Long)Private Declare Function CloseHandle Lib "Kernel32" (ByVal hObject As Long As Long)Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long lpdwProcessId As Long As Long)Private Declare Function ReadProcessMemory Lib "Kernel32" (ByVal hProcess As Long, lpBaseAddress As Any,lpBuffer任何,ByVal nSize为长,长,长lpnumberofbyteswritten)私人声明函数WriteProcessMemory lib“功能”(ByVal hprocess 一样长,lpbaseaddress任何lpBuffer任何,ByVal nSize,长,长时间lpnumberofbyteswritten)私人声明函数getcurrentprocessid lib“功能”()长“形式窗体“需要的控件:command1,Command2、Command3,列表框“隐藏指定图标私有子command1_click()昏暗的pidexplorer一样长,二的句柄一样长,hexplorer一样长,lpicontext长我作为整数暗淡昏暗的btncount为整数昏暗的iContext作为字符串二的句柄= FindWindow(“shell_traywnd”:)二的句柄= FindWindowEx(二的句柄,0,“traynotifywnd”:)二的句柄= FindWindowEx(二的句柄,0,“syspager”:)二的句柄= FindWindowEx(二的句柄,0,“toolbarwindow32”:)getwindowthreadprocessid二的句柄,pidexplorerhexplorer = OpenProcess(process_vm_operation或process_vm_read或process_vm_write,虚假,pidexplorer)lpicontext = virtualallocex(ByVal hexplorer,ByVal 0、Len (iContext),mem_commit或mem_reserve,page_readwrite)btncount = SendMessage(二的句柄,tb_buttoncount,0, 0)昏暗的花粉一样长,sbuff作为字符串我btncount = 0 - 1(256)美元的iContext =空间LLEN = SendMessage(二的句柄,tb_getbuttontexta、我、ByVal lpIconText)hexplorer ReadProcessMemory,ByVal lpIconText,ByVal IconText,Len(iContext),0如果同步<> 1然后iContext =美金(iContext,仪器(1美元的iContext,CHR(0))- 1)如果iContext = List1.列表(List1. ListIndex)然后替换为需要隐藏的图标名称:就是鼠标放在图标上时显示的文字SendMessage二的句柄,tb_hidebutton,我,ByVal TrueSendMessage二的句柄,tb_autosize,0, 0最后如果下一个virtualfreeex hexplorer,lpicontext、Len(iContext),mem_releasehexplorer CloseHandle端子“显示指定图标私有子command2_click()昏暗的pidexplorer长,hexplorer = OpenProcess(process_vm_operation或process_vm_read或process_vm_write,虚假,pidexplorer)lpicontext = virtualallocex(ByVal hexplorer,ByVal 0、Len (iContext),mem_commit或mem_reserve,page_readwrite)btncount = SendMessage(二的句柄,tb_buttoncount,0, 0)昏暗的花粉一样长,sbuff作为字符串我btncount = 0 - 1(256)美元的iContext =空间LLEN = SendMessage(二的句柄,tb_getbuttontexta、我、ByVal lpIconText)hexplorer ReadProcessMemory,ByVal lpIconText,ByVal IconText,Len(iContext),0如果同步<> 1然后iContext =美金(iContext,仪器(1美元的iContext,CHR(0))- 1)list1.additem iContext下一个virtualfreeex hexplorer,lpicontext、Len(iContext),mem_releasehexplorer CloseHandle端子私有子form_load()command3_clickcommand1_click端子。
实现将程序图标显示在系统托盘

长久以来,一直很好奇类似QQ等软件的图标是如何显示在系统托盘的,这次有个项目正好用到,所以就研究了一下。
具体方法如下:1、首先我们需要在工具栏找到NotifyIcon这个控件,找到后将其拖到Form中。
然后,我们需要设置其Icon属性、Text属性和Visible属性。
其中:Icon属性是设置显示在右下角系统托盘的图标。
Text属性是设置当鼠标移动到系统托盘图标时显示的文字,一般设置为软件的名称。
Visible属性是设置小图标是否显示在系统托盘。
注意:如果程序退出前没有将其设置为false,那么小图标将一直停留在系统栏,直到鼠标从上面经过时才会消失。
2、基本属性设置完之后,我们要将程序主窗体的ShowInTaskBar设置为True。
这样小图标才可以显示在系统托盘中,一般,这个属性默认就是True。
3、设置完属性,我们就需要对NotifyIcon方法进行实现。
我要做的实现是当点击最小化时,让程序的图标出现在“系统托盘”的位置上,而不显示在“任务栏”中。
当双击系统托盘上的图标时,还原程序窗体,再次双击时最小化到系统托盘。
点击程序的关闭按钮,正常退出程序。
要实现上面的功能我们需要实现两个方法:一个方法是主窗体的SizeChanged事件。
view plai n1./// <summary>2./// 最小化时到系统托盘3./// </summary>4./// <param name="sender"></param>5./// <param name="e"></param>6.private void MainForm_SizeChanged(object sender, EventArgs e)7.{8.if (this.WindowState == FormWindowState.Minimized) //判断是否最小化9. {10.this.ShowInTaskbar = false; //不显示在系统任务栏11. }12.}一个是NotifyIcon的双击事件。
隐藏托盘图标
1.通过”开始--运行”, 在”运行”中输入gpedit.msc,打开”组策略编辑器”
2.依次定位到”用户配置--管理模板--任务栏和开始菜单”,双击右侧窗口中的”隐藏通知区域”,将其设置为”已启用”,确认操作并退出编辑器.
3.此时,隐藏通知区域(即系统托盘)并没有开始起作用,通常我们要注销系统或重新启动,如果你不想重新启动系统,也可以通过”Ctrl+shift+Esc"组合键打开任务管理器,选中并结束Explorer.exe进程,然后再重新运行此进程,这时系统托盘就彻底隐藏了起来.
如果需要在不影响当前任务的情况下(即不重启,不注销)重新显示系统托盘,可以将组策略中的值恢复,然后重新调用一次Explorer进程即可.
这个方法会把托盘区全部隐藏 你也可以下载一个HideHelper 软件隐藏你要隐藏的系统托盘图标
一秒一卡,十分潇洒。一走一停Байду номын сангаас十分有型。三秒一卡,等我到傻。五步一停,摆个造型。一心等待,缓冲失败。卡卡停停 ,不服不行。
如何隐藏qq托盘的图标
如何隐藏QQ托盘的图标
很多上班族上班的时候想要挂QQ,但是电脑托盘上图标又显示,拍被领导看到会责怪,如果可以隐藏的话那就不用当心了。
这里就叫一下大家如何隐藏QQ图标。
1.首先要打开系统设置。
2.然后依次点击基本设置-热键-设置热键。
3然后把提取消息的热键设置为一个方便按下的数字。
当然也不要和其他快捷键起冲突哦。
我这里设置的是ctrl+alt+z,点击快捷键设置的地方、按下键盘上面的ctrl+alt+z键即可!!【最好设置简单一点的,比如f11就可以直接点击f11了】
4.设置之后回到主面板,把主面板里面的“在任务栏通知区域显示QQ图标”前面的勾勾去掉。
然后把QQ最小化就可以了,如果要看消息的话,直接点击设置好的提取消息的快捷键就可以看到了哦。
radmin手册
一客户端安装1. 直接执行RADMIN22.exe 自动加载到服务里面,并自动设置为每次开机自运行,安装好缺省密码为:88888888 缺省端口:99882.如果要改动客户端密码和端口,在开始——〉运行里面键入“r_server /setup”会弹出如下窗口。
(在DOS命令行下面执行也可,r_server 接下面的参数需要空格)●Startup mode 设置启动的时是否自动加载●Set password 设置客户端的连接密码●Option 设置客户端的连接端口,还可以设置ip过滤,可以指定ip的服务端才能控制,是否在托盘中显示图标。
请见下图:e IP Filter 为指定ip地址的服务端访问2.port 里面随意更改客户端的端口,(需用任意的端口号,Use default port 不用打构,)使用80,21,等特殊端口,都可3.Hide tray icon 为是否在任务栏的托盘中显示客户端图标3. 设置完上述选项后,需要重起一下客户端才能生效。
●关闭客户端,在运行里面键入r_server /stop(在DOS命令行下面执行也可,r_server 接下面的参数需要空格) 等待5秒钟●启动客户端,在运行里面键入r_server /start(在DOS命令行下面执行也可,r_server 接下面的参数需要空格) 等待5秒钟4. 卸载客户端,请在运行里面键入r_server /uninstall上述只阐述了些基本的设置,详细命令修改请看软件自带的radmin22.txt,里面还有教怎么使用网络安装客户端,有兴趣的可以一起学习一下该软件。
二服务器端设置1.直接运行程序radmin30.exe 该程序会自动解压缩到当前的目录,然后执行radmin30b.exe 文件会弹出如下服务端控制窗口。
点击连接菜单选中,连接到会弹出连接客户端配置界面。
●在项目名称中可以定义该ip地址相应机器的名称,方便记忆●在ip地址和dns名称里面输入需要控制的客户端机器的ip地址●端口里面输入连接的客户端的端口号,需要和该客户端配置的端口号一致,默认端口为9988●点击左面树列中的“远程屏幕”菜单,会让你选择察看客户端的色彩,建议使用16色可以大大提高性能。
Qt窗口的一些简单设置-标题、图标、最大化最小化按钮、任务栏图标
Qt窗⼝的⼀些简单设置-标题、图标、最⼤化最⼩化按钮、任务栏图标零零碎碎看了很多Qt例⼦,有⼀些很零散的窗体控制⽅法,在这总结⼀些。
1.更改窗体标题this->setWindowTitle("窗体标题");窗体标题”就是更改的窗体标题2.控制窗体⼤⼩1this->setMaximumSize(300,300); //窗体最⼤尺⼨2this->setMinimumSize(300,300); //窗体最⼩尺⼨3this->setMinimumHeight(300); //单独设置窗体⾼的最⼩值4this->setMaximumWidth(300); //单独设置窗体宽的最⼩值也可以通过窗体布局控制窗体⼤⼩1 QGridLayout *mainLayout = new QGridLayout; //窗体中控件为⽹格布局2 mainLayout->setSizeConstraint(QLayout::SetFixedSize); //布局⼤⼩不变在构造函数中的这个函数强制设置窗体的布局为固定⼤⼩,⽤户不可⾃⾏调整对话框⼤⼩。
布局管理器将会负责调整⼤⼩的任务,当⼀些⼦窗⼝期间显⽰或隐藏的时候⾃动的调整对话框的⼤⼩,以保证对话框总是以优化了的⼤⼩显⽰。
在官⽅⽂档中setSizeConstraint给的解释为:sizeConstraint:SizeConstraint. This property holds the resize mode of the layout.这个函数主要是通过布局管理器对布局⼤⼩进⾏限制,与上⾯介绍的窗体⼤⼩有所不同。
函数SetFixedSize如下:void QWidget::setFixedSize(const QSize &s);设置控件的最⼤和最⼩尺⼨为s,防⽌控件⼤⼩的变化。
3.更改窗体图标⾸先在项⽬右键-->添加新⽂件,弹出如下对话框在左侧选中Qt,右侧选择Qt Resource File,然后Choose,页⾯如下:如果路径没错的话就⾃⼰命⼀个名字例如:icon,然后下⼀步,⼀路next知道完成。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
隐藏或显示托盘图标.txt逆风的方向,更适合飞翔。
我不怕万人阻挡,只怕自己投降。
你发怒一分钟,便失去60分钟的幸福。
忙碌是一种幸福,让我们没时间体会痛苦;奔波是一种快乐,让我们真实地感受生活;疲惫是一种享受,让我们无暇空虚。
生活就像"呼吸""呼"是为出一口气,"吸"是为争一口气。
'声明定义Option ExplicitPrivate Const WM_USER = &H400Private Const TB_BUTTONCOUNT = (WM_USER + 24)Private Const TB_HIDEBUTTON = (WM_USER + 4)Private Const TB_GETBUTTONTEXTA = (WM_USER + 45)Private Const TB_AUTOSIZE = (WM_USER + 33)Private Const MEM_COMMIT = &H1000Private Const MEM_RESERVE = &H2000Private Const MEM_RELEASE = &H8000Private Const PAGE_READWRITE = &H4Private Const PROCESS_VM_OPERATION = (&H8)Private Const PROCESS_VM_READ = (&H10)Private Const PROCESS_VM_WRITE = (&H20)Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hwnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPrivate Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function VirtualAllocEx Lib "kernel32.dll" (ByVal hProcess As Long, lpAddress As Any, ByRef dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As LongPrivate Declare Function VirtualFreeEx Lib "kernel32.dll" (ByVal hProcess As Long, lpAddress As Any, ByRef dwSize As Long, ByVal dwFreeType As Long) As Long Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As LongPrivate Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As LongPrivate Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As LongPrivate Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As LongPrivate Declare Function GetCurrentProcessId Lib "kernel32" () As Long'Form窗体'需要的控件:Command1,Command2,Command3,ListBoxPrivate Sub Command1_Click() '隐藏指定图标Dim pIdExplorer As Long, hwnd2 As Long, hExplorer As Long, lpIconText As Long Dim i As IntegerDim BtnCount As IntegerDim IconText As Stringhwnd2 = FindWindow("Shell_TrayWnd", vbNullString)hwnd2 = FindWindowEx(hwnd2, 0, "TrayNotifyWnd", vbNullString)hwnd2 = FindWindowEx(hwnd2, 0, "SysPager", vbNullString)hwnd2 = FindWindowEx(hwnd2, 0, "ToolbarWindow32", vbNullString)GetWindowThreadProcessId hwnd2, pIdExplorerhExplorer = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, pIdExplorer)lpIconText = VirtualAllocEx(ByVal hExplorer, ByVal 0&, Len(IconText), MEM_COMMIT Or MEM_RESERVE, PAGE_READWRITE)BtnCount = SendMessage(hwnd2, TB_BUTTONCOUNT, 0, 0)Dim lLen As Long, sBuff As StringFor i = 0 To BtnCount - 1IconText = Space$(256)lLen = SendMessage(hwnd2, TB_GETBUTTONTEXTA, i, ByVal lpIconText)ReadProcessMemory hExplorer, ByVal lpIconText, ByVal IconText, Len(IconText), 0If lLen <> -1 Then IconText = Left$(IconText, InStr(1, IconText, Chr$(0)) - 1)If IconText = List1.List(List1.ListIndex) Then ' 替换为需要隐藏的图标名称:就是鼠标放在图标上时显示的文字SendMessage hwnd2, TB_HIDEBUTTON, i, ByVal TrueSendMessage hwnd2, TB_AUTOSIZE, 0, 0End IfNextVirtualFreeEx hExplorer, lpIconText, Len(IconText), MEM_RELEASECloseHandle hExplorerEnd SubPrivate Sub Command2_Click() '显示指定图标Dim pIdExplorer As Long, hwnd2 As Long, hExplorer As Long, lpIconText As Long Dim i As IntegerDim BtnCount As IntegerDim IconText As Stringhwnd2 = FindWindow("Shell_TrayWnd", vbNullString)hwnd2 = FindWindowEx(hwnd2, 0, "TrayNotifyWnd", vbNullString)hwnd2 = FindWindowEx(hwnd2, 0, "SysPager", vbNullString)hwnd2 = FindWindowEx(hwnd2, 0, "ToolbarWindow32", vbNullString)GetWindowThreadProcessId hwnd2, pIdExplorerhExplorer = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, pIdExplorer)lpIconText = VirtualAllocEx(ByVal hExplorer, ByVal 0&, Len(IconText), MEM_COMMIT Or MEM_RESERVE, PAGE_READWRITE)BtnCount = SendMessage(hwnd2, TB_BUTTONCOUNT, 0, 0)Dim lLen As Long, sBuff As StringFor i = 0 To BtnCount - 1IconText = Space$(256)lLen = SendMessage(hwnd2, TB_GETBUTTONTEXTA, i, ByVal lpIconText)ReadProcessMemory hExplorer, ByVal lpIconText, ByVal IconText, Len(IconText), 0If lLen <> -1 Then IconText = Left$(IconText, InStr(1, IconText, Chr$(0)) - 1)If IconText = List1.List(List1.ListIndex) Then ' ' 替换为需要隐藏的图标名称:就是鼠标放在图标上时显示的文字SendMessage hwnd2, TB_HIDEBUTTON, i, ByVal FalseSendMessage hwnd2, TB_AUTOSIZE, 0, 0End IfNextVirtualFreeEx hExplorer, lpIconText, Len(IconText), MEM_RELEASECloseHandle hExplorerEnd SubPrivate Sub Command3_Click() '刷新图标列表List1.ClearDim pIdExplorer As Long, hwnd2 As Long, hExplorer As Long, lpIconText As Long Dim i As IntegerDim BtnCount As IntegerDim IconText As Stringhwnd2 = FindWindow("Shell_TrayWnd", vbNullString)hwnd2 = FindWindowEx(hwnd2, 0, "TrayNotifyWnd", vbNullString)hwnd2 = FindWindowEx(hwnd2, 0, "SysPager", vbNullString)hwnd2 = FindWindowEx(hwnd2, 0, "ToolbarWindow32", vbNullString)GetWindowThreadProcessId hwnd2, pIdExplorerhExplorer = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, pIdExplorer)lpIconText = VirtualAllocEx(ByVal hExplorer, ByVal 0&, Len(IconText), MEM_COMMIT Or MEM_RESERVE, PAGE_READWRITE)BtnCount = SendMessage(hwnd2, TB_BUTTONCOUNT, 0, 0)Dim lLen As Long, sBuff As StringFor i = 0 To BtnCount - 1IconText = Space$(256)lLen = SendMessage(hwnd2, TB_GETBUTTONTEXTA, i, ByVal lpIconText)ReadProcessMemory hExplorer, ByVal lpIconText, ByVal IconText, Len(IconText), 0If lLen <> -1 Then IconText = Left$(IconText, InStr(1, IconText, Chr$(0)) - 1)List1.AddItem IconTextNextVirtualFreeEx hExplorer, lpIconText, Len(IconText), MEM_RELEASECloseHandle hExplorerEnd SubPrivate Sub Form_Load()Command3_ClickCommand1_ClickEnd Sub。