Page 1 of 1

Runprogram and %systemroot%

Posted: Sun Aug 31, 2003 9:52 pm
by Snooze
Hi all!

I would like to activate the windows 2000 compatibility dll.

Why this piece of code doesnt work?

Code: Select all

RunProgram("regsvr32", "/s %systemroot%\apppatch\slayerui.dll", "", 1 | 2)
Finally, i've used :

Code: Select all

; find the file with API
path$=Space(255) : r=SearchTreeForFile_("c:\","slayerui.dll",path$)
; register the dll
RunProgram("regsvr32","/s "+path$,"",1 | 2)
It works, but is it possible to use %systemroot% ?
Thanks a lot and sorry for my bad english.

Posted: Sun Aug 31, 2003 11:05 pm
by Fred
You need to use GetEnvironmentVariable_() to retrieve the systemroot value. RunProgram() doesn't handle it.

Ok

Posted: Sun Aug 31, 2003 11:13 pm
by Snooze
Fred wrote:You need to use GetEnvironmentVariable_() to retrieve the systemroot value. RunProgram() doesn't handle it.
Thanks Fred. I will take a look.

Merci pour ce travail fantastique que tu fais sur Purebasic :D

Posted: Sun Aug 31, 2003 11:27 pm
by Fred
Thx :)

Here ya go

Posted: Sun Aug 31, 2003 11:33 pm
by Hi-Toro
By strange coincidence, I used this yesterday :)

Code: Select all


Procedure.s ExpandEnv (env$)
    ; Call once to get size of required string...
    sizerequired = ExpandEnvironmentStrings_ (env$, dest$, 0)
    If sizerequired
        ; Fill the new string with the path...
        dest$ = Space (sizerequired)
        result = ExpandEnvironmentStrings_ (env$, dest$, 159)
    EndIf
    ProcedureReturn dest$
EndProcedure

Debug ExpandEnv ("%systemroot%")


Posted: Mon Sep 01, 2003 7:48 am
by Snooze
Excellent, Hi-Toro ! :D

Thanks for your code.

Re: Here ya go

Posted: Mon Sep 01, 2003 9:49 am
by GPI
Hi-Toro wrote:By strange coincidence, I used this yesterday :)

Code: Select all


Procedure.s ExpandEnv (env$)
    ; Call once to get size of required string...
    sizerequired = ExpandEnvironmentStrings_ (env$, dest$, 0)
    If sizerequired
        ; Fill the new string with the path...
        dest$ = Space (sizerequired)
        result = ExpandEnvironmentStrings_ (env$, dest$, 159)
    EndIf
    ProcedureReturn dest$
EndProcedure

Debug ExpandEnv ("%systemroot%")

Maybe you should check, which windows is running, because %systemroot% is no envroment-variable in a Win9X-System

GPI

Posted: Mon Sep 01, 2003 9:55 am
by Rings
GPI:
Snooze wrote:I would like to activate the windows 2000 compatibility dll.
who wants Win89 ??? :D

Posted: Mon Sep 01, 2003 11:32 am
by GPI
Rings wrote:GPI:
Snooze wrote:I would like to activate the windows 2000 compatibility dll.
who wants Win89 ??? :D
When you have Win89, you should realy take care about it. It is very rare...