M
Mike
James said:"It works like VB6"
I assumed that this referred to the "my.Settings" reference in the above
line, and I asked
"It works like what in VB6?"
because I didn't know of anything in VB6 that worked in a way that was
like My.Settings. If this statement was meant to be helpful, why not let
us in one the secret of which part of VB6 works like My.Settings?
Like I mentioned in my response to Cor's "it works like VB6"
I never used this at the VB6 level...
what I did used in the past for our only VB6-based add-on product was
using the Win32 Private Profile API in INI mode.
So when Cor stated that, what resurfaced in my mind was the possible
connection to the MSDN documentation statement that My.Settings was a
"Compatibility module" and that was probably what Cor meant. i.e.
My.Settings replaces PrivateProfile with an XML storage method and/or
VB.NET had a similar MFC application class that wraps the Private
Profiles API.
But the usage is different and the question pertain to what amounted
in my mind to sharing the same process "My" namespace between the EXE
and DLL. (See technical note below).
In the final analysis, is that the same process user's local setting
storage location is used, however, the section used for each is separated:
So what you end up having is:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" ... >
<section name="YOUR-PROCESS-EXE.My.MySettings" ... />
<section name="YOUR-DLL.My.MySettings" ... />
</sectionGroup>
</configSections>
<userSettings>
<YOUR-PROCESS-EXE.My.MySettings>
... settings names and values ...
</YOUR-PROCESS-EXE.My.MySettings>
<YOUR-DLL.My.MySettings>
... settings names and values ...
</YOUR-DLL.My.MySettings>
</userSettings>
</configuration>
and this is stored (in User Scope):
%USERPROFILE%\Local Settings\Application Data
\COMPANY_NAME\YOUR-PROCESS-EXE_GUID\VERSION
user.config
Regarding the Sharing of namespace:
Ok, this is where I probably "over thought" that VB.NET provided
inherent support for Global Shared Memory of "MY" between all .NET
assemblies. My suspicion that it does for its own .NET purposes.
But at the application level, you have to role your own and this is
the same in all other languages. So if you wanted to share memory
created by a DLL or EXE you either have to compile the same RDATA
segment name or used a memory map using WIN32 API functions:
CreateFileMapping() (server uses this)
OpenFileMapping() (client uses this)
MapViewOfFile() (server/client uses this)
In other words, I thought "My" with its nested objects:
My.Application
My.Computer
My.Settings
My.User
was a GLOBAL shared memory map that allowed the EXE and her .NET dlls
to shared this "namespace"
At this point, I get the idea that it might be sharing, but there are
other things you need to prepare (security wise) to allow it to
happen. But for the settings, it uses the same file, but the sections
are different.
--