|
|
I have an Access 2003 .mdb file that gets the disk serial number (not volumne number) of the disk it is running on using CreateFile and other routines. I do this to stop people from copying my program to other computers. It seems to have problems when running on Vista. I was thinking I might need to use the WMI interface to get the disk serial number but I am not sure how to do it. There are examples of using WMI using .net and VB scripting, but I can figure out how to use WMI using VBA. Can anyone get me started? Maybe it would be easier, in Vista, to get the ethernet MAC address instead? Any help would be appreciated.
John P.S. Is there a way to write a VB.Net program or DLL to return the info to VBA? I would pefer to keep all my code in the .mdb file if possible.
|
|
John <me[ at ]nospam.com> wrote:
[Quoted Text] >I have an Access 2003 .mdb file that gets the disk serial number (not >volumne number) of the disk it is running on using CreateFile and other >routines. I do this to stop people from copying my program to other >computers. It seems to have problems when running on Vista.
What kind of problems? Are you using the API calls as from vbnet.mvps.org?
Tony -- Tony Toews, Microsoft Access MVP Please respond only in the newsgroups so that others can read the entire thread of messages. Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
|
|
In article <ggaie4lain9g8ncip0hbegj3r8md90u92d[ at ]4ax.com>, ttoews[ at ]telusplanet.net says...
[Quoted Text] > John <me[ at ]nospam.com> wrote: > > >I have an Access 2003 .mdb file that gets the disk serial number (not > >volumne number) of the disk it is running on using CreateFile and other > >routines. I do this to stop people from copying my program to other > >computers. It seems to have problems when running on Vista. > > What kind of problems? Are you using the API calls as from > vbnet.mvps.org? > > Tony >
Tony,
Thanks for replying to my question. The code at vbnet.mvps.org does not work on Vista. I have tried it.
John
|
|
John <me[ at ]nospam.com> wrote:
[Quoted Text] >Thanks for replying to my question. The code at vbnet.mvps.org does not >work on Vista. I have tried it.
Now that's interesting. What kind of error message are you getting? If any? What URL or code are you using?
I once had a problem referencing a registry key but I was using very old sample code which opened it for update. Now I only needed to read the registry not update it. That then started causing my code problems in a few years when corps started moving to Win 2000 from Win 98 and the users were running as users and not admins.
So I'm wondering if there is something weird like that going on here.
Tony -- Tony Toews, Microsoft Access MVP Please respond only in the newsgroups so that others can read the entire thread of messages. Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
|
|
In article <elple4hcte0ojpo4i9iplehc9bc3c3j8es[ at ]4ax.com>, ttoews[ at ]telusplanet.net says...
[Quoted Text] > John <me[ at ]nospam.com> wrote: > > >Thanks for replying to my question. The code at vbnet.mvps.org does not > >work on Vista. I have tried it. > > Now that's interesting. What kind of error message are you getting? > If any? What URL or code are you using? > > I once had a problem referencing a registry key but I was using very > old sample code which opened it for update. Now I only needed to > read the registry not update it. That then started causing my code > problems in a few years when corps started moving to Win 2000 from Win > 98 and the users were running as users and not admins. > > So I'm wondering if there is something weird like that going on here. > > Tony >
Tony,
The error I am getting is that the display is returning that all the drives are "[Not present]". The routine fails when it tries to execute the CreateFile api, in the function "SmartOpen", i.e. the CreateFile routines returns an invalid handle.
John
|
|
On Tue, 7 Oct 2008 19:53:25 -0700, John <me[ at ]nospam.com> wrote:
That code has a comment that says: "Later IDE drives support the SMART IDE specification". Can you verify you have an IDE drive? Many newer machines don't. I would never rely on IDE to be present.
Also note that the Prerequisites section of that page does NOT indicate happyness on Vista.
Did you try contacting the original author to see if he was interested in pursuing this?
-Tom. Microsoft Access MVP
[Quoted Text] >In article <elple4hcte0ojpo4i9iplehc9bc3c3j8es[ at ]4ax.com>, >ttoews[ at ]telusplanet.net says... >> John <me[ at ]nospam.com> wrote: >> >> >Thanks for replying to my question. The code at vbnet.mvps.org does not >> >work on Vista. I have tried it. >> >> Now that's interesting. What kind of error message are you getting? >> If any? What URL or code are you using? >> >> I once had a problem referencing a registry key but I was using very >> old sample code which opened it for update. Now I only needed to >> read the registry not update it. That then started causing my code >> problems in a few years when corps started moving to Win 2000 from Win >> 98 and the users were running as users and not admins. >> >> So I'm wondering if there is something weird like that going on here. >> >> Tony >> >Tony, > >The error I am getting is that the display is returning that all the >drives are "[Not present]". The routine fails when it tries to execute >the CreateFile api, in the function "SmartOpen", i.e. the CreateFile >routines returns an invalid handle. > > John
|
|
Tom,
The program works fine on Windows XP. I have SATA drives on both my XP and Vista systems. I did notice that the prerequisites did not say that it worked on Vista, but I tried it because Tony suggested it. I have not tried contacting the original author yet. I thought I would ask this group first. Thanks for your input.
John
In article <o6boe4lqqe6158ci1et9ecucul586mspnq[ at ]4ax.com>, tom7744.no.spam[ at ]cox.net says...
[Quoted Text] > On Tue, 7 Oct 2008 19:53:25 -0700, John <me[ at ]nospam.com> wrote: > > That code has a comment that says: "Later IDE drives support the SMART > IDE specification". > Can you verify you have an IDE drive? Many newer machines don't. I > would never rely on IDE to be present. > > Also note that the Prerequisites section of that page does NOT > indicate happyness on Vista. > > Did you try contacting the original author to see if he was interested > in pursuing this? > > -Tom. > Microsoft Access MVP > > > > >In article <elple4hcte0ojpo4i9iplehc9bc3c3j8es[ at ]4ax.com>, > >ttoews[ at ]telusplanet.net says... > >> John <me[ at ]nospam.com> wrote: > >> > >> >Thanks for replying to my question. The code at vbnet.mvps.org does not > >> >work on Vista. I have tried it. > >> > >> Now that's interesting. What kind of error message are you getting? > >> If any? What URL or code are you using? > >> > >> I once had a problem referencing a registry key but I was using very > >> old sample code which opened it for update. Now I only needed to > >> read the registry not update it. That then started causing my code > >> problems in a few years when corps started moving to Win 2000 from Win > >> 98 and the users were running as users and not admins. > >> > >> So I'm wondering if there is something weird like that going on here. > >> > >> Tony > >> > >Tony, > > > >The error I am getting is that the display is returning that all the > >drives are "[Not present]". The routine fails when it tries to execute > >the CreateFile api, in the function "SmartOpen", i.e. the CreateFile > >routines returns an invalid handle. > > > > John >
|
|
John <me[ at ]nospam.com> wrote:
[Quoted Text] >The error I am getting is that the display is returning that all the >drives are "[Not present]". The routine fails when it tries to execute >the CreateFile api, in the function "SmartOpen", i.e. the CreateFile >routines returns an invalid handle.
So you're using the code at http://vbnet.mvps.org/index.html?code/disk/smartide.htm ?
Try running that code as administrator although exactly how you ensure you are administrator on Windows Vista I don't know.
Also try removing GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE from the CreateFile line just in case that makes a difference. But this is a WAG (wild *ssed guess).
Tony -- Tony Toews, Microsoft Access MVP Please respond only in the newsgroups so that others can read the entire thread of messages. Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
|
|
Try the following. It works well under Vista and also with Access 2007
Function GetDrive() As String Dim fs As Object '----Scripting Entries---- Dim fso As New Scripting.filesystemobject Dim drv As Scripting.Drive 'cycle through drives For Each drv In fso.Drives 'make sure drive is ready If drv.IsReady Then 'check drive name If drv.DriveLetter = "C" Then GetDrive = drv.SerialNumber End If End If 'loop back to next drive Next drv End Function
"John" wrote:
[Quoted Text] > I have an Access 2003 .mdb file that gets the disk serial number (not > volumne number) of the disk it is running on using CreateFile and other > routines. I do this to stop people from copying my program to other > computers. It seems to have problems when running on Vista. I was > thinking I might need to use the WMI interface to get the disk serial > number but I am not sure how to do it. There are examples of using WMI > using .net and VB scripting, but I can figure out how to use WMI using > VBA. Can anyone get me started? Maybe it would be easier, in Vista, to > get the ethernet MAC address instead? Any help would be appreciated. > > John > P.S. > Is there a way to write a VB.Net program or DLL to return the info to > VBA? I would pefer to keep all my code in the .mdb file if possible. >
|
|
|