Re: This does not work on XP Attn: Rod Damon

new topic     » topic index » view thread      » older message » newer message

..alternative ? , try''''d on Win98/2000

constant
 C_INT=#01000004
,k32=machine_func(50,"kernel32.dll")
,getProfileString=
machine_func(51,{k32,"GetProfileStringA",{C_INT,C_INT,C_INT,C_INT,C_INT},C_INT})
,xlstrlen=
  machine_func(51,{k32,"lstrlen",{C_INT},C_INT})

global function peek_str(atom lpzString)
  return peek({lpzString,c_func(xlstrlen,{lpzString})})
end function

function alloc_str(sequence s)
    atom mem
    mem = machine_func(16,(length(s) + 1))
    if mem then
 poke(mem, s)
 poke(mem+length(s), 0)
    end if
    return mem
end function

constant
 lpAppName=alloc_str("windows")
,lpKeyName=alloc_str("device")
,lpDefault=alloc_str(" ") --space!
,lpReturnedString=machine_func(16,128) -- long enuf? blink

atom result
result=c_func(getProfileString,{
 lpAppName,
 lpKeyName,
 lpDefault,
 lpReturnedString,
 128 })

sequence printerName
printerName={}
integer at, ret
at=0  ret=0
while ret != ',' do
ret=peek(lpReturnedString+at)
printerName=printerName & ret
at += 1
end while
printerName=printerName[1..length(printerName)-1]
printf(1,"%s\n",{printerName})

machine_proc(64,5)


new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu