Grabber

... Type content here!

#compile exe
#dim all
%ID_InputTxtBx  = 1000
%ID_ExCaption1 = 900
%ID_ExCaption2 = 901
%ID_CharHexBtn  = 1001
%ID_CharHexTxtBx = 1002
%ID_ToClipBdBtn = 1003
%ID_ExitBtn     = 1004
#resource icon, 101, ".\Grab.ico"
callback function DlgCB() as long
  local TmpStr as wstring
  if cb.msg = %wm_command then
    select case as long cb.ctl
      case %ID_CharHexBtn
        control get text cb.hndl, %ID_InputTxtBx to TmpStr
        TmpStr = hex$(asc(TmpStr), 4)
        control set text cb.hndl, %ID_CharHexTxtBx, "&h" + TmpStr + "??"
      case %ID_ToClipBdBtn
        control get text cb.hndl, %ID_CharHexTxtBx to TmpStr
        clipboard set text TmpStr
      case %ID_ExitBtn
        dialog end cb.hndl
    end select
  end if
end function
'-------------------------------------------------------------------------------
function pbmain () as long
  local Str as wstring
  local hDlg, hFont8 as dword
  dialog default font "Tahoma", 12, 0, 1
  dialog new 0, "Grab a wide character by copy,", , , 104, 71, %ds_3dlook or _
     %ds_nofailcreate or %ds_setfont or %ws_caption or %ws_clipsiblings or _
     %ws_dlgframe or %ds_modalframe or %ws_popup or %ws_sysmenu, _
     %ws_ex_left or %ws_ex_ltrreading or %ws_ex_rightscrollbar to hDlg
  dialog set icon hDlg, "#101"
  font new "Microsoft Sans Serif", 8, 0, 1, 0  to hFont8
  control add label, hDlg, %ID_ExCaption1, "", 0, 0, 11, 9
  control set color hDlg, %ID_ExCaption1, -1, &h00FFFFFF
  control add label, hDlg, %ID_ExCaption2, _
     "paste, and get hex value for source code.", 11, 0, 93, 9
  control set color hDlg, %ID_ExCaption2, -1, &h00FFFFFF
  control set font hDlg, %ID_ExCaption2, hFont8

  control add textbox, hDlg, %ID_InputTxtBx, "", 4, 14, 12, 14, %es_center or _
     %ws_border or %ws_tabstop , %ws_ex_clientedge or %ws_ex_left
  control add button, hDlg, %ID_CharHexBtn, chr$$(&h25C4??) + _
     " Character To Hex", 17, 14, 82, 13
  control add textbox, hDlg, %ID_CharHexTxtBx, "", 4, 32, 39, 14, _
     %es_center or %ws_border or %ws_tabstop , %ws_ex_clientedge or %ws_ex_left
  control add button, hDlg, %ID_ToClipBdBtn, chr$$(&h25C4??) + _
     " To ClipBoard", 44, 32, 55, 13
  control add button, hDlg, %ID_ExitBtn, "Exit", 38, 52, 30, 15
  '
  dialog show modal hDlg call DlgCB
  font end hFont8
end function

Created on August 26, 2021