Announcement

Collapse
No announcement yet.

Tool tips on Labels

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tool tips on Labels

    Anyone see a reason that tool tips would not work on a label? or a textbox?

    I was compilling a new resource file with strings in it and RCDLL.DLL just vaporized, no error or anything so after drawing up a fresh resource file from scratch I realized what was going on...
    Very frustrated but now I'm bakc to square one.
    This is not working.........


    Code:
    %IDMAINLABEL1   = %WM_USER + 701
    %IDMAINLABEL2   = %WM_USER + 702
    %IDMAINLABEL3   = %WM_USER + 703 
    '----------------------------------------------------------
    'ToolTips
    Type dField
        fName       As Asciiz * 80
        Size        As Integer
        Alignment   As Integer
    End Type
    Type ListData
        Columns As Integer
        Fields(0 To 80) As dField
        ToolTip As Asciiz * 30 'Testing
    End Type
    '----------------------------------------------------------
     
    Function WinMain (ByVal hCurInstance     As Long, _
                      ByVal hPrevInstance As Long, _
                      lpCmdLine           As Asciiz Ptr, _
                      ByVal iCmdShow      As Long) As Long
    
    Local wndclass      As WndClassEx
    Local lpClassName   As Asciiz * 10
    Local lResult      As Long
    Local lLoop         As Long
    Local hMutex        As Long
    
    Dim ToolTxt(1 To 3) As Asciiz * 125
    Dim ti As TOOLINFO
    Local hWnd_ToolTip As Long
    
    g_hInst                 = hCurInstance
    g_CCS                   = "Computer Creations Software"
    g_Mine                  = "RegChange"
    g_Ver                   = "v1.10"
    g_Copyrite              = "Copyright © 2001"
    g_URL                   = "http://www.tngbbs.com"
    lpClassName             = UCase$(g_Mine)
    
    If IsTrue App_PrevInstance(lpClassName) Then
        MsgBox "Another instance of " + g_Mine + " is already running!",%MB_ICONSTOP,g_Mine
        Exit Function
    Else
        hMutex = CreateMutex(ByVal %Null, 0, lpClassName)
    End If
    
    vi.dwOsVersionInfoSize = SizeOf(vi)
    GetVersionEx vi
    If vi.dwPlatformId = %VER_PLATFORM_WIN32_NT Then
       wRegKey = "Software\Microsoft\Windows NT\CurrentVersion"
    Else
       wRegKey = "Software\Microsoft\Windows\CurrentVersion"
    End If
    
    wRegUser = GetSetting(%HKEY_LOCAL_MACHINE ,ByVal wRegKey, "RegisteredOwner","")
    wRegCompany = GetSetting(%HKEY_LOCAL_MACHINE ,ByVal wRegKey,"RegisteredOrganization","")
    wRegProductId = GetSetting(%HKEY_LOCAL_MACHINE ,ByVal wRegKey,"ProductId","")
    
    
    wndclass.cbSize        = SizeOf(WndClass)
    wndclass.style         = %CS_HREDRAW Or %CS_VREDRAW
    wndclass.lpfnWndProc   = CodePtr(DialogProc)
    wndclass.cbClsExtra    = 0
    wndclass.cbWndExtra    = 0
    wndclass.hInstance     = g_hInst
    wndclass.hIcon         = hIcon
    wndclass.hCursor       = LoadCursor(%NULL, ByVal %IDC_ARROW)
    wndclass.hbrBackground = GetStockObject( %BLACK_BRUSH)
    wndclass.lpszMenuName  = %NULL
    wndclass.lpszClassName = VarPtr(lpClassName)
    wndclass.hIconSm       = LoadIcon( g_hInst, ByVal %IDI_APPLICATION )   
    Dim ToolTxt(1 To 3) As Asciiz * 125
    Dim ti As TOOLINFO
    Local hWnd_ToolTip As Long
                                
    
    InitCommonControls
    Call InitUrlCtrl
    
    hIcon = LoadIcon( g_hInst, ByVal %PROGRAM)
    hMenu = LoadMenu( g_hInst, "MAINMENU")  
    
    Dialog New 0, g_Mine,,, 225,95, %WS_MINIMIZEBOX Or %WS_CAPTION Or %WS_SYSMENU Or %WS_EX_LEFT To hDlg
    
    Control Add Label, hDlg,%IDMAINLABEL1,"User Name:",1,1,55,10
    Control Add Label, hDlg,%IDMAINLABEL2,"Company Name:",1,15,55,10
    Control Add Label, hDlg,%IDMAINLABEL3,"Serial Number:",1,30,55,10
    Control Add TextBox,hDlg,%IDMAINTEXT1,wRegUser,65,1,150,12
    Control Add TextBox,hDlg,%IDMAINTEXT2,wRegCompany,65,15,150,12
    Control Add TextBox,hDlg,%IDMAINTEXT3,wRegProductId,65,30,150,12
    Control Add Button, hDlg,%IDMAINBUTTONSET,"&Set",170,50,45,14
    
    Control Add "msctls_statusbar32", hDlg,hStatus,"",0,0,0,0,_
                  %WS_CHILD Or %WS_CLIPSIBLINGS Or %WS_DLGFRAME Or %WS_VISIBLE' Or %SBARS_SIZEGRIP
    
    Dialog Send hDlg, %WM_SETICON, %ICON_BIG, hIcon
    Menu Attach hMenu, hDlg
    
    
    hWnd_ToolTip = CreateWindowEx( 0, "tooltips_class32", "", %TTS_ALWAYSTIP, 0, 0, 0, 0, 0, ByVal 0&, GetModuleHandle(ByVal 0&), ByVal 0&)
    ti.cbSize   = Len(ti)
    ti.uFlags   = %TTF_SUBCLASS Or %TTF_IDISHWND
    ti.hWnd     = hDlg
    
    For lLoop = 1 To 3
        LoadString g_hInst,(%WM_USER + 3000) + lLoop,ToolTxt(lLoop), SizeOf(ToolTxt(lLoop))
        ti.uId      = GetDlgItem(hDlg, (%WM_USER + 700) + lLoop)
        ti.lpszText = VarPtr(ToolTxt(lLoop))
        SendMessage hWnd_ToolTip , %TTM_ADDTOOL, 0, ByVal VarPtr(ti)
    Next
    
    Dialog Show Modal hDlg Call DialogProc    
    DeleteObject hCurHand
    DeleteObject hCurArrow
    Erase ToolTxt
    CloseHandle hMutex 
    End Function
    ------------------
    Scott



    [This message has been edited by Scott Turchin (edited June 10, 2001).]
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

  • #2
    Scott --
    I didn't test your code and have no idea about textbox (should work w/o special efforts).
    Static - you need SS_NOTIFY.

    ------------------
    E-MAIL: [email protected]

    Comment


    • #3
      That was it! Thank you!

      ------------------
      Scott
      Scott Turchin
      MCSE, MCP+I
      http://www.tngbbs.com
      ----------------------
      True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

      Comment


      • #4
        Out of curiosity i looked up SS_NOTIFY:

        %SS_NOTIFY Sends the parent window %STN_CLICKED and %STN_DBLCLK notification messages when the user clicks or double clicks the control.

        Is there an STN_MOUSEOVER event that also occurs?

        Why does this fix the problem with the tool tips when there is no STN_CLICKED occuring?


        Scott

        ------------------
        Scott
        Scott Turchin
        MCSE, MCP+I
        http://www.tngbbs.com
        ----------------------
        True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

        Comment

        Working...
        X