Home
Page
About
ToolBook
ToolBook
Tips
ToolBook
Projects
ToolBook
Links
Guest
Book


How to show icon on Task bar when main window has no caption
When you run your application in maximized state without caption bar there is no icon on Windows Task Bar, only name of application.
If CaptionBar of mainWindow = "normal" icon is visible on Task Bar.
But what to do if you want to show icon on Task Bar when CaptionBar of mainWindow = "none"?
Of course it is not very important feature but it is not good when all running applications have icons and your application have not.
Here is a solution for application with CaptionBar of mainWindow = "none" and State of mainWindow = "maximized":

-- Script for first page of book (this page is empty and black)
to handle enterPage
        local long mySave

        if sysLevel = "reader"
                linkDll "USER"
                        long GetWindowLong(word,int)
                        long SetWindowLong(word,int,long)
                        int getSystemMetrics(int)
                end linkDLL
        
                GWL_STYLE = -16
                WS_CAPTION = 0x00C00000
                SM_CYCAPTION = 4
                open viewer "Temp"
                currentPage of viewer "Temp" = page "Black"
                -- "Black" is an empty black page
                state of viewer "Temp" = "maximized"
                show viewer "Temp"
                -- Now while top window is viewer "Temp" we work with mainWindow which is invisible
                captionBar of mainWindow = "normal"
                position of mainWindow = 0,0
                state of mainWindow = "normal"
                -- Get window style
                mySave = GetWindowLong(sysWindowHandle,GWL_STYLE)
                -- Remove caption bar
                mySave = SetWindowLong(sysWindowHandle,GWL_STYLE,mySave bitAnd bitNot(WS_CAPTION))
                -- Decrement vertical size by size of caption bar
                decrement item 2 of size of mainWindow by getSystemMetrics(SM_CYCAPTION)
                -- Now ToolBook thinks that Caption Bar is normal and Windows thinks that Caption Bar is none
                state of mainWindow = "maximized"
                close viewer "Temp"
                unlinkDll "USER"
        
                go page 2 -- go to start page of your application
        end if
end

Back to Tips Menu