Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to Set an Environment Vrbl in an xHarbour app ?

144 views
Skip to first unread message

Mel Smith

unread,
Apr 7, 2013, 1:44:28 PM4/7/13
to
Hi:

Altho there is a GETE() function for 'getting' an environmental vrbl,
there does not appear to be a corresponding SETE() function for *setting* an
enviro vrbl.

Can someone help please ?

Thanks,

--
Mel Smith


dlzc

unread,
Apr 7, 2013, 2:10:11 PM4/7/13
to
Dear Mel Smith:

On Sunday, April 7, 2013 10:44:28 AM UTC-7, Mel Smith wrote:

...
> Altho there is a GETE() function for 'getting'
> an environmental vrbl, there does not appear to be
> a corresponding SETE() function for *setting* an
> enviro vrbl.
>
> Can someone help please ?

Environment variables expire with each session, so only directly called executables would get a copy of what you had set. Permanent changes have to made in the registry.

Temporary changes: SetEnvironmentVariable(), no syntax listed on the website version of docs, but probably:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686206%28v=vs.85%29.aspx

You did want a temporary change?

David A. Smith

Mel Smith

unread,
Apr 7, 2013, 6:17:49 PM4/7/13
to
David said:

"> Environment variables expire with each session, so only directly called
executables would get a copy of what you had set. Permanent changes have to
made in the registry.
>
> Temporary changes: SetEnvironmentVariable(), no syntax listed on the
> website version of docs, but probably:
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms686206%28v=vs.85%29.aspx
>
> You did want a temporary change?


Yes, I do want a temporary change on my XP development machine.

I note that the Harbour guys have a hb_setenv(cEnvName,cEnvValue)
function *within* their ...\src\common\hbgete.c source, wheras we (i.e.,
xHarbour) do not, and was wondering why ?

Perhaps someone here could take advantage of that source ?

Thanks for the msdn link !

-Mel



dlzc

unread,
Apr 7, 2013, 9:31:59 PM4/7/13
to
Dear Mel Smith:

On Sunday, April 7, 2013 3:17:49 PM UTC-7, Mel Smith wrote:
...
> Yes, I do want a temporary change on my XP
> development machine.
>
> I note that the Harbour guys have a
> hb_setenv(cEnvName,cEnvValue) function *within*
> their ...\src\common\hbgete.c source, wheras we
> (i.e., xHarbour) do not, and was wondering why ?

When you have documentation for WinAPI, why would you make yet another arbitrary function name?

> Perhaps someone here could take advantage of
> that source ?

I would learn the lessons of the English language. If you need a word, steal it whole and intact. In this case, I'd stick with WinAPI, unless the Linux folks want to speak up.

> Thanks for the msdn link !

Yeppers.

David A. Smith.

Klas Engwall

unread,
Apr 8, 2013, 4:01:00 PM4/8/13
to
Hi David,

>> Yes, I do want a temporary change on my XP
>> development machine.
>>
>> I note that the Harbour guys have a
>> hb_setenv(cEnvName,cEnvValue) function *within*
>> their ...\src\common\hbgete.c source, wheras we
>> (i.e., xHarbour) do not, and was wondering why ?
>
> When you have documentation for WinAPI, why would you make yet
> another arbitrary function name?
>
>> Perhaps someone here could take advantage of
>> that source ?
>
> I would learn the lessons of the English language. If you need a
> word, steal it whole and intact. In this case, I'd stick with WinAPI,
> unless the Linux folks want to speak up.

Exactly. Why would anyone ever make anything that is not strictly
limited to Windows? :-)

Regards,
Klas

--- news://freenews.netfront.net/ - complaints: ne...@netfront.net ---

Mel Smith

unread,
Apr 8, 2013, 5:26:24 PM4/8/13
to
Hi David:

>> their ...\src\common\hbgete.c source, wheras we

>> (i.e., xHarbour) do not, and was wondering why ?
>
> When you have documentation for WinAPI, why would you make yet another
> arbitrary function name?
>
>> Perhaps someone here could take advantage of
>> that source ?
>
> I would learn the lessons of the English language. If you need a word,
> steal it whole and intact.

??? I'm reasonably proficient in English, and less so in French. But,
I misspelled 'whereas' above, and aside from that -- don't understand what
word I'm 'stealing'.

>In this case, I'd stick with WinAPI, unless the Linux folks want to speak
up.

I'd love to but don't know (or have forgotten) how to use the linked
setenvironment() function. Oh well, in the meantime I've implemented a
workaround (or is this word not used properly either ??) :((
>


dlzc

unread,
Apr 8, 2013, 11:22:54 PM4/8/13
to
Dear Mel Smith:

On Monday, April 8, 2013 2:26:24 PM UTC-7, Mel Smith wrote:
> > I would learn the lessons of the English language.
> > If you need a word, steal it whole and intact.
>
> ??? I'm reasonably proficient in English, and
> less so in French. But, I misspelled 'whereas'
> above, and aside from that -- don't understand what
> word I'm 'stealing'.

Sorry, I guess I was being obtuse. You did not use a word incorrectly. I simply wanted to indicate that English, like xHarbour, accumulates words from other languages:
http://www.ling.upenn.edu/~beatrice/humor/purity.html

> > In this case, I'd stick with WinAPI, unless the
> > Linux folks want to speak up.
>
> I'd love to but don't know (or have forgotten)
> how to use the linked setenvironment() function.
> Oh well, in the meantime I've implemented a
> workaround (or is this word not used properly
> either ??) :((

Whatever works. Just document what you have done, so you can find your way out.

David A. Smith

dlzc

unread,
Apr 8, 2013, 11:44:39 PM4/8/13
to
Dear Klas Engwall:

On Monday, April 8, 2013 1:01:00 PM UTC-7, Klas Engwall wrote:
...
> Exactly. Why would anyone ever make anything that
> is not strictly limited to Windows? :-)

I cannot seem to find the API for Linux, to see what it is called there...

David A. Smith

Saulius

unread,
Apr 9, 2013, 2:38:51 PM4/9/13
to
Hi Mel,

> Altho there is a GETE() function for 'getting' an environmental vrbl, there does not appear to be a
> corresponding SETE() function for *setting* an enviro vrbl.
>
> Can someone help please ?

Build 9947

2013-04-09 21:35 UTC+0200 Saulius Zrelskis
* include/hbapi.h
* source/common/hbgete.c
* source/rtl/gete.c
+ new function (only MS-Windows builds):
SETENV(<cEnvironmentVariable>,[<cNewValue>][,<lSystem>]) -> lSuccess
Show <lSystem> == .T. when you need modify system environment variable.
This allows other applications to pick up your updates.

Saulius


dlzc

unread,
Apr 9, 2013, 2:50:15 PM4/9/13
to
Dear Saulius:

On Tuesday, April 9, 2013 11:38:51 AM UTC-7, Saulius wrote:
...
> > Altho there is a GETE() function for
> > 'getting' an environmental vrbl, there does not
> > appear to be a corresponding SETE() function
> > for *setting* an enviro vrbl.
>
> > Can someone help please ?
>
> Build 9947
>
> 2013-04-09 21:35 UTC+0200 Saulius Zrelskis
> * include/hbapi.h
> * source/common/hbgete.c
> * source/rtl/gete.c
> + new function (only MS-Windows builds):
> SETENV(<cEnvironmentVariable>,;
> [<cNewValue>] ;
> [,<lSystem>]) -> lSuccess
>
> Show <lSystem> == .T. when you need
> modify system environment variable.

Does this logical mean you push it into the Registry, so that it is a permanent change for every future CMD.EXE session?

> This allows other applications to pick
> up your updates.

David A. Smith

Saulius

unread,
Apr 9, 2013, 3:04:21 PM4/9/13
to
Dear David,

> Does this logical mean you push it into the Registry, so that it is a permanent change for every future
> CMD.EXE session?
>
>> This allows other applications to pick
>> up your updates.

Yes

Saulius


Saulius

unread,
Apr 9, 2013, 3:07:01 PM4/9/13
to
Build 9948

2013-04-09 22:00 UTC+0200 Saulius Zrelskis
* source/common/hbgete.c
! pacify warning for MINGW32 build

* source/rtl/gete.c
+ add abbreviated function SETE for SETENV

Saulius


Mel Smith

unread,
Apr 9, 2013, 3:29:02 PM4/9/13
to
Saulius said:

"Saulius" <lab...@gmail.com> wrote in message
news:kk1os7$ac0$1...@speranza.aioe.org...
Hi Saulius:

Will work on posting the build later today.

Thanks !

-Mel


0 new messages