Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

Windows Task Bar

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Greg - 22 Sep 2007 19:32 GMT
I have an application I'm developing in VB.Net 2005. This is going to be a
trouch screen application. What I want to do is when my applicaiton loads I
want it to take up the entire screen, including the Windows Task Bar. (I
don't know if I'm using the correct term here, so let me explain. I want to
have the bar on the button of the Windows XP screen that contains a
Icon/Button for each application that is running, to be hidden from view.).
So, when you look at the screen all you see is my application and nothing
else. The only way the bar would re-appear is after the user has quit the
application.

Thanks, Greg
Stevanich - 23 Sep 2007 07:50 GMT
Greg,

You most likely will want to make some OS customizations to get the results
you want, such as hiding the Start Bar.

Hope this helps,

Steve - dotneticated.com

>I have an application I'm developing in VB.Net 2005. This is going to be a
> trouch screen application. What I want to do is when my applicaiton loads
[quoted text clipped - 10 lines]
>
> Thanks, Greg
Jeffrey Tan[MSFT] - 24 Sep 2007 04:15 GMT
Hi Greg,

The article below provided the detailed sample code and steps to complete
the task you wanted:
"How to make Windows Form app truly Full Screen (and to hide Taskbar) in
C#?"
http://www.codeproject.com/useritems/FullScreenDotNetApp.asp

To translate the code snippet into VB.net, you may use the translator
below(note: it is not perfect, but should save you 90% of the work):
http://www.aspalliance.com/aldotnet/examples/translate.aspx

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Greg - 27 Sep 2007 21:16 GMT
I took a look at the sites you included. Plus, I copied the C# code into the
converter web-site and tried to convert the code to VB.Net. It didn't seem to
do a very good job at all, because I was completely lost on figuring out how
to replciate that code in VB.Net. What I really need is a VB.Net sample code
block. I don't understand the first thing about C#.

Thanks for helping

> Hi Greg,
>
[quoted text clipped - 31 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
Jeffrey Tan[MSFT] - 28 Sep 2007 06:44 GMT
Hi Greg,

Thank you for the feedback.

Yes, this C# to VB.net is not very good. Unfortunately, I can not find a
VB.net sample yet.

Can you tell me which code you can not understand how to translate into
VB.net? I can help you to get it done. Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Greg - 29 Sep 2007 00:32 GMT
I have managed to get my application to cover the whole screen with just the
TaskBar. Now, just need to go one step further and hide the TaskBar.

Here is the C# Code.

<PRE lang=cs id=pre3 style="MARGIN-TOP: 0px">/// <summary>
/// Selected Win API Function Calls
/// </summary>

public <A class=iAs style="FONT-WEIGHT: normal; FONT-SIZE: 100%;
PADDING-BOTTOM: 1px; COLOR: darkgreen; BORDER-BOTTOM: darkgreen 0.07em solid;
BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" href="#"
target=_blank itxtdid="4499192">class</A> WinApi
{
   [DllImport(”user32.dll”, EntryPoint = “GetSystemMetrics”)]
   public static extern int GetSystemMetrics(int which);

   [DllImport(”user32.dll”)]
   public static extern void
       SetWindowPos(IntPtr hwnd, IntPtr hwndInsertAfter,
                    int X, int Y, int width, int height, uint flags);        

   private const int SM_CXSCREEN = 0;
   private const int SM_CYSCREEN = 1;
   private static IntPtr HWND_TOP = IntPtr.Zero;
   private const int SWP_SHOWWINDOW = 64; // 0×0040

   public static int ScreenX
   {
       get { return GetSystemMetrics(SM_CXSCREEN);}
   }

   public static int ScreenY
   {
       get { return GetSystemMetrics(SM_CYSCREEN);}
   }

   public static void SetWinFullScreen(IntPtr hwnd)
   {
       SetWindowPos(hwnd, HWND_TOP, 0, 0, ScreenX, ScreenY, SWP_SHOWWINDOW);
   }
}

/// <summary>
/// Class used to preserve / restore / maximize state of the form
/// </summary>
public class FormState
{
   private FormWindowState winState;
   private FormBorderStyle brdStyle;
   private bool topMost;
   private Rectangle bounds;

   private bool IsMaximized = false;

   public void Maximize(Form targetForm)
   {
       if (!IsMaximized)
       {
           IsMaximized = true;
           Save(targetForm);
           targetForm.WindowState = FormWindowState.Maximized;
           targetForm.FormBorderStyle = FormBorderStyle.None;
           targetForm.TopMost = true;
           WinApi.SetWinFullScreen(targetForm.Handle);
       }
   }

   public void Save(Form targetForm)
   {
       winState = targetForm.WindowState;
       brdStyle = targetForm.FormBorderStyle;
       topMost = targetForm.TopMost;
       bounds = targetForm.Bounds;
   }

   public void Restore(Form targetForm)
   {
       targetForm.WindowState = winState;
       targetForm.FormBorderStyle = brdStyle;
       targetForm.TopMost = topMost;
       targetForm.Bounds = bounds;
       IsMaximized = false;
   }
}
</PRE>
public partial class MaxForm : Form
{
   FormState formState = new FormState();

   public MaxForm()
   {
       InitializeComponent();
   }

   private void button1_Click(object sender, EventArgs e)
   {
       formState.Maximize(this);
   }

   private void button2_Click(object sender, EventArgs e)
   {
       formState.Restore(this);
   }
}
This is it. Some of it I can figure out, but as a whole that VB.Net
Converter made it worse, not better.

Thanks for you help.

Greg

> Hi Greg,
>
[quoted text clipped - 27 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
Jeffrey Tan[MSFT] - 01 Oct 2007 04:51 GMT
Hi Greg,

Regarding this code snippet, I have helped you to translate it. Yes, it
seems the converter tool will use the old style VB6 syntax to for the
p/invoke APIs. Anyway, I have converted it with the new VB.net syntaxt:

Imports System.Runtime.InteropServices
Public Class Form1
   Class WinApi
       <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
   Public Shared Function GetSystemMetrics(ByVal nIndex As Integer) As
Integer
       End Function

       <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
    Public Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal
hWndInsertAfter As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal cx
As Integer, ByVal cy As Integer, ByVal flags As Integer) As Boolean
       End Function

       Private Shared SM_CXSCREEN As Integer = 0
       Private Shared SM_CYSCREEN As Integer = 1
       Private Shared HWND_TOP As IntPtr = IntPtr.Zero
       Private Shared SWP_SHOWWINDOW As Integer = 64 '

       Public Shared ReadOnly Property ScreenX() As Integer
           Get
               Return GetSystemMetrics(SM_CXSCREEN)
           End Get
       End Property

       Public Shared ReadOnly Property ScreenY() As Integer
           Get
               Return GetSystemMetrics(SM_CYSCREEN)
           End Get
       End Property

       Public Shared Sub SetWinFullScreen(ByVal hwnd As IntPtr)
           SetWindowPos(hwnd, HWND_TOP, 0, 0, ScreenX, ScreenY,
SWP_SHOWWINDOW)
       End Sub 'SetWinFullScreen
   End Class 'WinApi

   Private frmState As New FormState()

   Public Class FormState
       Private winState As FormWindowState
       Private brdStyle As FormBorderStyle
       Private topMost As Boolean
       Private bounds As Rectangle

       Private IsMaximized As Boolean = False

       Public Sub Maximize(ByVal targetForm As Form)
           If Not IsMaximized Then
               IsMaximized = True
               Save(targetForm)
               targetForm.WindowState = FormWindowState.Maximized
               targetForm.FormBorderStyle = FormBorderStyle.None
               targetForm.TopMost = True
               WinApi.SetWinFullScreen(targetForm.Handle)
           End If
       End Sub 'Maximize

       Public Sub Save(ByVal targetForm As Form)
           winState = targetForm.WindowState
           brdStyle = targetForm.FormBorderStyle
           topMost = targetForm.TopMost
           bounds = targetForm.Bounds
       End Sub 'Save

       Public Sub Restore(ByVal targetForm As Form)
           targetForm.WindowState = winState
           targetForm.FormBorderStyle = brdStyle
           targetForm.TopMost = topMost
           targetForm.Bounds = bounds
           IsMaximized = False
       End Sub 'Restore
   End Class 'FormState

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
       frmState.Maximize(Me)
   End Sub

   Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
       frmState.Restore(Me)
   End Sub
End Class

Finally, for such VB.net syntax issue, I would recommend you to post in
microsoft.public.dotnet.languages.vb because there will be more VB.net
developers there.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.