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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|