Technology Questions

Go Back   Technology Questions > Software Questions > Operating System Questions > Windows XP

Windows XP Discuss the Microsoft Windows XP Operating System

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 12-16-2008, 04:30 PM
Jay
Newsgroup Contributor
 
Posts: n/a
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 gseach@NOSPAMaccessmvp.com
'------------------------------------------------------------------
' 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
---------<

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 12-16-2008, 04:30 PM
  #2 (permalink)  
Old 12-17-2008, 11:10 AM
Jay
Newsgroup Contributor
 
Posts: n/a
RE: 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 gseach@NOSPAMaccessmvp.com
> '------------------------------------------------------------------
> ' 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
> ---------<
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clarification of licenses Guyana MIke B Microsoft Office 1 12-05-2008 10:00 PM
difference clarification please mike_XP_Vista Windows Vista 1 04-28-2008 09:40 AM
Clarification rlmarr Windows XP 3 01-22-2007 05:00 PM
vista coupons clarification yvettesam Windows Vista 7 01-02-2007 07:06 AM
Version clarification LPH Windows XP Tablet PC Newsgroup 3 09-23-2004 04:41 PM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 10:54 PM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0