|
| | |||||||
| Windows XP Discuss the Microsoft Windows XP Operating System |
| | LinkBack | Thread Tools |
| |||
| 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 ---------< |
| |||
| 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 > ---------< > |
| Bookmarks |
| Thread Tools | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Win API Calls in VBA Need Clarification | Jay | Windows XP | 1 | 12-17-2008 11:10 AM |
| 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 |
| 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? |