[AccessD] Office API's

Jim Dettman jimdettman at verizon.net
Fri Dec 10 15:42:58 CST 2010


  Yes, calling Windows API's can be fun<g>.  I've gotten lost and crashed my
machine more times then I care to count (or admit).

  BTW, Access does have Application.hWndAccessApp to get the window handle
of the main Access window and hWnd property to get the handle for a Form or
Report.

Jim. 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: Friday, December 10, 2010 04:23 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Office API's

Yeah, and it's temperamental to boot! ;)

Susan H.


> Susan,
>
> <<FindWindow -- but I can't get it to return
> anything but 0???>>
>
>  FindWindow() only returns top level windows and not child windows.  So
> this will only fetch the main Access window.
>
> This:
>
> Function apicFindWindow()
>  'Get window handle.
>  Dim hWnd As Long
>  hWnd = FindWindow("oMAIN", vbNullString)
>  Debug.Print hWnd
> End Function
>
>  Will return the handle of the first Access window it finds.
>
> Jim.
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
> Sent: Friday, December 10, 2010 02:12 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Office API's
>
>> Private Declare Function BringWindowToTop Lib "user32" (ByVal lngHWnd As
>> Long) As Long
>
> ======This one begs the function, FindWindow -- but I can't get it to 
> return
>
> anything but 0??? I can get the class Okay, but the window name/caption --

> I
>
> must be passing the wrong strings. I really don't have a clue what to pass
> and I'm just guessing. I've tried several different strings, and 
> everything
> returns 0 -- any help?
>
> Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
> (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
>
> Function apicFindWindow()
>  'Get window handle.
>  Dim hWnd As Long
>  hWnd = FindWindow("oMAIN", "Table2")
>  Debug.Print hWnd
> End Function
>
> Susan H.
>
> -- 
> 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




More information about the AccessD mailing list