[SOLVED] It is posible to decode the formlayout registry key?

Author: fearandir@gmail.com (fearandir)

Simple question.   It is posible to decode the formlayout windows registry key content? We would like to know the previous form layout before open it to assign a especific ini configuration based on this information.   Regards, Sergio


  1. Yes, it is. The first 2048 characters contain the layout (splitbar positions) and at the end is the form position/size stored. This should do the trick (I Hope):

    variables   raw vResult   string vHex   string vLayout   numeric x, y, cx, cy endvariables vResult = $setting("", "[HKEY_CURRENT_USER\Software\Uniface\Uniface 9\State\%%$applname%%%\Forms\%%$componentname%%%]formlayout2", "REGDATA") vHex = $encode("HEX", vResult) vLayout = $encode("USTRING", $decode("HEX", vHex[1:4096])) x = hexToNum(vHex[4097:8]) y = hexToNum(vHex[4105:8]) cx = hexToNum(vHex[4113:8]) cy = hexToNum(vHex[4121:8]) return(0) ; *** Convert Hex to Numeric entry hexToNum   params     string pHex : IN   endparams   variables     numeric nPos, nPow, nHex     string toHex, sHex   endvariables   toHex = "0=0·;1=1·;2=2;3=3·;4=4·;5=5·;6=6·;7=7·;8=8·;9=9·;A=10·;B=11·;C=12·;D=13·;E=14·;F=15"   for nPos = ($length(pHex)-1) to 1 step -2     sHex = $concat(sHex, pHex[nPos:2])   endfor   pHex = sHex   sHex = ""   nPos = 1   nPow = $length(pHex) - 1   while (nPos <= $length(pHex))     sHex = pHex[nPos:1]     nHex += $number($item(sHex, toHex)) * $power(16, nPow)     nPos += 1     nPow -= 1   endwhile   return nHex end ;- entry hexToNum

    Hope this helps. Regards, Daniel

    Author: diseli (daniel.iseli@uniface.com)
  2. Hallo Daniel Why not a simple, straightforword function to convert hex to decimal :-) Ingo

    ENTRY LP_DEC params     string v_HEX:IN   endparams   variables     numeric v_NUM     numeric v_I   endvariables   v_NUM = 0   FOR v_I = 1 TO $length(v_HEX)     v_NUM = v_NUM * 16 + $scan("0123456789ABCDEF",v_HEX[v_I:1])-1   ENDFOR   RETURN(v_NUM) END ; LP_DEC

    Author: istiller (i2stiller@gmx.de)
  3. Nice! Solved! Thank you

    Author: fearandir (fearandir@gmail.com)