    $ filename "DemoToolTips.exe"
     
    'uses rtl32
    'uses rtl64
     
    uses WinUtil
    uses ToolTips
     
    sys Button_Exit, Button_Ok, Button_Cancel, Button_Apply, MleText1, MleText2
     
    enum  Control_ids
       ID_Button_Exit=1001
       ID_Button_OK
       ID_Button_Cancel
       ID_Button_Apply
       ID_MleText1
       ID_MleText2   
    end enum
     
    % Btn_Style    = WS_CHILD|WS_VISIBLE|WS_TABSTOP
    % Btn_ExtStyle = WS_EX_STATICEDGE
    % Mle_Style    = WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|WS_BORDER|ES_LEFT|ES_MULTILINE
    % Mle_ExtStyle = WS_EX_CLIENTEDGE
    string crlf = chr(13,10)
     
    sys hInstance=inst
    MainWindow 410,340,WS_OVERLAPPEDWINDOW
     
    function createControl(string ctlclass, string Text, sys hwnd, int id, x,y,w,h, int Style, optional ExStyle=0) as sys
       sys hCtrl
       hCtrl=CreateWindowEx(ExStyle, ctlclass, Text, Style, x,y,w,h,  hWnd, id, hInstance, null)
       if hCtrl=null then mbox "Error: Cannot create " ctlclass
       return hCtrl
    end function
     
    function WndProc(sys hwnd, uint uMsg, sys wParam, lParam) as sys callback
        string hint="Lorem ipsum dolor sit amet, consetetur sadipscing elitr," &
                     "sed diam nonumy eirmod tempor invidunt ut labore et dolore" &
                     "magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores"
     
        select uMsg
     
            case WM_CREATE
               SetWindowText(hwnd, "tooltips Demo")
               Button_Exit = CreateControl("Button","Exit",hwnd,ID_Button_Exit, 296, 8, 88, 24, Btn_Style, Btn_ExtStyle)
               Button_Ok = CreateControl("Button","OK",hwnd,ID_Button_Ok, 8, 272, 88, 24, Btn_Style, Btn_ExtStyle) 
               Button_Cancel = CreateControl("Button","Cancel",hwnd,ID_Button_Cancel, 152, 272, 88, 24, Btn_Style, Btn_ExtStyle)
               Button_Apply = CreateControl("Button","Apply",hwnd,ID_Button_Apply, 296, 272, 88, 24, Btn_Style, Btn_ExtStyle)
               MleText1 = CreateControl("Edit","",hwnd,ID_MleText1, 8, 8, 232, 256, Mle_Style, Mle_ExtStyle)
               MleText2 = CreateControl("Edit","",hwnd,ID_MleText2, 248, 48, 136, 216, Mle_Style, Mle_ExtStyle)
     
               sys hTool1=SetToolTip(hwnd, "This is the Main Window", true)
               sys hTool2=SetToolTip(Button_Exit, "This will leave the program. Do not forget to save",true,true)
               setToolTipTitle(hTool2, "Exit Program")
               setToolTipWidth(hTool2, 20)
               sys hTool3=SetToolTip(Button_ok, "OK", true, true)
               sys hTool4=SetToolTip(Button_Cancel, "Cancel", ,true)
               sys hTool5=SetToolTip(Button_Apply, "Apply",true)
               sys hTool6=SetToolTip(MleText1, hint, true)
               setToolTipBackColor(hTool6, CYAN)
               sys hTool7=SetToolTip(MleText2,hint ,true))
               setToolTipTextColor(hTool7, RGB(250,150,0))
               setToolTipBackColor(hTool7, WHITE)
               setToolTipWidth(hTool7, 80)
                          
            case WM_COMMAND           
               select case loword(wParam)  'id
                  case ID_Button_Exit
                     Sendmessage(hwnd, WM_CLOSE)
                  case ID_Button_Ok, ID_Button_Cancel, ID_Button_Apply
                     mbox "Button clicked"   
               end select
               
            case WM_CLOSE
               DestroyWindow(hwnd)
     
            case WM_DESTROY
               PostQuitMessage(0)
     
            case else
               return DefWindowProc(hwnd, uMsg, wParam, lParam)
                
        end select
     
        return 0
    end function
     