Drew Wutka
DWUTKA at Marlow.com
Tue Dec 14 09:47:20 CST 2010
Here's two odd balls that are handy when you need to know the
environment you're in:
Get OS type:
Private Declare Function GetVersionEx Lib "kernel32" Alias
"GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Private Declare Function GetVersionEx2 Lib "kernel32" Alias
"GetVersionExA" (lpVersionInformation As OSVERSIONINFOEX) As Long
Private Type OSVERSIONINFO
intOSVersionInfoSize As Long
intMajorVersion As Long
intMinorVersion As Long
intBuildNumber As Long
intPlatformId As Long
strCSDVersion As String * 128
End Type
Private Type OSVERSIONINFOEX
intOSVersionInfoSize As Long
intMajorVersion As Long
intMinorVersion As Long
intBuildNumber As Long
intPlatformId As Long
strCSDVersion As String * 128
intServicePackMajor As Integer
intServicePackMinor As Integer
intSuiteMask As Integer
bytProductType As Byte
bytReserved As Byte
End Type
Check if it's a laptop:
Private Declare Function GetCurrentHwProfile Lib "advapi32.dll" Alias
"GetCurrentHwProfileW" (ByRef lpHwProfileInfo As HW_PROFILE_INFO) As
Long
Private Const DOCKINFO_DOCKED = (&H2)
Private Const DOCKINFO_UNDOCKED = (&H1)
Private Const HW_PROFILE_GUIDLEN = 39
Private Const MAX_PROFILE_LEN = 80
Private Type HW_PROFILE_INFO
intDockInfo As Long
strProfileGUID As String * HW_PROFILE_GUIDLEN
strProfileName As String * MAX_PROFILE_LEN
End Type
dim blLaptop As Boolean
Private Function CheckIfLaptop()
On Error GoTo ErrorHandler
Dim blTemp1 As Boolean
Dim blTemp2 As Boolean
Dim dwReturn As Long
Dim hwProfile As HW_PROFILE_INFO
blLaptop = False
dwReturn = GetCurrentHwProfile(hwProfile)
If dwReturn <> 0 Then
blTemp1 = hwProfile.intDockInfo And 1
blTemp2 = hwProfile.intDockInfo And 2
If blTemp1 <> blTemp2 Then blLaptop = True
End If
Exit Function
ErrorHandler:
Err.Clear
End Function
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: Friday, December 10, 2010 11:06 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Office API's
Stuart, these are great -- anyone else????
Susan H.
> On 9 Dec 2010 at 20:10, Susan Harkins wrote:
>
>> Windows API functions.
>> Susan H.
>>
>> > Susan - did you mean to say "add-ins" ?
>> > I'm not sure what you are referring to....
>> >>
>> >> I'm writing about Office APIs -- if you have a favorite one
>> >> you'd like to see showcased, let me know.
>>
>
>
> Ah Windows APIs. I use quite a few of them. Here's a few API
calls
> and functions that I
> use in most systems that I build (I keep them along with a number of
other
> functions in a
> module of general functions that I just plug in to new apps by
default,
> Listing from the
> simplest to the most complex:
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
The information contained in this transmission is intended only for the person or entity
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business
Sensitive material. If you are not the intended recipient, please contact the sender
immediately and destroy the material in its entirety, whether electronic or hard copy.
You are notified that any review, retransmission, copying, disclosure, dissemination,
or other use of, or taking of any action in reliance upon this information by persons
or entities other than the intended recipient is prohibited.