I was wondering, in Access 97, is there a way to set a background image in the applications window. My forms are quite small so instead of the dull grey background i'd like to livin' it up a bit but cant find anything in the properties.
Maybe i was not clear enough. I do not know if this is even possible but i have many forms that are oly 4" * 4". That leaves the rest of the screen filled with the generic grey backround. I was just wondering if there was a way to fill that?
To be honest I do not know what a mdi form is.......However...i have created a large form with a picture that could allway be open in the background. The only problem with this is that i do not want it to gain th efocus as the other forms will get stuck behind it. Is there a way to have a form restricted to not getting the focus ever?
Make sure you have the square in the upper left hand corner of the form selected in DESIGN VIEW, and look under the format properties. If you don't know what I'm talking about look at this picture I've attached. It shows the SQUARE being selected, and the properties window. I even circled the toolbar button that brings up the properties window.
I have some code from VBAccelerator but it works on an MDI form that you create in a VB project, I modified it a little so it will work on Access background and now it's working. I can send the DLL if you want.
I do not mean to imply any hostile intent by Gush, but you should in general treat any DLL or EXE you are sent with caution, unless you have the source code for it, or trust the person sending it.
Brian
(Fighting with the RightToLeft bugs in VS 2005)
The file is a DLL, add it to your reference in you access project,
and then make a global instance of a Varible as shown below.
VB Code:
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hwnd As Long, ByVal hWndChild As Long, ByVal lpszClassName As Any, ByVal lpszWindow As Any) As Long
Private m_cFB As New cFormBackground
Sub InitBackground()
Dim w As Long
w = FindWindowEx(Application.hWndAccessApp, 0, "MDIClient", "")
Originally posted by BrianHawley I do not mean to imply any hostile intent by Gush, but you should in general treat any DLL or EXE you are sent with caution, unless you have the source code for it, or trust the person sending it.
You are right, but don't worry, I compiled this DLL, it's safe, but I can send you the code if you want.
You just have to ask for it.
I totally appreciate the help you are giving me on this but you'll have to excuse my ignorance.
I put the code you supplied into a module and then called it (call InitBackground) from within a form. Nothing happened.
I am not sure which reference you mean so that may be the problem? Also, this code looks like it will supply a background to a form not the access window....is that correct?
Originally posted by Leroy_Brown this code looks like it will supply a background to a form not the access window....is that correct?
No that's not correct, here is the same code with some comments
VB Code:
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hwnd As Long, ByVal hWndChild As Long, ByVal lpszClassName As Any, ByVal lpszWindow As Any) As Long
Private m_cFB As New cFormBackground
Sub InitBackground()
Dim w As Long
' Get a handle to the MDIClient window in the Access Window
w = FindWindowEx(Application.hWndAccessApp, 0, "MDIClient", "")
With m_cFB
.Init w
' Attach the picture you specify to the window handle
' and Tile it.
.Tile.FileName = App.Path & "\marb_gif.gif"
End With
End Sub
In the Visual Basic Editor, goto the Tools/References... Menu, and Select the DLL you Downloaded.
Okay...I now have a reference to the dll and have the code you posted in a module. On my splash form i entered "Call InitBackground" but get an invalid outside procedure error.
Option Compare Database
Option Explicit
Type RECT
Left As Long
TOp As Long
Right As Long
Bottom As Long
End Type
Public Const RDW_INVALIDATE = &H1
Public Const RDW_UPDATENOW = &H100
Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, rc As RECT) As Long
Declare Function RedrawWindow Lib "user32" (ByVal hWnd As Long, lprcUpdate As Any, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd As Long, ByVal hWndChild As Long, ByVal lpszClassName As Any, ByVal lpszWindow As Any) As Long
Private m_cFB As New cFormBackground
Sub InitBackground()
Dim w As Long
w = FindWindowEx(Application.hWndAccessApp, 0, "MDIClient", "")
With m_cFB
.Init w
.Tile.filename = "H:\marb_gif.gif"
End With
Dim rc As RECT
GetClientRect w, rc
Quite honestly I don't see why you don't have the property available? What version of Access are you using? I posted something above to show you where the property is if you're having trouble locating it. The only thing I see is frivolity in going to the extensiveness of API just for a simple background image that is specified VIA properties.
Thank you again Gush for all your help trying to get this working. I never dreamt it would be this difficult for a simple background. Unfortuantly, i must move on.
Right on !!!!!!!!!!!! It wasn't all for not!!!!! Thank you sooo much for your time on this. It always amazes me when people on this forum go so out of there way.