sendtojp
asked on
Variables with "All of Windows" Scope
I was wondering if it is possible to create code for Variables that will last for any Application during a session of Windows.
Example:
I open CountApples.exe which Apples=120
I close CountApples.exe
I open InventoryList.exe which prints Apples=120
Example:
I open CountApples.exe which Apples=120
I close CountApples.exe
I open InventoryList.exe which prints Apples=120
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Is there a 'Plain Vanilla' subroutine with a few lines of code to gain a quick understanding. I spppose you can use Registry to simulate a Variable.
ASKER
I will check back in the morning (it's 0437 here), I have to goto bed.
ASKER
Dhaest,
Do you have I 'Plain Vanilla' (aka 'Hello World' Example). I have accessed DLL's before but never have I written to the Registry. You can use above Apple example or equalvant. I will also raise the point and give you an 'A' grade.
Thank You your help,
-JP
Do you have I 'Plain Vanilla' (aka 'Hello World' Example). I have accessed DLL's before but never have I written to the Registry. You can use above Apple example or equalvant. I will also raise the point and give you an 'A' grade.
Thank You your help,
-JP
ASKER
That's ...for your help opps
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Can you explain the Arguments of SaveSetting, I checked it in MSDN it assumes you know the Registry.
SaveSetting appname, section, key, setting
When this is done, I will raise the points and give some to Dhaest and Ark.
Thanks for both your help.
-JP
SaveSetting appname, section, key, setting
When this is done, I will raise the points and give some to Dhaest and Ark.
Thanks for both your help.
-JP
Hi
Get/Save settings works with HKEY_CURRENT_USER\Software \VB and VBA Program Settings registry key.
Arguments:
appname - string - subkey under above key. Usually set to App.EXE name, though it can be any unique string
section - string - subkey under "appname" subkey. Any string (unique) you want.
key - string - subkey under "section" subkey. Any string (unique) you want. Usualy sets to variable name.
setting - string - registry value of "key" subkey. Usually sets to variable value.
In my sample above:
appname = MyApp
section = GlobalVar
key = "Apple"
setting = 240
So, my sample above use a subkey(s) (create one if it doesn't exist):
HKEY_CURRENT_USER\Software \VB and VBA Program Settings\MyApp\GlobalVar\X XXXX
where XXXXX is your variable(s) name(s) ("Apple" in sample) and set it (they) value(s) to YYYYYY (240 in a sample).
Get/Save settings works with HKEY_CURRENT_USER\Software
Arguments:
appname - string - subkey under above key. Usually set to App.EXE name, though it can be any unique string
section - string - subkey under "appname" subkey. Any string (unique) you want.
key - string - subkey under "section" subkey. Any string (unique) you want. Usualy sets to variable name.
setting - string - registry value of "key" subkey. Usually sets to variable value.
In my sample above:
appname = MyApp
section = GlobalVar
key = "Apple"
setting = 240
So, my sample above use a subkey(s) (create one if it doesn't exist):
HKEY_CURRENT_USER\Software
where XXXXX is your variable(s) name(s) ("Apple" in sample) and set it (they) value(s) to YYYYYY (240 in a sample).
ASKER
How would you store it in Registry.