Saving & Restoring User Info on Forms
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Saving & Restoring User Info on Forms
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
Jorge Jimenez
Guest





Posted: Sun Jan 09, 2005 12:03 am    Post subject: Re: Saving & Restoring User Info on Forms Reply with quote

I agree.
Registry should hold general options and personal
settings plus default values. A standard user should
be able to run the software without problems.
Installation may require admin, to set some special
registry values, but that should be it.

Software that writes usable company data to the registry
is also hard to move to a new computer.
This sort of data should be placed in a file or database
in the user's document or the common files dir
depending on the type and the intended use of the data.

--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica

"R. Robert Bell" <NOT.RobertB@MWEngineers.com> wrote in message
news:41e004c8_1@newsprd01...
Quote:
I understand... "If it ain't broke, don't fix it." I know that storing data
in an external file might not be ideal in your circumstance.

Personally, one of my tests for "professional software" is if it will run
under a limited/restricted user. Unhappily, it seems that most design
software is written without regard to this criteria.

--
R. Robert Bell


"Laurie Comerford" <laurie@DeleteThiscadapps.com.au> wrote in message
news:41df350c_3@newsprd01...
Hi Robert,

In general I agree with your comments and would like to think I could make
it work that way.

However, the situation is not black and white and is dependent on the
nature
of the data we are dealing with.

Any one of a number of users in the system may create data which is not
user
specific, but company useable and relatively stable, but not necessarily.
If the user is unable to make that data available via the registry, it
means
that each user has to recreate it, or there has to be a human system in
place where the user Emails the IT and says "Please do this".

I have no solution to this problem, but in the absence of a client
complaint, have not needed to resolve it. Practical suggestions are
welcome.

At this stage, I don't really want to go back to writing the data to a
file.

--


Laurie Comerford
CADApps
www.cadapps.com.au


"R. Robert Bell" <NOT.RobertB@MWEngineers.com> wrote in message
news:41dea684_1@newsprd01...
Laurie,

I wish, for lots of IT manager's sakes, that you would reconsider _some_
of
your approach. The rest of my comment is based on the IT perspective.

I don't mind being forced to do an _initial_ install as an Admin, so that
some information will get placed in HKLM.
All my users are now defined as Limited users in WinXP. This helps me
keep
the idiots... I mean, users... from installing Gator and Kazaa and
Latest_ScuzWare_From_Really_Cool_Toolbar_Vendor_of_the_Day.
This means that all my users would *not* be able to run your programs.
This
is a bad thing, would not you agree?
To force company standards, sure, place data in HKLM, but make an Admin
login the one to edit the changes. If any plain-Jane user can edit it,
what
good is it as a "standard"?
Copy the differential data from HKLM to HKCU and use *that* hive for user
support and custom settings.

--
R. Robert Bell


"Laurie Comerford" <laurie@DeleteThiscadapps.com.au> wrote in message
news:41de756f_3@newsprd01...
Hi Tony,

I'm sorry for my lack of clarity:

Let me reiterate:

The need to use HKLM for the licence data was requested by our clients.
Many of them have users who share computers on an availability basis and
they found it highly inconvenient having to setup the licencing for every
user on every computer due to our initial licensing system relying on
data
in HKCU.

Having investigated and created a method for putting data in HKLM, it was
also sensible for the settings data associated with our programs be
available to all users, rather than having the company create it for each
user by doing multiple installations and then modifying each set of
settings
data from our defaults for the settings, to match the company
requirements.

This data is user adjustable and can be added to by users. If an
individual
user develops additional data, then it is highly desirable that this data
also is available to the co-workers.

Hence for us, HKLM is the way to go.

Obviously there are other types of data which are user specific, but they
don't apply in our case.




Back to top
Nathan Taylor
Guest





Posted: Mon Jan 10, 2005 3:11 am    Post subject: Re: Saving & Restoring User Info on Forms Reply with quote

Like Tony I thought we were discussing the original posters circumstances. If you read the original post it should be clear that Oberor was aready specifically storing the data for each user.

Regards - Nathan
Back to top
AKS
Guest





Posted: Mon Jan 10, 2005 8:25 pm    Post subject: Re: Saving & Restoring User Info on Forms Reply with quote

In my opinion, writing to the Window's registry exemplifies what is wrong with that OS. Our IT folks wisely keep us from altering it. For what it is worth, the following crude and brute force method of using a text file to save a form's state is easy to manage, fast, easily adapted, and has always worked for me. These are the main componants from a project:

Sub GetPrefs()
Dim MacroPref As String
Dim x As Integer
Dim stat As Integer
On Error GoTo skip
'MacroPref = Preferences.Files.TempFilePath & PrefData
MacroPref = PrefPath & PrefData
Open MacroPref For Input As #1
Do While Not EOF(1) ' Loop until end of file.
Input #1, Line
Select Case Left(Line, 3)
Case Is = "fx:" ' dialog left
DlgLeft = Right(Line, Len(Line) - 3)
Case Is = "fy:" ' dialog top
DlgTop = Right(Line, Len(Line) - 3)
Case Is = "rs:" ' resolution
Res = Val(Right(Line, Len(Line) - 3))
Case Is = "la:" ' resolution
HidLayer = Right(Line, Len(Line) - 3)
Case Is = "lt:" ' resolution
HidLinType = Right(Line, Len(Line) - 3)
Case Is = "co:" ' resolution
HidColor = Right(Line, Len(Line) - 3)
Case Is = "gd:" ' gap distance
GapDist = Val(Right(Line, Len(Line) - 3))
Case Is = "ug:" ' use gap distance
UseGap = Right(Line, Len(Line) - 3)
Case Is = "ul:" ' use layer
UseLay = Right(Line, Len(Line) - 3)
Case Is = "ut:" ' use linetype
UseLineT = Right(Line, Len(Line) - 3)
Case Is = "uc:" ' use color
UseColor = Right(Line, Len(Line) - 3)
Case Is = "kt:" ' keep trucking
KeepTruckn = Right(Line, Len(Line) - 3)
Case Is = "tm:" ' Trim mode
TrimMode = Right(Line, Len(Line) - 3)
Case Is = "im:" ' Int mode
IntMode = Right(Line, Len(Line) - 3)
End Select
Loop
Close #1 ' Close file.
skip:
On Error GoTo 0
End Sub

Private Sub SavePrefs()
Dim MacroPref As String
Dim x As Integer
On Error GoTo skip
'MacroPref = Preferences.Files.TempFilePath & PrefData
MacroPref = PrefPath & PrefData
Close #1
Open MacroPref For Output As #1
Print #1, "This is the BREAK2HIDDEN.DVB preferences file. " & Issue
On Error GoTo skip
Print #1, "fy:"; DlgTop
Print #1, "fx:"; DlgLeft
Print #1, "rs:"; Res ' default resolution
Print #1, "la:"; HidLayer ' default layer
Print #1, "lt:"; HidLinType ' default linetype
Print #1, "co:"; HidColor ' default color
Print #1, "gd:"; GapDist ' gap distance
Print #1, "ug:"; UseGap ' use gap distance
Print #1, "ul:"; UseLay ' use layer
Print #1, "ut:"; UseLineT ' use linetype
Print #1, "uc:"; UseColor ' use color
Print #1, "kt:"; KeepTruckn ' keep trucking mode
Print #1, "tm:"; TrimMode ' trim mode
Print #1, "im:"; IntMode ' intersection mode
skip:
Close #1
On Error GoTo 0
End Sub

AKS

Back to top
Oberer
Guest





Posted: Mon Jan 10, 2005 8:35 pm    Post subject: Re: Saving & Restoring User Info on Forms Reply with quote

AKS wrote :
"Re: Saving & Restoring User Info on Forms
In my opinion, writing to the Window's registry exemplifies what is wrong with that OS. Our IT folks wisely keep us from altering it."

From lack of info, and not being an IT guy, this has been my opinion. I'm one of those uninformed people who think there's something "special" about the registry.
If there is, then "... exemplifies what is wrong with that OS..
" is very appropriate & true.

I had originally started this thread due to my programming ignorance. I currently store settings in a table. I think I'll stick with the db for now. Thanks for all the help and dicussion. This board is a wealth of information!
Back to top
Ed Jobe
Guest





Posted: Mon Jan 10, 2005 9:52 pm    Post subject: Re: Saving & Restoring User Info on Forms Reply with quote

If you want to use files, I you might look into using the api functions for
working with ini files. This more closely parallels the .NET method of using
xml and config files. Ini files use [Section] tags and key, value pairs to
store info and is easy to use.

--
----
Ed
----
"Oberer" <nospam@address.withheld> wrote in message
news:6558328.1105371372487.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
AKS wrote :
"Re: Saving & Restoring User Info on Forms
In my opinion, writing to the Window's registry exemplifies what is wrong
with that OS. Our IT folks wisely keep us from altering it."

From lack of info, and not being an IT guy, this has been my opinion. I'm
one of those uninformed people who think there's something "special" about

the registry.
Quote:
If there is, then "... exemplifies what is wrong with that OS..
" is very appropriate & true.

I had originally started this thread due to my programming ignorance. I
currently store settings in a table. I think I'll stick with the db for

now. Thanks for all the help and dicussion. This board is a wealth of
information!
Back to top
Nathan Taylor
Guest





Posted: Tue Jan 11, 2005 2:35 am    Post subject: Re: Saving & Restoring User Info on Forms Reply with quote

Just for my information what is wrong with storing info in the registry. My experience is that IT departments prevent registry editing to stop people stuffing things up not to prevent programmers writing to it.
Regards - Nathan
Back to top
Oberer
Guest





Posted: Tue Jan 11, 2005 2:41 am    Post subject: Re: Saving & Restoring User Info on Forms Reply with quote

Ed- as a creature of old habit, i'm more comfortable and familiar with tables. I suppose I also rely on the db to do things our native methods don't (like sort layer names), so I typically use temp tables for this.
To be a bit more clear, what i'm trying to say is that since I already write to a db for forms, I may as well stay there for saving data...


Nathan wrote:
Just for my information what is wrong with storing info in the registry. My experience is that IT departments prevent registry editing to stop people stuffing things up not to prevent programmers writing to it.
Regards - Nathan

>I'm curious as well. the hives have always had the "sacred aura" - why? if they're THAt crucial to the os, isn't it a bit insane to provide such easy access? if not, then why all the hoopla about writing to it?
Back to top
Laurie Comerford
Guest





Posted: Tue Jan 11, 2005 4:55 am    Post subject: Re: Saving & Restoring User Info on Forms Reply with quote

Hi Nathan,

Following comments made by Ed and Tony, I have rung around a few of the IT
Managers with whom I'm on friendly terms and asked for opinions.

They all strongly support the general concept that normal users cannot write
to the HKLM part of the registry.

Installers can and hence I am going to revise my software such that the
Installer can nominate a data storage location where users have read/write
access and I will write the location to the HKLM so that the software can
find it. This has a further functionality increase as the data location
nominated can be on a data server, and hence becomes available to the whole
office.

Back to Oberon's original query: I believe he has reached the right
conclusion in writing the data to a file format with which he is familiar.

With my code it will be easiest to use CSV files, but I'm wondering if,
despite the learning exercise, I should use XML for future compatibility
with .NET

--


Laurie Comerford
CADApps
www.cadapps.com.au


"Nathan Taylor" <nospam@address.withheld> wrote in message
news:12442244.1105392960561.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
Just for my information what is wrong with storing info in the registry.
My experience is that IT departments prevent registry editing to stop people

stuffing things up not to prevent programmers writing to it.
> Regards - Nathan
Back to top
Oberer
Guest





Posted: Tue Jan 11, 2005 10:07 pm    Post subject: Re: Saving & Restoring User Info on Forms Reply with quote

Thanks again for the input. This thread seems like it helped a few people out :)
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB