Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Context help with popup

  • Filter
  • Time
  • Show
Clear All
new posts

  • Context help with popup

    #compile exe
    #dim all
    #register none
    #include ""
    declare callback function DlgProc
    type HH_POPUP
        cbStruct        as long
        hinst           as long
        idString        as long
        pszText         as long
        pt              as POINTAPI
        clrForeground   as long
        clrBackground   as long
        rcMargins       as RECT
        pszFont         as long
    end type
    declare function HtmlHelp Lib "hhctrl.ocx" alias "HtmlHelpA" _
                              (byval hwndCaller as long, _
                              pszFile as asciiz, _
                              byval uCommand as long, _
                              byval dwData as long ) as long
    sub ShowPopupHelp(sText as string) 
        local hWnd as long
        local hh_popup as HH_POPUP
        hWnd = WindowFromPoint(,
        hh_popup.cbStruct          = len(hh_popup)
        hh_popup.hinst             = GetWindowLong(hWnd, %GWL_HINSTANCE)
        hh_popup.idString          = 0
        hh_popup.pszText           = strptr(sText)              = + 25              = + 25
        hh_popup.clrForeground     = 0
        hh_popup.clrBackground     = &HE0FFFF
        hh_popup.rcMargins.nRight  = -1
        hh_popup.rcMargins.nLeft   = -1
        hh_popup.rcMargins.nTop    = -1
        hh_popup.rcMargins.nBottom = -1
        HtmlHelp hWnd, byval %NULL, %HH_DISPLAY_TEXT_POPUP, byval varptr(hh_popup)
    end sub
    %IDC_EDIT   = 100
    %IDC_COMBO  = 101
    %IDC_LIST   = 102
    function pbmain
        local hDlg as long
        dialog new 0, "",,,115, 140, %WS_SYSMENU or %DS_CENTER or %DS_CONTEXTHELP to hDlg
        control add combobox, hDlg, %IDC_COMBO,,5,5,100,14
        control add listbox,  hDlg, %IDC_LIST,, 5,25,100,50
        control add textbox,  hDlg, %IDC_EDIT,"", 5,70,100,50
        dialog show modal hDlg call DlgProc
    end function
    callback function DlgProc
        local lphi as HELPINFO pointer
        select case cbMsg
        case %WM_HELP
    	lphi = cblParam
    	select case @lphi.iCtrlId 
    	case %IDC_COMBO : ShowPopupHelp "This is a ComboBox"
    	case %IDC_LIST  : ShowPopupHelp "This is a ListBox"
    	case %IDC_EDIT  : ShowPopupHelp "This is a TextBox"		
    	end select
        end select
    end function