本文整理汇总了C#中APPBARDATA类的典型用法代码示例。如果您正苦于以下问题:C# APPBARDATA类的具体用法?C# APPBARDATA怎么用?C# APPBARDATA使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
APPBARDATA类属于命名空间,在下文中一共展示了APPBARDATA类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetTaskbarState
/// <summary>
/// Gets the current Taskbar state
/// </summary>
/// <returns>current Taskbar state</returns>
public AppBarStates GetTaskbarState()
{
APPBARDATA msgData = new APPBARDATA();
msgData.cbSize = (UInt32)Marshal.SizeOf(msgData);
msgData.hWnd = FindWindow("System_TrayWnd", null);
return (AppBarStates)SHAppBarMessage((UInt32)AppBarMessages.GetState, ref msgData);
}
开发者ID:mind0n,项目名称:hive,代码行数:11,代码来源:Taskbar.cs
示例2: Taskbar
public Taskbar(bool secondary)
{
Handle = User32.FindWindow(!secondary ? ClassName : SecondaryClassName, null);
if (Handle == IntPtr.Zero)
return;
var data = new APPBARDATA { cbSize = (uint)Marshal.SizeOf(typeof(APPBARDATA)), hWnd = Handle };
IntPtr result = Shell32.SHAppBarMessage(ABM.GetTaskbarPos, ref data);
if (result == IntPtr.Zero)
throw new InvalidOperationException();
Position = (TaskbarPosition)data.uEdge;
Bounds = Rectangle.FromLTRB(data.rc.left, data.rc.top, data.rc.right, data.rc.bottom);
data.cbSize = (uint)Marshal.SizeOf(typeof(APPBARDATA));
result = Shell32.SHAppBarMessage(ABM.GetState, ref data);
int state = result.ToInt32();
AlwaysOnTop = (state & ABS.AlwaysOnTop) == ABS.AlwaysOnTop;
AutoHide = (state & ABS.Autohide) == ABS.Autohide;
var lpRect = new RECT();
User32.GetWindowRect(Handle, ref lpRect);
VisibleBounds = Rectangle.FromLTRB(lpRect.left, lpRect.top, lpRect.right, lpRect.bottom);
/*Debug.WriteLine(this.Bounds);
Debug.WriteLine(lpRect.top + "-------------------");*/
}
开发者ID:w01f,项目名称:VolgaTeam.Dashboard,代码行数:29,代码来源:TaskBarHelper.cs
示例3: SetAppBar
public static void SetAppBar(Window appbarWindow, ABEdge edge)
{
RegisterInfo info = GetRegisterInfo(appbarWindow);
info.Edge = edge;
APPBARDATA abd = new APPBARDATA();
abd.cbSize = Marshal.SizeOf(abd);
abd.hWnd = new WindowInteropHelper(appbarWindow).Handle;
if (edge == ABEdge.None) {
if (info.IsRegistered) {
SHAppBarMessage((int)ABMsg.ABM_REMOVE, ref abd);
info.IsRegistered = false;
}
RestoreWindow(appbarWindow);
return;
}
if (!info.IsRegistered) {
info.IsRegistered = true;
info.CallbackId = RegisterWindowMessage("AppBarMessage");
abd.uCallbackMessage = info.CallbackId;
uint ret = SHAppBarMessage((int)ABMsg.ABM_NEW, ref abd);
HwndSource source = HwndSource.FromHwnd(abd.hWnd);
source.AddHook(new HwndSourceHook(info.WndProc));
}
appbarWindow.WindowStyle = WindowStyle.None;
appbarWindow.ResizeMode = ResizeMode.NoResize;
appbarWindow.Topmost = true;
ABSetPos(info.Edge, appbarWindow);
}
开发者ID:jdugdale,项目名称:leftfork-soup,代码行数:35,代码来源:AppBar.cs
示例4: GetTaskbar
/// <summary>
/// Returns information for the Windows taskbar (type, location, size)
/// </summary>
public static Rectangle GetTaskbar(out AppBarLocation location)
{
var data = new APPBARDATA();
var res = SHAppBarMessage(ABM_GETTASKBARPOS, ref data);
location = data.uEdge;
return Rectangle.FromLTRB(data.rc.left, data.rc.top, data.rc.right, data.rc.bottom);
}
开发者ID:BroneKot,项目名称:FTPbox,代码行数:11,代码来源:Win32.cs
示例5: SetTaskbarState
/// <summary>
/// Set the Taskbar State option
/// </summary>
/// <param name="option">AppBarState to activate</param>
public void SetTaskbarState(AppBarStates option)
{
APPBARDATA msgData = new APPBARDATA();
msgData.cbSize = (UInt32)Marshal.SizeOf(msgData);
msgData.hWnd = FindWindow("System_TrayWnd", null);
msgData.lParam = (Int32)(option);
SHAppBarMessage((UInt32)AppBarMessages.SetState, ref msgData);
}
开发者ID:mind0n,项目名称:hive,代码行数:12,代码来源:Taskbar.cs
示例6: GetTaskBarInfo
public static void GetTaskBarInfo(out AppBarEdge taskBarEdge, out Rectangle region)
{
APPBARDATA appData = new APPBARDATA();
uint ret = SHAppBarMessage(AppBarMessage.GetTaskBarPos, ref appData);
taskBarEdge = appData.uEdge;
region = appData.rc.ToRectangle();
}
开发者ID:bsandru,项目名称:tasksharp,代码行数:9,代码来源:AppBar.cs
示例7: GetScreenHeight
public static int GetScreenHeight(Window appbarWindow)
{
APPBARDATA barData = new APPBARDATA();
barData.cbSize = Marshal.SizeOf(barData);
barData.hWnd = new WindowInteropHelper(appbarWindow).Handle;
SHAppBarMessage((int)ABMsg.ABM_GETTASKBARPOS, ref barData);
return barData.rc.top;
}
开发者ID:bradrees,项目名称:HttpRules,代码行数:10,代码来源:AppBarFunctions.cs
示例8: ABSetPos
public static void ABSetPos(Window appbarWindow, ABEdge edge)
{
APPBARDATA barData = new APPBARDATA();
barData.cbSize = Marshal.SizeOf(barData);
barData.hWnd = new WindowInteropHelper(appbarWindow).Handle;
barData.uEdge = (int)edge;
int leftOffset = 0;
int topOffset = 0;
int actualScreenWidth = (int)SystemParameters.PrimaryScreenWidth;
int actualScreenHeight = (int)SystemParameters.PrimaryScreenHeight;
GetActualScreenData(edge, appbarWindow, ref leftOffset, ref topOffset, ref actualScreenWidth, ref actualScreenHeight);
if (barData.uEdge == (int)ABEdge.Left || barData.uEdge == (int)ABEdge.Right)
{
barData.rc.top = topOffset;
barData.rc.bottom = actualScreenHeight;
if (barData.uEdge == (int)ABEdge.Left)
{
barData.rc.left = leftOffset;
barData.rc.right = (int)Math.Round(appbarWindow.ActualWidth) + leftOffset;
}
else
{
barData.rc.right = actualScreenWidth + leftOffset;
barData.rc.left = barData.rc.right - (int)Math.Round(appbarWindow.ActualWidth);
}
}
else
{
barData.rc.left = leftOffset;
barData.rc.right = actualScreenWidth + leftOffset;
if (barData.uEdge == (int)ABEdge.Top)
{
barData.rc.top = topOffset;
barData.rc.bottom = (int)Math.Round(appbarWindow.ActualHeight) + topOffset;
}
else
{
barData.rc.bottom = actualScreenHeight + topOffset;
barData.rc.top = barData.rc.bottom - (int)Math.Round(appbarWindow.ActualHeight);
}
}
SHAppBarMessage((int)ABMsg.ABM_QUERYPOS, ref barData);
SHAppBarMessage((int)ABMsg.ABM_SETPOS, ref barData);
Rect rect = new Rect((double)barData.rc.left, (double)barData.rc.top,
(double)(barData.rc.right - barData.rc.left), (double)(barData.rc.bottom - barData.rc.top));
//This is done async, because WPF will send a resize after a new appbar is added.
//if we size right away, WPFs resize comes last and overrides us.
appbarWindow.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle,
new ResizeDelegate(DoResize), appbarWindow, rect);
}
开发者ID:Zagrebelin,项目名称:SideBar,代码行数:55,代码来源:AppBarFunctions.cs
示例9: show
static void show()
{
// タスクバーを常に表示
APPBARDATA abd = new APPBARDATA();
abd.cbSize = Marshal.SizeOf(abd);
abd.lParam = ABS_ALWAYSONTOP;
SHAppBarMessage(ABM_SETSTATE, ref abd);
// タスクバーを表示
ShowWindow(FindWindow("Shell_TrayWnd", IntPtr.Zero), SW_NORMAL);
}
开发者ID:umhr,项目名称:TaskbarHide,代码行数:11,代码来源:Program.cs
示例10: GetTaskbarPosition
private static TaskbarPosition GetTaskbarPosition(out Rectangle bounds)
{
var taskbarHandle = FindWindow("Shell_TrayWnd", null);
var data = new APPBARDATA { cbSize = (uint)Marshal.SizeOf(typeof(APPBARDATA)), hWnd = taskbarHandle };
var result = SHAppBarMessage(ABM.GetTaskbarPos, ref data);
if (result == IntPtr.Zero)
throw new InvalidOperationException();
bounds = Rectangle.FromLTRB(data.rc.left, data.rc.top, data.rc.right, data.rc.bottom);
return (TaskbarPosition)data.uEdge;
}
开发者ID:AdditionalPylons,项目名称:AudioSwitch,代码行数:12,代码来源:WindowPosition.cs
示例11: hide
static void hide()
{
// 「タスクバーを自動的に隠す」
APPBARDATA abd = new APPBARDATA();
abd.cbSize = Marshal.SizeOf(abd);
abd.lParam = ABS_AUTOHIDE;
SHAppBarMessage(ABM_SETSTATE, ref abd);
System.Threading.Thread.Sleep(100);
// タスクバーを非表示
ShowWindow(FindWindow("Shell_TrayWnd", IntPtr.Zero), SW_HIDE);
}
开发者ID:umhr,项目名称:TaskbarHide,代码行数:13,代码来源:Program.cs
示例12: GetPosition
public void GetPosition(string strClassName, string strWindowName)
{
this.m_data = new APPBARDATA();
this.m_data.cbSize = (uint) Marshal.SizeOf(this.m_data.GetType());
if (!(FindWindow(strClassName, strWindowName) != IntPtr.Zero))
{
throw new Exception("Failed to find an AppBar that matched the given criteria");
}
if (SHAppBarMessage(5, ref this.m_data) != 1)
{
throw new Exception("Failed to communicate with the given AppBar");
}
}
开发者ID:vanloc0301,项目名称:mychongchong,代码行数:13,代码来源:AppBarInfo.cs
示例13: button1_Click
private void button1_Click(object sender, EventArgs e)
{
// タスクバーを常に表示
APPBARDATA abd = new APPBARDATA();
abd.cbSize = Marshal.SizeOf(abd);
abd.lParam = ABS_ALWAYSONTOP;
SHAppBarMessage(ABM_SETSTATE, ref abd);
// タスクバーを表示
ShowWindow(FindWindow("Shell_TrayWnd", IntPtr.Zero), SW_NORMAL);
// フォームを閉じる
//this.Close();
}
开发者ID:EsProgram,项目名称:TaskbarSwitch,代码行数:14,代码来源:Form1.cs
示例14: button2_Click
private void button2_Click(object sender, EventArgs e)
{
//タスクバーを自動的に隠す
APPBARDATA abd = new APPBARDATA();
abd.cbSize = Marshal.SizeOf(abd);
abd.lParam = ABS_AUTOHIDE;
SHAppBarMessage(ABM_SETSTATE, ref abd);
// タスクバーを非表示
ShowWindow(FindWindow("Shell_TrayWnd", IntPtr.Zero), SW_HIDE);
// フォームを閉じる
//this.Close();
}
开发者ID:EsProgram,项目名称:TaskbarSwitch,代码行数:14,代码来源:Form1.cs
示例15: SetAppBarAutoDisplay
///
/// 设置系统任务栏是否自动隐藏
///
/// True 设置为自动隐藏,False 取消自动隐藏
public static void SetAppBarAutoDisplay(bool IsAuto)
{
APPBARDATA abd = new APPBARDATA();
abd.hwnd = FindWindow("Shell_TrayWnd", "");
//abd.lParam = ABS_ALWAYSONTOP Or ABS_AUTOHIDE '自动隐藏,且位于窗口前
//abd.lParam = ABS_ALWAYSONTOP '不自动隐藏,且位于窗口前
//abd.lParam = ABS_AUTOHIDE '自动隐藏,且不位于窗口前
if (IsAuto)
{
abd.lParam = ABS_AUTOHIDE;
SHAppBarMessage(ABM_SETSTATE, ref abd);
}
else
{
abd.lParam = ABS_ALWAYSONTOP;
SHAppBarMessage(ABM_SETSTATE, ref abd);
}
}
开发者ID:jimidzj,项目名称:Inspect,代码行数:22,代码来源:SetAppBarAutoDisplay.cs
示例16: AdjustWorkingAreaForAutoHide
private static MINMAXINFO AdjustWorkingAreaForAutoHide(IntPtr monitorContainingApplication, MINMAXINFO mmi)
{
IntPtr hwnd = FindWindow("Shell_TrayWnd", null);
if (hwnd == null) return mmi;
IntPtr monitorWithTaskbarOnIt = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
if (!monitorContainingApplication.Equals(monitorWithTaskbarOnIt)) return mmi;
APPBARDATA abd = new APPBARDATA();
abd.cbSize = Marshal.SizeOf(abd);
abd.hWnd = hwnd;
SHAppBarMessage((int)ABMsg.ABM_GETTASKBARPOS, ref abd);
int uEdge = GetEdge(abd.rc);
bool autoHide = System.Convert.ToBoolean(SHAppBarMessage((int)ABMsg.ABM_GETSTATE, ref abd));
if (!autoHide) return mmi;
switch (uEdge)
{
case (int)ABEdge.ABE_LEFT:
mmi.ptMaxPosition.x += 2;
mmi.ptMaxTrackSize.x -= 2;
mmi.ptMaxSize.x -= 2;
break;
case (int)ABEdge.ABE_RIGHT:
mmi.ptMaxSize.x -= 2;
mmi.ptMaxTrackSize.x -= 2;
break;
case (int)ABEdge.ABE_TOP:
mmi.ptMaxPosition.y += 2;
mmi.ptMaxTrackSize.y -= 2;
mmi.ptMaxSize.y -= 2;
break;
case (int)ABEdge.ABE_BOTTOM:
mmi.ptMaxSize.y -= 2;
mmi.ptMaxTrackSize.y -= 2;
break;
default:
return mmi;
}
return mmi;
}
开发者ID:yuanyesong,项目名称:SimpleEntry,代码行数:40,代码来源:WindowSizing.cs
示例17: GetTaskbarRectangle
public static Rectangle GetTaskbarRectangle()
{
APPBARDATA abd = new APPBARDATA();
SHAppBarMessage((int)ABMsg.ABM_GETTASKBARPOS, out abd);
return abd.rc.ToRectangle();
}
开发者ID:ptmono,项目名称:dScreenCapture2,代码行数:6,代码来源:NativeMethods.cs
示例18: SHAppBarMessage
private static extern uint SHAppBarMessage(AppBarMessage dwMessage, ref APPBARDATA pData);
开发者ID:bsandru,项目名称:tasksharp,代码行数:1,代码来源:AppBar.cs
示例19: AppBarPosition
private static void AppBarPosition(Form form, AppBarEdge edge, AppBarMessage appBarMessage)
{
APPBARDATA appData = new APPBARDATA();
appData.cbSize = (uint)Marshal.SizeOf(appData);
appData.uEdge = edge;
appData.rc = Win32.RECT.FromRectangle(form.Bounds);
appData.hWnd = form.Handle;
SHAppBarMessage(appBarMessage, ref appData);
//let the application handle some events first
//if we dont do this (especially for SetPos)
//the position will be off and the bar jumps around
Application.DoEvents();
form.Bounds = appData.rc.ToRectangle();
}
开发者ID:bsandru,项目名称:tasksharp,代码行数:15,代码来源:AppBar.cs
示例20: Unregister
public static void Unregister(Form form)
{
_appBars.Remove(form);
if (form.IsDisposed)
return;
APPBARDATA appData = new APPBARDATA();
appData.cbSize = (uint)Marshal.SizeOf(appData);
appData.hWnd = form.Handle;
SHAppBarMessage(AppBarMessage.Remove, ref appData);
}
开发者ID:bsandru,项目名称:tasksharp,代码行数:11,代码来源:AppBar.cs
注:本文中的APPBARDATA类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论