Solved

Powerbuilder Setting Environment variables in Windows 7

Posted on 2011-02-22
4
2,053 Views
Last Modified: 2013-12-26
Hi,

We define a local external function in a window below as

//Local External function
Function Boolean SetEnvironmentVariableA(String lpName, String lpValue) Library "kernel32.dll"

and then in a script call as
Boolean            lbl_ret       = TRUE
String             ls_envname
String            ls_version

ls_version      =      "1.0"
ls_env_name = "TESTENV"

lbl_ret = SetEnvironmentVariableA ( ls_envname, ls_version )

This works on XP, but not with Windows 7.
i.e The environment variable is created in XP, but  not in Windows 7.

Any help on how to create an environment variable from Powerbuilder in Windows 7 very much appreciated. ( Please note, for security reasosn, we are unable to use the RegistrySet function )

Running Powerbuilder 10.5.2 Build 7826



0
Comment
Question by:cintra
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
elimesika earned 150 total points
Comment Utility
HI
In windows 7 this function is in
api-ms-win-core-processenvironment-l1-1-0.dll

See
http://www.nirsoft.net/articles/windows_7_kernel_architecture_changes.html
Function Boolean SetEnvironmentVariableA(String lpName, String lpValue) Library "api-ms-win-core-processenvironment-l1-1-0.dll"

Open in new window

0
 
LVL 2

Assisted Solution

by:kmanoharnaik
kmanoharnaik earned 100 total points
Comment Utility
Hi,

if it works in XP, not in WIndows 7, try adding alias name as below

alias for "SetEnvironmentVariableA;Ansi"

i am not sure if it works.

Please let me know if it works.

thanks
manohar
0
 

Author Comment

by:cintra
Comment Utility
Thanks for both replies. Will check them both out and let you know the outcome, as well as awarding points.
0
 

Author Comment

by:cintra
Comment Utility
The "SetEnvironmentVariableA;Ansi" did not work, though the use of the Ansi at the end was very useful info.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now