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.
Printable View
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.
Every form has a property called "Picture". All you have to do is provide it with a .BMP filename and that becomes your background.
Mega.
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?
do you mean the mdi form?
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.
Hey Gush, zip it an upload it !!
we all want it :)
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", "") With m_cFB .Init w .Tile.FileName = App.Path & "\marb_gif.gif" End With End Sub
You are right, but don't worry, I compiled this DLL, it's safe, but I can send you the code if you want.Quote:
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 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?
No that's not correct, here is the same code with some commentsQuote:
Originally posted by Leroy_Brown
this code looks like it will supply a background to a form not the access window....is that correct?
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.
Do i have to download this DLL you refer to from somewhere else?????? Is me putting that code in a module correct and am i calling it right?
I have zero experience using these so i do appreciate your patience.
LB
Oops, have I not attached a zip file with the Code I posted?
Sorry about that
Here is the file.
k
Is the file attached to this message?
No attatchmnet :(Quote:
Here is the file.
Sorry about that, I thought I've attached it to the first chunk of code I posted.
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.
Is this where I am even supposed to call it?
The background may not be automatically visible since the Access background shou be invalidated,
so I think it's better if you add this code to the Decleration section of your module
VB Code:
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
... And this code to the end of the Initbackground function
VB Code:
Public Function InitBackground() ' Previous Code Here Dim rc As RECT GetClientRect w, rc RedrawWindow w, rc, 0, RDW_UPDATENOW Or RDW_INVALIDATE End Function
You have to call it from the Form_Load of the splash
VB Code:
Private Sub Form_Load() Call InitBackground End Sub
Let me know right away if it works (I have to leave as soon as it does)
RedrawWindow w, rc, 0, RDW_UPDATENOW Or RDW_INVALIDATE
Wrong # of argumrents........which do i drop?
or invalid properties
RC is declared as type RECT but a long is expected??? Don't know which way to shuffle though.
This code should be correct, I've used it a million times
look at this screen shot
I don't know why but it definatly does not like the parameters bieng passed. Have you tried this in Acc 97?
Regardless.....I really appreciate all the time and effort you have put in trying to assist me.
First, Don't worry about it :DQuote:
Originally posted by Leroy_Brown
I don't know why but it definatly does not like the parameters bieng passed. Have you tried this in Acc 97?
Regardless.....I really appreciate all the time and effort you have put in trying to assist me.
Second, Can you please post the whole code in the module.
Error: ActiveX Component cant create object
pointing to the use of " With m_cFB"
Is that a library problem??
This is what i've got......
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
RedrawWindow w, rc, 0, RDW_UPDATENOW 'Or RDW_INVALIDATE
End Sub
cFormBackground
Does not seem to be recognized...is there a particular library i must reference to use it????
I think you need the attached file too
it's a DLL also, put it in the same path as the previous one.
Nope.....still getting the activeX error..................:(
You don't know where the object comes from hey?
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.
Access 97. We are not discussing setting the background of a form but of the Access window. This cannot be done via the 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.
Cheers
hey, try this one more thing.
on the command prompt, make sure you are on the same path where the Dll's are, and Type:
regsvr32.exe ssubtmr.dll
and
regsvr32.exe cbmbtile.dll
this will make it work for sure.
Try it and let me know
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.
Cheers again