I program in VB.NET, I created a small program for Windows CE. It works well. But my problem is that I must find a way to hide the taskbar in Windows. After having made my research, the only thing I find is tengible the following code in C# (I think):
Code:
public const int SWP_ASYNCWINDOWPOS = 0x4000;
public const int SWP_DEFERERASE = 0x2000;
public const int SWP_DRAWFRAME = 0x0020;
public const int SWP_FRAMECHANGED = 0x0020;
public const int SWP_HIDEWINDOW = 0x0080;
public const int SWP_NOACTIVATE = 0x0010;
public const int SWP_NOCOPYBITS = 0x0100;
public const int SWP_NOMOVE = 0x0002;
public const int SWP_NOOWNERZORDER = 0x0200;
public const int SWP_NOREDRAW = 0x0008;
public const int SWP_NOREPOSITION = 0x0200;
public const int SWP_NOSENDCHANGING = 0x0400;
public const int SWP_NOSIZE = 0x0001;
public const int SWP_NOZORDER = 0x0004;
public const int SWP_SHOWWINDOW = 0x0040;
public const int HWND_TOP = 0;
public const int HWND_BOTTOM = 1;
public const int HWND_TOPMOST = -1;
public const int HWND_NOTOPMOST = -2;
[DllImport("coredll.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
[DllImport("coredll.dll", EntryPoint = "FindWindowW", SetLastError = true)]
public static extern IntPtr FindWindowW(string lpClassName, string lpWindowName);
public static void HideStartBar()
{
IntPtr handle;
try
{
handle = FindWindowW("HHTaskBar", null);
if (handle != IntPtr.Zero)
{
SetWindowPos((IntPtr)handle, (IntPtr)0, 0, 0, 0, 0, SWP_HIDEWINDOW);
}
}
catch
{
MessageBox.Show("Unable to hide the status bar.");
}
}
public static void ShowStartBar()
{
IntPtr handle;
try
{
handle = FindWindowW("HHTaskBar", null);
if (handle != IntPtr.Zero)
{
SetWindowPos(handle, (IntPtr)0, 0, 0, LARGERSCREENPDA , 26, SWP_SHOWWINDOW);
}
}
catch
{
MessageBox.Show("Unable to display the status bar");
}
}
So I wanted to create a DLL that I can use in my application.
So I create a new solution, add a library project class. and I simply copy and paste this code in the class.
But I am pointed out several errors:
Code:
[DllImport("coredll.dll", SetLastError = true)]
The type or namespace not found
Code:
[return: MarshalAs(UnmanagedType.Bool)]
The type or namespace not found
Code:
SetWindowPos(handle, (IntPtr)0, 0, 0, LARGERSCREENPDA, 26, SWP_SHOWWINDOW);
The name does not exist in the current context.
As I do not know much about C#, being a beginner in creating DLL, if someone could give me a helping hand to resolve this error messages.
Bookmarks