Re: Creating a DLL in VB.NET
The type or namespace could not be found:
This means that the namespace must be added to your class (using the top of the file), if you pass your mouse gently on class "DllImport" VisualStudio you should mark the end of the word, you click on this thing and it should offer you automatically import the good using!
This process works in your references if you have the right libs obviously!
Re: Creating a DLL in VB.NET
Begin your code by including the following namespace:
Code:
using System.Runtime.InteropServices;
Re: Creating a DLL in VB.NET
Thank you very much!
In fact it works very well. I create my dll and everything is fine! For LARGERSCREENPDA error (I was stupid to not understand that it was replaced by the value.
After importing all goes well. Alas, I did not put the right value in SetWindowPos (to reset the bar). So it is only reappeared after a bar in the top left.
So I also remember that this snippet was for a Windows Mobile 6, which has a taskbar at the top. But Windows CE is down ...
So I do my experiments and found good values.
I'll get what to put, if someone has an idea ...
Here's the code:
Code:
using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
using System.Runtime.InteropServices;
namespace HideBarre
{
public class HideBarre
{
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 display the status bar");
}
}
public static void ShowStartBar()
{
IntPtr handle;
try
{
handle = FindWindowW("HHTaskBar", null);
if (handle != IntPtr.Zero)
{
SetWindowPos(handle, (IntPtr)0, 0,294, 240,26, SWP_SHOWWINDOW);
}
}
catch
{
//MessageBox.Show("Unable to display the status bar");
}
}
}
}