Doug Steele
dbdoug at gmail.com
Mon Dec 13 13:56:58 CST 2010
I just tried the code using Access 2003 on Windows 7 and it seems to work OK. Doug On Mon, Dec 13, 2010 at 11:04 AM, Heenan, Lambert < Lambert.Heenan at chartisinsurance.com> wrote: > Still in the dark ages of Win XP here. No W7 machines. > > By the way, if the user gets the password wrong it will not lock the user > ID after N tries and force a password reset the way windows XP's default > policy does. > > Lambert > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com [mailto: > accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters > Sent: Monday, December 13, 2010 1:08 PM > To: 'Access Developers discussion and problem solving' > Subject: Re: [AccessD] Office API's > > Have you tried with Vista or W7? > > Dan > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert > Sent: Monday, December 13, 2010 12:06 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Office API's > > I've not tested it on Win98 which was 32 bit ( IIRC), so it might work > there, but I doubt in Win3x is up to it. > > Lambert > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters > Sent: Monday, December 13, 2010 12:39 PM > To: 'Access Developers discussion and problem solving' > Subject: Re: [AccessD] Office API's > > Hi Lambert, > > Your comments say, " IMPORTANT: works only under Windows NT and 2000 and > XP." Does this mean that it won't work on previous versions of Windows? Or > that it won't work on later versions of Windows? Or has this been tested on > later versions? > > Thanks! > Dan > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert > Sent: Monday, December 13, 2010 11:34 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Office API's > > One API that took me so long to find was one that would provide Windows > Authentication. In other words require the user to enter the name and > password that was used to start the current Windows session: to prove that > they are who fOsUsername says they are. > > Private Declare Function LogonUser Lib "Advapi32" Alias "LogonUserA" (ByVal > _ > lpszUserName As String, ByVal lpszDomain As String, _ > ByVal lpszPassword As String, ByVal dwLogonType As Long, _ > ByVal dwLogonProvider As Long, phToken As Long) As Long > > Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) > As _ > Long > Const LOGON32_PROVIDER_DEFAULT = 0& > Const LOGON32_LOGON_NETWORK = 3& > > ' Check whether a username/password pair is correct ' > ' if DOMAIN is omitted, it uses the local account database ' and then asks > trusted domains to search their account databases ' until it finds the > account or the search is exhausted ' use DOMAIN="." to search only the local > account database ' > ' IMPORTANT: works only under Windows NT and 2000 and XP > > Private Function CheckWindowsUser(ByVal UserName As String, _ > ByVal Password As String, Optional ByVal Domain As String) As Boolean > Dim hToken As Long, ret As Long > > ' The handle hToken is not used by CheckWindowsUser ' but is required by > the API LogonUser > > ' provide a default for the Domain name > If Len(Domain) = 0 Then Domain = vbNullString > ' check the username/password pair > ' using LOGON32_LOGON_NETWORK delivers the best performance > ret = LogonUser(UserName, Domain, Password, LOGON32_LOGON_NETWORK, _ > LOGON32_PROVIDER_DEFAULT, hToken) > > ' a non-zero value means success > If ret Then > CheckWindowsUser = True > CloseHandle hToken > End If > > End Function > > Lambert > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart > McLachlan > Sent: Friday, December 10, 2010 5:43 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Office API's > > On 10 Dec 2010 at 16:22, Susan Harkins wrote: > > > Yeah, and it's temperamental to boot! ;) > > > > Susan H. > > > It works exactly the way it is intended. - just not the way you think it > should :-) > > >From Win32.hlp: > > The FindWindow function retrieves the handle to the top-level window whose > class name and window name match the specified strings. This function does > not search child windows. > > HWND FindWindow( > LPCTSTR lpClassName, // pointer to class name > LPCTSTR lpWindowName // pointer to window name > ); > > Parameters > lpClassName > Points to a null-terminated string that specifies the class name or is an > atom that identifies the class-name string. If this parameter is an atom, it > must be a global atom created by a previous call to the GlobalAddAtom > function. The atom, a 16-bit value, must be placed in the low-order word of > lpClassName; the high-order word must be zero. > > lpWindowName > Points to a null-terminated string that specifies the window name (the > window's title). If this parameter is NULL, all window names match. > > Return Values If the function succeeds, the return value is the handle to > the window that has the specified class name and window name. If the > function fails, the return value is NULL. To get extended error information, > call GetLastError. > > -- > Stuart > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >