A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows XP » General XP issues or comments
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Win API Calls in VBA Need Clarification



 
 
Thread Tools Display Modes
  #1  
Old December 17th 08, 12:31 AM posted to microsoft.public.windowsxp.general
jay
external usenet poster
 
Posts: 168
Default Win API Calls in VBA Need Clarification

Hi –

I’m developing an MS-Access application (with VBA) and I’d like to hide the
Access main window while showing a single, custom user form inside my
application. My web research uncovered some chatter about doing this and
I’ve tried several suggested solutions with no success.

Currently, I’m experimenting with some code posted by Graham Seach to
address the technique of hiding the container application window; it looks
like it has a lot of potential, but I’m inexperienced with Windows API and
I’m having trouble getting his code to run. Specifically, he didn’t supply
the declaration statements and I also don’t fully understand where the
function argument values come from.

Any help tuning up Graham’s following code would be appreciated.

Thanks,
Jay

-----------

'Set the Popup property of each form that you want to display, to True. Then
'call the code shown below like so:
Sub transparent()
SetAccessWindowOpacity 0
End Sub

'To display the Access window, call the code like so:
Sub notTransparent()
SetAccessWindowOpacity 255
End Sub

Public Sub SetAccessWindowOpacity(Opacity As Long)
'=====================================
'SetAccessWindowOpacity() Version 1.0.
'------------------------------------------------------------------
' Author: © Copyright 2006 Pacific Database Pty Limited
' Graham R Seach
'------------------------------------------------------------------
' Description: This function fades the Access application window's
' opacity to the specified value.
'
' Dependencies: Tested on Microsoft Access 2002/2003 only.
'
' Inputs: Opacity - Long value indicating the opacity level at which
' to set the fade (between 1 and 255).
'
' Outputs: None.
'=====================================
Dim hWndAccess As Long
Dim lOriginalStyle As Long

hWndAccess = Access.hWndAccessApp
lOriginalStyle = GetWindowLongPtr(hWndAccess, GWL_EXSTYLE)
SetWindowLongPtr hWndAccess, GWL_EXSTYLE, lOriginalStyle Or WS_EX_LAYERED

SetLayeredWindowAttributes hWndAccess, 0, CByte(Opacity), LWA_ALPHA
DoEvents
End Sub
---------

Ads
  #2  
Old December 17th 08, 07:06 PM posted to microsoft.public.windowsxp.general
jay
external usenet poster
 
Posts: 168
Default Win API Calls in VBA Need Clarification

Please disregard this post; I've reposted in the Windows API DG.

"Jay" wrote:

Hi –

I’m developing an MS-Access application (with VBA) and I’d like to hide the
Access main window while showing a single, custom user form inside my
application. My web research uncovered some chatter about doing this and
I’ve tried several suggested solutions with no success.

Currently, I’m experimenting with some code posted by Graham Seach to
address the technique of hiding the container application window; it looks
like it has a lot of potential, but I’m inexperienced with Windows API and
I’m having trouble getting his code to run. Specifically, he didn’t supply
the declaration statements and I also don’t fully understand where the
function argument values come from.

Any help tuning up Graham’s following code would be appreciated.

Thanks,
Jay

-----------

'Set the Popup property of each form that you want to display, to True. Then
'call the code shown below like so:
Sub transparent()
SetAccessWindowOpacity 0
End Sub

'To display the Access window, call the code like so:
Sub notTransparent()
SetAccessWindowOpacity 255
End Sub

Public Sub SetAccessWindowOpacity(Opacity As Long)
'=====================================
'SetAccessWindowOpacity() Version 1.0.
'------------------------------------------------------------------
' Author: © Copyright 2006 Pacific Database Pty Limited
' Graham R Seach
'------------------------------------------------------------------
' Description: This function fades the Access application window's
' opacity to the specified value.
'
' Dependencies: Tested on Microsoft Access 2002/2003 only.
'
' Inputs: Opacity - Long value indicating the opacity level at which
' to set the fade (between 1 and 255).
'
' Outputs: None.
'=====================================
Dim hWndAccess As Long
Dim lOriginalStyle As Long

hWndAccess = Access.hWndAccessApp
lOriginalStyle = GetWindowLongPtr(hWndAccess, GWL_EXSTYLE)
SetWindowLongPtr hWndAccess, GWL_EXSTYLE, lOriginalStyle Or WS_EX_LAYERED

SetLayeredWindowAttributes hWndAccess, 0, CByte(Opacity), LWA_ALPHA
DoEvents
End Sub
---------

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off






All times are GMT +1. The time now is 06:21 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.