Page 1 of 1

dclipx DC_GetNetName() returnvalue undef.

Posted: Sun Jan 09, 2011 1:56 pm
by hz_scotty
hi Roger

i use the function DC_GetNetName() in my application

it returns the netname from the registry (my netname "MSI-WORKS" has 9 chars und the
function returns 10 chars (when i test it with "len(dc_GetName())")

when i display the return value with MSGBOX() i see "MSI-WORKS" - ok
when i display the return value with DC_MSGBOX i see only "MSI_WOR...." (the end has "...")
with DCSAY i see a undefind Char at the End of the Name (see Picture)
i think that the char at the end makes the "MSI-WOR..." Error in DC_MSGBOX()

my workaround is to trim the last char -

Code: Select all

cNetName:=substr(cNetName,1,len(cNetName)-1)
Can you look at your function if you can fix it
is use WinXP SP3 but the problem is also on VISTA und i hera about that on WIN7 it is also

thanks

Re: dclipx DC_GetNetName() returnvalue undef.

Posted: Sun Jan 09, 2011 3:25 pm
by rdonnay
Some Win API calls put a Chr(0) at the end of a string.

I would try this instead:

Code: Select all

cName := Strtran(cName,Chr(0),'')

RETURN (Upper(Alltrim(cName)))

Re: dclipx DC_GetNetName() returnvalue undef.

Posted: Sun Jan 09, 2011 4:04 pm
by hz_scotty
works fine :clap:

i put the line into DC_GetNetName() in _DCFUNCT.PRG - not in my Application!
so please remember this for your v255

thanks for help

Re: dclipx DC_GetNetName() returnvalue undef.

Posted: Sun Jan 09, 2011 7:33 pm
by rdonnay
I already made the change in 255.