Prev: Sorting UDTs
Next: Copy from ListBox to TextBox
From: Karl E. Peterson on 28 Jun 2010 15:41 Claire laid this down on his screen : > Karl, what is wrong with that folder: > C:\ProgramData\<my app title> > ? > It is listed on the webpage you provided link to. There is nothing "wrong" with it. As I said, it's just like HKEY_LOCAL_MACHINE in the registry, though. And "normal" apps no longer have *write* access to that, either. Your application should have no trouble *reading* data that's stored there. But this location isn't meant for ad hoc read/write access. The idea is to write there at setup, or in a similar "admin" mode, and then just read it from then on. > If that folder location is wrong which location will be safer? > I need the location for all users. Microsoft doesn't think that all users should be modifying each other's data anymore. Nothing you can do won't be "breaking the rules" in some way, if that's what you need, I'm afraid. Each user should be taking a copy of the original "config" (or whatever this data is) and then modifying their own copy in CSIDL_APPDATA, if you want to insure the highest compliance (least headaches). Straight from the horse's orifice: http://msdn.microsoft.com/en-us/library/ms995853.aspx#w2kcli_req42 -- ..NET: It's About Trust! http://vfred.mvps.org
From: Kevin Provance on 28 Jun 2010 16:23 Looks like Randy beat me to it: http://vbnet.mvps.org/index.html?code/helpers/isos.htm -- Customer Hatred Knows No Bounds at MSFT Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc Bawwk! Paulie want a dingleball, bawwk! "Karl E. Peterson" <karl(a)exmvps.org> wrote in message news:i0aoto$l4b$1(a)news.eternal-september.org... : Kevin Provance expressed precisely : : > "Karl E. Peterson" <karl(a)exmvps.org> wrote in message : > news:i0amje$v6a$1(a)news.eternal-september.org... : > : >> Which test is failing? First thing I'd change is the test for : >> GetVersionEx return. : > : > Ever heard of the IsOS API call? It returns a boolean based on an fed : > instruction. Fairly cool thing. : : Huh? No, not familiar. : : -- : .NET: It's About Trust! : http://vfred.mvps.org : :
From: Karl E. Peterson on 28 Jun 2010 16:39 Kevin Provance explained on 6/28/2010 : > Looks like Randy beat me to it: > http://vbnet.mvps.org/index.html?code/helpers/isos.htm Nice. I particularly like a couple of the new flags. I wonder about this implementation: 'Because the API is defined by name (IsOs) only in Vista 'and later, we have to at least use GetVersionEx 'to find out if the named or ordinal version of the 'API needs to be called based on the OS the code 'is being run on. 'There are at least two ways of doing this: '1) attempt calling the ordinal API passing OS_VISTA; ' the ordinal-named API called on Vista works for ' backwards compatibility with earlier apps, or '2) call GetVersionEx using the IsWinVista wrapper function. ' 'Code for both methods are included in this demo; the 'commented out line below would call the second method. What's wrong with just calling it by ordinal, with error trapping, and falling back to using the export name as needed (probably far in the future)? The function design shows some serious intelligence upgrades have taken place, too, as new constants can be added at will over time! :-) Thanks... Karl -- ..NET: It's About Trust! http://vfred.mvps.org
From: Kevin Provance on 28 Jun 2010 17:01 "Karl E. Peterson" <karl(a)exmvps.org> wrote in message news:i0b19p$vq3$1(a)news.eternal-september.org... : Nice. I particularly like a couple of the new flags. I wonder about : this implementation: : : 'Because the API is defined by name (IsOs) only in Vista : 'and later, we have to at least use GetVersionEx : 'to find out if the named or ordinal version of the : 'API needs to be called based on the OS the code : 'is being run on. : : 'There are at least two ways of doing this: : '1) attempt calling the ordinal API passing OS_VISTA; : ' the ordinal-named API called on Vista works for : ' backwards compatibility with earlier apps, or : '2) call GetVersionEx using the IsWinVista wrapper function. : ' : 'Code for both methods are included in this demo; the : 'commented out line below would call the second method. : : What's wrong with just calling it by ordinal, with error trapping, and : falling back to using the export name as needed (probably far in the : future)? : : The function design shows some serious intelligence upgrades have taken : place, too, as new constants can be added at will over time! :-) : Yeah, I saw that too...looking over Randy's code for the error trap for entry point not found. That's how I would do it as well.
From: Karl E. Peterson on 28 Jun 2010 17:15
Kevin Provance wrote: > "Karl E. Peterson" <karl(a)exmvps.org> wrote... >> What's wrong with just calling it by ordinal, with error trapping, and >> falling back to using the export name as needed (probably far in the >> future)? > > Yeah, I saw that too...looking over Randy's code for the error trap for > entry point not found. That's how I would do it as well. Something like this? ' IsOS was undoc'd and exported by ordinal only until Vista. Private Declare Function IsOS Lib "shlwapi.dll" (ByVal dwOS As Long) As Long Private Declare Function IsOSAsOrdinal Lib "shlwapi.dll" Alias "#437" (ByVal dwOS As Long) As Long ' Returns TRUE/FALSE depending on question Private Const OS_WINDOWS = 0 ' Windows 9x vs. NT Private Const OS_NT = 1 ' Windows 9x vs. NT Private Const OS_WIN95ORGREATER = 2 ' Win95 or greater Private Const OS_NT4ORGREATER = 3 ' NT4 or greater Private Const OS_WIN98ORGREATER = 5 ' Win98 or greater Private Const OS_WIN98_GOLD = 6 ' Win98 Gold (Version 4.10 build 1998) Private Const OS_WIN2000ORGREATER = 7 ' Some derivative of Win2000 ' NOTE: these flags check explicitly for (dwMajorVersion == 5) Private Const OS_WIN2000PRO = 8 ' Windows 2000 Professional (Workstation) Private Const OS_WIN2000SERVER = 9 ' Windows 2000 Server Private Const OS_WIN2000ADVSERVER = 10 ' Windows 2000 Advanced Server Private Const OS_WIN2000DATACENTER = 11 ' Windows 2000 Data Center Server Private Const OS_WIN2000TERMINAL = 12 ' Windows 2000 Terminal Server in "Application Server" mode (now simply called "Terminal Server") Private Const OS_EMBEDDED = 13 ' Embedded Windows Edition Private Const OS_TERMINALCLIENT = 14 ' Windows Terminal Client (eg user is comming in via tsclient) Private Const OS_TERMINALREMOTEADMIN = 15 ' Terminal Server in "Remote Administration" mode Private Const OS_WIN95_GOLD = 16 ' Windows 95 Gold (Version 4.0 Build 1995) Private Const OS_MEORGREATER = 17 ' Windows Millennium (Version 5.0) Private Const OS_XPORGREATER = 18 ' Windows XP or greater Private Const OS_HOME = 19 ' Home Edition (eg NOT Professional, Server, Advanced Server, or Datacenter) Private Const OS_PROFESSIONAL = 20 ' Professional (aka Workstation; eg NOT Server, Advanced Server, or Datacenter) Private Const OS_DATACENTER = 21 ' Datacenter (eg NOT Server, Advanced Server, Professional, or Personal) Private Const OS_ADVSERVER = 22 ' Advanced Server (eg NOT Datacenter, Server, Professional, or Personal) Private Const OS_SERVER = 23 ' Server (eg NOT Datacenter, Advanced Server, Professional, or Personal) Private Const OS_TERMINALSERVER = 24 ' Terminal Server - server running in what used to be called "Application Server" mode (now simply called "Terminal Server") Private Const OS_PERSONALTERMINALSERVER = 25 ' Personal Terminal Server - per/pro machine running in single user TS mode Private Const OS_FASTUSERSWITCHING = 26 ' Fast User Switching Private Const OS_WELCOMELOGONUI = 27 ' New friendly logon UI Private Const OS_DOMAINMEMBER = 28 ' Is this machine a member of a domain (eg NOT a workgroup) Private Const OS_ANYSERVER = 29 ' is this machine any type of server? (eg datacenter or advanced server or server)? Private Const OS_WOW6432 = 30 ' Is this process a 32-bit process running on an 64-bit platform? Private Const OS_WEBSERVER = 31 ' Web Edition Server Private Const OS_SMALLBUSINESSSERVER = 32 ' SBS Server Private Const OS_TABLETPC = 33 ' Are we running on a TabletPC? Private Const OS_SERVERADMINUI = 34 ' Should defaults lean towards those preferred by server administrators? Private Const OS_MEDIACENTER = 35 ' eHome Freestyle Project Private Const OS_APPLIANCE = 36 ' Windows ..NET Appliance Server Private Const OS_VISTA = 37 ' [UNDOC] Windows Vista or greater Public Enum osConstants osWINDOWS = OS_WINDOWS ' 0 osNT = OS_NT ' 1 osWIN95ORGREATER = OS_WIN95ORGREATER ' 2 osNT4ORGREATER = OS_NT4ORGREATER ' 3 osWIN98ORGREATER = OS_WIN98ORGREATER ' 5 osWIN98_GOLD = OS_WIN98_GOLD ' 6 osWIN2000ORGREATER = OS_WIN2000ORGREATER ' 7 osWIN2000PRO = OS_WIN2000PRO ' 8 osWIN2000SERVER = OS_WIN2000SERVER ' 9 osWIN2000ADVSERVER = OS_WIN2000ADVSERVER ' 10 osWIN2000DATACENTER = OS_WIN2000DATACENTER ' 11 osWIN2000TERMINAL = OS_WIN2000TERMINAL ' 12 osEMBEDDED = OS_EMBEDDED ' 13 osTERMINALCLIENT = OS_TERMINALCLIENT ' 14 osTERMINALREMOTEADMIN = OS_TERMINALREMOTEADMIN ' 15 osWIN95_GOLD = OS_WIN95_GOLD ' 16 osMEORGREATER = OS_MEORGREATER ' 17 osXPORGREATER = OS_XPORGREATER ' 18 osHOME = OS_HOME ' 19 osPROFESSIONAL = OS_PROFESSIONAL ' 20 osDATACENTER = OS_DATACENTER ' 21 osADVSERVER = OS_ADVSERVER ' 22 osSERVER = OS_SERVER ' 23 osTERMINALSERVER = OS_TERMINALSERVER ' 24 osPERSONALTERMINALSERVER = OS_PERSONALTERMINALSERVER ' 25 osFASTUSERSWITCHING = OS_FASTUSERSWITCHING ' 26 osWELCOMELOGONUI = OS_WELCOMELOGONUI ' 27 osDOMAINMEMBER = OS_DOMAINMEMBER ' 28 osANYSERVER = OS_ANYSERVER ' 29 osWOW6432 = OS_WOW6432 ' 30 osWEBSERVER = OS_WEBSERVER ' 31 osSMALLBUSINESSSERVER = OS_SMALLBUSINESSSERVER ' 32 osTABLETPC = OS_TABLETPC ' 33 osSERVERADMINUI = OS_SERVERADMINUI ' 34 osMEDIACENTER = OS_MEDIACENTER ' 35 osAPPLIANCE = OS_APPLIANCE ' 36 osVISTA = OS_VISTA ' 37 End Enum Public Function TestOS(ByVal TestCase As osConstants) As Boolean On Error Resume Next ' Ordinal only until Vista! TestOS = IsOSAsOrdinal(TestCase) If Err.Number Then ' Ordinal no longer exported? TestOS = IsOS(TestCase) End If End Function -- ..NET: It's About Trust! http://vfred.mvps.org Customer Hatred Knows No Bounds at MSFT ClassicVB Users Regroup! comp.lang.basic.visual.misc Free usenet access at http://www.eternal-september.org |