Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Nov 20, 2019 11:03 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Hiding Application Title on TaskBar
PostPosted: Tue Sep 06, 2011 5:26 pm 
Offline

Joined: Wed Jul 09, 2008 1:46 pm
Posts: 36
You can create a TrayApp where your application processes in the background and has a discrete icon in the System Tray in Windows. But suppose you want a status window showing real time data; say cash flow to the owner, or call handling data to the call center manager. Suppose, since this is just a status window to glance at on secondary monitor; it is not necessary to see its title, using up space, on your Windows Taskbar.

I thought I could use the Windows API function call in user32.dll to do just that. It works for about a few miliseconds, then it appears that RealBasic makes its own call to ShowWindow because the title immediately reappears again.

Example Button Action Code:
Declare Function FindWindowA Lib "user32.dll" (sClassName As CString, sWinName As CString) As Integer
Declare Function ShowWindow Lib "user32.dll" (hWnd As Integer, iCmd As Integer) As Integer

Dim AppWindowHandle As Integer
Dim ReturnValue As Integer

' myAppName is the same as the Project.Title
' In test code, the AppWindowHandle does populate with
' an integer of the RealBasic Apps window handle
AppWindowHandle = FindWindowA(Nil, "myAppName")
' 0=SW_HIDE; hide the title in the taskbar | 1=SW_SHOW; show
ReturnValue = ShowWindow(AppWindowHandle, 0)

' ReturnValue is typically 24, which means the window was visible

If I click on my example button, the app name briefly dissapears from the TaskBar, only to be repainted again. Next I thought I would place this code in the PAINT event of the Window itself. But this causes a constantly flickering application and does not permit the child objects to be repainted.

Is calling this Windows API causing a PAINT event for the window, or what is causing RealBasic to repaint the window; possibly calling the ShowWindow API function itself with SW_SHOW again?

Would such functionality require a change to the RealBasic UI and possibly a new Property like "MenuBarVisible" which hides the TaskBar for ALL application; not desirable in my case.

Even the system tray project example ends up showing a Taskbar title if you open the About dialog window.

B.T.W. I know it is possible to have a Desktop Window without a TaskBar title and no System Tray Icon because it can be done in Microsoft Visual Foxpro.


Top
 Profile  
Reply with quote  
 Post subject: Re: Hiding Application Title on TaskBar
PostPosted: Tue Sep 06, 2011 5:48 pm 
Offline

Joined: Thu Apr 10, 2008 6:03 am
Posts: 303
Location: Paris-La Défense, France
Hi,

Not sure if this is what you want, but if I create a blank project with a new window, and set the "Frame" of the window to "3 - Floating window" there will be no title nor icon in the Taskbar when the program is running.

_________________
Check my Website for high quality custom controls and classes (no plugins) for Windows, Mac OS and Linux
REALBasic 2012 R2 on Win 7 & Mac OS X


Top
 Profile  
Reply with quote  
 Post subject: Re: Hiding Application Title on TaskBar
PostPosted: Tue Sep 06, 2011 11:20 pm 
Offline

Joined: Wed Jul 09, 2008 1:46 pm
Posts: 36
JeremK wrote:
Not sure if this is what you want . . . but if I . . . set the "Frame" of the window to "3 - Floating window" there will be no title nor icon in the Taskbar when the program is running.


Brilliant. Want is relative at this point. I had chosen "4 - Plain box" because it had a single line border, we didn't need a title or thick border. I had no idea the Frame would effect the TaskBar.

B.T.W. for everyones sake, I tested and only "3 - Floating Window", "7 - Global Floating Window", and "10 - Drawer Window" eliminate the TaskBar title box. In further reading, Mac users get a MacProcID so they can further adjust their window types.

Maybe someday we'll get a WinProcID property so that Windows users can combine properties of say the "Plain Box" + "Floating Window"; just like I suspect Mac users can now.

Thanks JeremK. :D


Top
 Profile  
Reply with quote  
 Post subject: Re: Hiding Application Title on TaskBar
PostPosted: Wed Sep 07, 2011 12:12 am 
Offline

Joined: Wed Jul 09, 2008 1:46 pm
Posts: 36
SOLVED

Thanks again to JeremK for getting me on the right track. Choosing one of the frame types (3, 7, 10) will hide the program from displaying on the TaskBar in Windows.

Then to get me back to a single border window with no title, you can call the windows user32.dll function SetWindowLongA. (You can also use the peek function GetWindowLongA to see what your window long is prior to modifying it too.)

Here is my final code I placed in the Activate event handler for my window.
Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (sClassName As CString, sWindowName As CString) As Integer
Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (hWnd As Integer, iWindex As Integer, iNewLong As Integer) As Integer
Dim AppWindowHandle As Integer
Dim ReturnValue As Integer
[color=#BF00BF]' First find the window, searching by its title, assigned in Project.Title[/color]
AppWindowHandle = FindWindow(Nil, "myAppName")
[color=#BF00BF]' Change the Window Long value, bits 23 & 24, from
' 11 (WS_CAPTION window has titlebar) to
' 10 (WS_BORDER window has a thin-line border)
' Initial Window Long value was 2495610880
' iWindex is -16 indicating Window Styles.[/color]
ReturnValue = SetWindowLong(AppWindowHandle, -16, 2491416576)


NOTE: This code can NOT go in the Window.Open event because you have to wait until the window has already been created.


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

All times are UTC - 5 hours


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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group