Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Apr 23, 2014 7:18 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Hide Start Button Works in Windows XP, but not Windows 7
PostPosted: Mon Aug 08, 2011 9:08 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
I wrote a simple demo program to use the Windows API to hide or show desktop icons, the clock, the system tray, the task bar, and the start button. (You can find the program at http://traver.org/rb/2010r5/HideShow.rbp.) The program works fine in Windows XP, and it works fine in Windows 7 EXCEPT that hide the start button no longer works (and presumably show the start button no longer works either).

Here's the PushButton1.Action code for hide the start button:

Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( lpClassName As CString, lpWindowName As CString ) As Integer
Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( hWnd1 As Integer, hWnd2 As Integer, lpsz1 As CString, lpsz2 As Integer ) As Integer
Declare Function ShowWindow Lib "user32.dll" ( hwnd As Integer, nCmdShow As Integer ) As Integer
Dim TaskBar As Integer
Dim StartButton as Integer
Dim ReturnValue As Integer
TaskBar = FindWindow("Shell_TrayWnd", "")
StartButton = FindWindowEx(TaskBar, 0, "button", 0)
ReturnValue =ShowWindow(StartButton, 4)

Two questions:

(1) Does anyone know what the equivalent Windows 7 API call would be for hide the start button (and where did you find the information)?

(2) How can I tell whether an RB program is running Windows XP, Vista, or Windows 7?

Thanks for the help.

Barry Traver


Top
 Profile  
 
 Post subject: Re: Hide Start Button Works in Windows XP, but not Windows 7
PostPosted: Mon Aug 08, 2011 12:14 pm 
Offline

Joined: Sat Dec 20, 2008 5:09 am
Posts: 32
Location: Austria, Vienna
Hello Barry,

there is a window directly under the Desktop: title "Start", class "Button",
not under 'Shell_TrayWnd'.
You can use 'Microsoft Spy++' to find all windows.

Peter


Top
 Profile  
 
 Post subject: Re: Hide Start Button Works in Windows XP, but not Windows 7
PostPosted: Mon Aug 08, 2011 1:07 pm 
Offline

Joined: Sat Dec 20, 2008 5:09 am
Posts: 32
Location: Austria, Vienna
Hello Barry,

I've provided a reduced version of my class 'COSVersionInfo'
The class provides the following information for XP sp3 32bit:

MajorVersion: 5
MinorVersion: 1
PlatformId: 2
ServicePackMajor: 3
ServicePackMinor: 0
Wow64Process: False

More information on MajorVersion etc. can be found here:
http://msdn.microsoft.com/en-us/library/ms724833(v=vs.85).aspx

Mini version class:
http://www.dreisiebner.at/temp/test_cosversioninfo_mini.zip

Peter


Top
 Profile  
 
 Post subject: Re: Hide Start Button Works in Windows XP, but not Windows 7
PostPosted: Fri Aug 12, 2011 12:00 pm 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
Peter,

Thanks for the help!

Barry Traver


Top
 Profile  
 
 Post subject: Re: Hide Start Button Works in Windows XP, but not Windows 7
PostPosted: Sun Aug 14, 2011 8:39 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
PeDre wrote:
Hello Barry,
there is a window directly under the Desktop: title "Start", class "Button",
not under 'Shell_TrayWnd'.
You can use 'Microsoft Spy++' to find all windows.
Peter

Peter,

It has been a while since I worked with RB versions of Windows API calls (and I'm not sure I entirely understood it then), so I'm having trouble getting it to work.

Forget the question about finding the OS Version; I think you've given me enough information to handle that. Where I'm having trouble is changing the actual code for the pushbutton for the Hide Start Button and the pushbutton for the Show Start Button.

Here's what the code for the pushbutton for the Hide Start Button was (it works for Windows XP):

Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( lpClassName As CString, lpWindowName As CString ) As Integer
Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( hWnd1 As Integer, hWnd2 As Integer, lpsz1 As CString, lpsz2 As Integer ) As Integer
Declare Function ShowWindow Lib "user32.dll" ( hwnd As Integer, nCmdShow As Integer ) As Integer
Dim TaskBar As Integer
Dim StartButton As Integer
Dim ReturnValue As Integer
TaskBar = FindWindow("Shell_TrayWnd", "")
StartButton = FindWindowEx(TaskBar, 0, "button", 0)
ReturnValue =ShowWindow(StartButton, 0)

Here's what the code for the pushbutton for the Show Start Button was (it works for Windows XP):

Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( lpClassName As CString, lpWindowName As CString ) As Integer
Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( hWnd1 As Integer, hWnd2 As Integer, lpsz1 As CString, lpsz2 As Integer ) As Integer
Declare Function ShowWindow Lib "user32.dll" ( hwnd As Integer, nCmdShow As Integer ) As Integer
Dim TaskBar As Integer
Dim StartButton as Integer
Dim ReturnValue As Integer
TaskBar = FindWindow("Shell_TrayWnd", "")
StartButton = FindWindowEx(TaskBar, 0, "button", 0)
ReturnValue =ShowWindow(StartButton, 4)

Exactly what changes do I make for it to work with Windows 7? For example, do I replace Shell_TrayWnd with Start or Button or Desktop or something else? (I spent a lot of time with Aaron Ballman's code before I got my code to work, and even then, I'm not sure I got it right, even though it worked.)

Barry Traver


Top
 Profile  
 
 Post subject: Re: Hide Start Button Works in Windows XP, but not Windows 7
PostPosted: Sun Aug 14, 2011 9:23 am 
Offline

Joined: Sat Dec 20, 2008 5:09 am
Posts: 32
Location: Austria, Vienna
Hello Barry,

code for hide the Start Button, tested on Windows 7:
Declare Function GetDesktopWindow Lib "user32" () As Integer
Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( hWnd1 As Integer, hWnd2 As Integer, lpsz1 As CString, lpsz2 As Integer ) As Integer
Declare Function ShowWindow Lib "user32.dll" ( hwnd As Integer, nCmdShow As Integer ) As Integer

Dim Desktop As Integer
Dim StartButton As Integer
Dim ReturnValue As Integer

Desktop = GetDesktopWindow()
StartButton = FindWindowEx(Desktop, 0, "button", 0)
ReturnValue =ShowWindow(StartButton, 0)

The Start Button is hide, you can control with 'Spy++', the stile 'WS_VISIBLE' is missing.
But there is a another smaller Start Button bottom, directly on the TaskBar 'Shell_TrayWnd'. You can hide it with the TaskBar.

Peter

Edit: Sample Project: http://www.dreisiebner.at/temp/HideStartButton-Win7.zip


Top
 Profile  
 
 Post subject: Re: Hide Start Button Works in Windows XP, but not Windows 7
PostPosted: Sun Aug 14, 2011 7:23 pm 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
Peter,

Thanks for the comments and code. It seems, however, to behave differently on your Windows 7 computer than on mine, unless I misunderstand what the code is supposed to do.

When I run the attached code (the .zip file) and choose "Hide," the entire task bar disappears, not just the start button. (When I run it and choose "Show," the entire task bar reappears.) Is that what is supposed to happen?

What I want to have happen is for the start button (and only the start button) to disappear and reappear. On my computer, the code at the top doesn't hide the start button either.

Am I missing something or is there something I should be doing that I'm not doing?

Barry Traver


Top
 Profile  
 
 Post subject: Re: Hide Start Button Works in Windows XP, but not Windows 7
PostPosted: Mon Aug 15, 2011 12:37 am 
Offline

Joined: Sat Dec 20, 2008 5:09 am
Posts: 32
Location: Austria, Vienna
Hello Barry,

with
Desktop = GetDesktopWindow()
StartButton = FindWindowEx(Desktop, 0, "button", 0)
ReturnValue =ShowWindow(StartButton, 0)

the Start Button is hide.
But you see another Button or Graphic on the Taskbar, looks same es original Start Button, a little smaller. I found no Handle, I think it is a Graphic on the Taskbar.

Sorry for my bad english.

Sample Project: http://www.dreisiebner.at/temp/HideShowTaskbarStartButton-Win7.zip

Peter


Top
 Profile  
 
 Post subject: Re: Hide Start Button Works in Windows XP, but not Windows 7
PostPosted: Mon Aug 15, 2011 3:16 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
Peter,

It is my lack of technical expertise that is the problem, not your English. Your comments and code are much appreciated. Thank you for taking the time to respond to my questions.

Warm regards,

Barry Traver


Top
 Profile  
 
 Post subject: Re: Hide Start Button Works in Windows XP, but not Windows 7
PostPosted: Tue Aug 16, 2011 1:59 pm 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
Peter,

The new .zip file helped a lot. The "hide start button" for Windows 7 is much different from what it was in Windows XP. I see no way to hide the start button without hiding others (e.g., the entire taskbar) at the same time (at least playing around with your code and my earlier code).

From your later example, I think I understand better what you were saying. My problem in understanding was that the present situation is more complicated than the way things used to be, but Microsoft is under no obligation to keep things simple.

Barry


Top
 Profile  
 
 Post subject: Re: Hide Start Button Works in Windows XP, but not Windows 7
PostPosted: Wed Aug 17, 2011 12:23 am 
Offline

Joined: Sat Dec 20, 2008 5:09 am
Posts: 32
Location: Austria, Vienna
Hello Barry,

just for information, there is a tool that makes it:
http://www.tordex.com/startkiller/index.html
I have not tried it.

stubid idea: hide the start button and move the 'ReBar?'-window in the 'Shell_TrayWnd' to the left? Would be worth a try.

Peter


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group