Results 1 to 37 of 37

Thread: aesthetic question

  1. #1
    Leroy_Brown
    Guest

    aesthetic question

    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.

  2. #2
    Frenzied Member Mega_Man's Avatar
    Join Date
    Mar 2001
    Location
    North of England, South-East of Iceland
    Posts
    1,067
    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.
    "If at first you don't succeed, then skydiving is not for you"

  3. #3
    Leroy_Brown
    Guest

    not the form

    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?

  4. #4
    Frenzied Member markman's Avatar
    Join Date
    Nov 2000
    Location
    Florida.
    Posts
    1,197
    do you mean the mdi form?
    retired member. Thanks for everything

  5. #5
    Leroy_Brown
    Guest

    ???

    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?

  6. #6
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    The Dark Side of the Moon
    Posts
    448
    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.
    Attached Images Attached Images  

  7. #7
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    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.

  8. #8
    Fanatic Member BrianHawley's Avatar
    Join Date
    Aug 2001
    Location
    Saudi Arabia
    Posts
    796
    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)

  9. #9
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Hey Gush, zip it an upload it !!

    we all want it
    -= a peet post =-

  10. #10
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    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:
    1. 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
    2.  
    3. Private m_cFB As New cFormBackground
    4. Sub InitBackground()
    5.     Dim w As Long
    6.     w = FindWindowEx(Application.hWndAccessApp, 0, "MDIClient", "")
    7.     With m_cFB
    8.         .Init w
    9.         .Tile.FileName = App.Path & "\marb_gif.gif"
    10.     End With
    11. End Sub

  11. #11
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    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.

  12. #12
    Leroy_Brown
    Guest
    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?

  13. #13
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    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:
    1. 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
    2.  
    3. Private m_cFB As New cFormBackground
    4. Sub InitBackground()
    5.     Dim w As Long
    6.     ' Get a handle to the MDIClient window in the Access Window
    7.     w = FindWindowEx(Application.hWndAccessApp, 0, "MDIClient", "")
    8.     With m_cFB
    9.         .Init w
    10.         ' Attach the picture you specify to the window handle
    11.         ' and Tile it.
    12.         .Tile.FileName = App.Path & "\marb_gif.gif"
    13.     End With
    14. End Sub

    In the Visual Basic Editor, goto the Tools/References... Menu, and Select the DLL you Downloaded.

  14. #14
    Leroy_Brown
    Guest
    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

  15. #15
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    Oops, have I not attached a zip file with the Code I posted?

    Sorry about that

    Here is the file.

  16. #16
    Addicted Member
    Join Date
    Sep 2001
    Location
    UK
    Posts
    136
    k

  17. #17
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    Is the file attached to this message?
    Attached Files Attached Files

  18. #18
    Leroy_Brown
    Guest
    Here is the file.
    No attatchmnet

  19. #19
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    Sorry about that, I thought I've attached it to the first chunk of code I posted.

  20. #20
    Leroy_Brown
    Guest

    How to call?

    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?

  21. #21
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    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:
    1. Type RECT
    2.     Left As Long
    3.     TOp As Long
    4.     Right As Long
    5.     Bottom As Long
    6. End Type
    7.  
    8. Public Const RDW_INVALIDATE = &H1
    9. Public Const RDW_UPDATENOW = &H100
    10.  
    11. Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, rc As RECT) As Long
    12. 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:
    1. Public Function InitBackground()
    2.  
    3. ' Previous Code Here
    4.  
    5.  
    6.     Dim rc As RECT
    7.     GetClientRect w, rc
    8.    
    9.     RedrawWindow w, rc, 0, RDW_UPDATENOW Or RDW_INVALIDATE
    10. End Function


    You have to call it from the Form_Load of the splash

    VB Code:
    1. Private Sub Form_Load()
    2.     Call InitBackground
    3. End Sub

    Let me know right away if it works (I have to leave as soon as it does)

  22. #22
    Leroy_Brown
    Guest
    RedrawWindow w, rc, 0, RDW_UPDATENOW Or RDW_INVALIDATE

    Wrong # of argumrents........which do i drop?

  23. #23
    Leroy_Brown
    Guest
    or invalid properties

  24. #24
    Leroy_Brown
    Guest
    RC is declared as type RECT but a long is expected??? Don't know which way to shuffle though.

  25. #25
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    This code should be correct, I've used it a million times


    look at this screen shot
    Attached Images Attached Images  

  26. #26
    Leroy_Brown
    Guest

    Unhappy

    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.

  27. #27
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    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.
    First, Don't worry about it

    Second, Can you please post the whole code in the module.

  28. #28
    Leroy_Brown
    Guest
    Error: ActiveX Component cant create object

    pointing to the use of " With m_cFB"

    Is that a library problem??

  29. #29
    Leroy_Brown
    Guest

    module code

    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

  30. #30
    Leroy_Brown
    Guest

    reference a library

    cFormBackground

    Does not seem to be recognized...is there a particular library i must reference to use it????

  31. #31
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    I think you need the attached file too

    it's a DLL also, put it in the same path as the previous one.
    Attached Files Attached Files

  32. #32
    Leroy_Brown
    Guest
    Nope.....still getting the activeX error..................

    You don't know where the object comes from hey?

  33. #33
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    The Dark Side of the Moon
    Posts
    448
    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.

  34. #34
    Leroy_Brown
    Guest

    Not in 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.

  35. #35
    Leroy_Brown
    Guest

    ABORT MISSION

    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

  36. #36
    Hyperactive Member
    Join Date
    May 2001
    Location
    Beirut, Lebanon
    Posts
    318
    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

  37. #37
    Leroy_Brown
    Guest

    Thumbs up It Works

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width