UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Access Application Background Color Via Lebans Mod    
 
   
tracygj
post Jul 13 2011, 02:02 PM
Post#1



Posts: 78
Joined: 12-July 11



Hi
I have an app under Access 2000, Im updating to Access 2010.
Im setting the background access app color via Lebans "changeMDIBackground" db work.
But under access 2010 it doesnt work.
THis original files havent been updated since about 2009 so Im guessing thats why.
Does anybody have an update that works in access 2010 ?
The original work is at www.lebans.com
Thanks in advance.
This is my first post - so if it sounds a bit scatter brained I apologise.
Go to the top of the page
 
jleach
post Jul 13 2011, 03:47 PM
Post#2


UtterAccess Administrator
Posts: 10,466
Joined: 7-December 09
From: St. Augustine, FL


Hi, welcome to UA
haven't heard of any fix for it, and I don't know offhand what the problem might be, but if I had to take a guess I'd first look to make sure the class name of the target window (or it's child) hasn't changed, and then I'd check the documentation on the brush structures in MSDN to see if there's been changes to those.
Are you attempting to apply a solid color, or a bitmap? Solid color would be easier to troubleshoot, I think.
In essence, the module works like this:
1) Find the class that is the window to be change
2) Send a message to the system telling to to change that color.
(pretty straightfoward work for him, really)
Odon't claim to know the answer, nor to have the time to figure it out myself, but if you have the gumption to take some suggestions and work with the API I can provide what I would do for a walkthrough if I had to, but it will certainly be a project, espcially if you're not familiar with API programming. As for myself, I think it'd be a fairly interesting challenge to attempt to tackle, so let me know if you'd like to proceed.
Cheers,
Go to the top of the page
 
jleach
post Jul 13 2011, 08:09 PM
Post#3


UtterAccess Administrator
Posts: 10,466
Joined: 7-December 09
From: St. Augustine, FL


A few things to start off with, as I don't have 2010 in an ideal work/test environment:
) verify Lebans code can be compiled without error
2) let me know if you get an error when the code runs. If you do, don't go any further and post the function name and line, and error number and description that you're receiving.
3) if you don't get any errors, take a look at the RestoreMDIBackgroundImage function in the modChangeMDI module, and add the following lines as noted below:
CODE
Public Function RestoreMDIBackGroundImage(Optional crColor As Long = -1) As Boolean
' junk var
Dim lngRet As Long
Dim hBrushImage As Long
Dim hBrushImagePrev As Long
' Window Rect
Dim rc As RECT
' An instance of our DIBSection calss
If crColor <> -1 Then
    hBrushImage = CreateSolidBrush(crColor)
Else
    ' Create a brush from the Bitmap we loaded
    hBrushImage = CreateSolidBrush(GetSysColor(COLOR_APPWORKSPACE))
End If
Debug.Print "hBrushImage: " & hBrushImage '<<************************ ADD THIS
' find MDIClient first
hWndMDI = FindWindowEx(Application.hWndAccessApp, 0&, "MDIClient", TITLE)
' Get current dimensions
lngRet = GetWindowRect(hWndMDI, rc)
Debug.Print "hWndMDI: " & hWndMDI  ' <<************* ADD THIS
Debug.Print "lngRet: " & lngRet  ' <<************* ADD THIS
With rc
.Bottom = .Bottom - .top
.top = 0
.right = .right - .Left
.Left = 0
End With
hBrushImagePrev = SetClassLong(hWndMDI, GCL_HBRBACKGROUND, hBrushImage)
Debug.Print "hBrushImagePrev: " & hBrushImagePrev '<<*********************** ADD THIS
' Force a redraw
Call InvalidateRect(hWndMDI, rc, API_TRUE)
RestoreMDIBackGroundImage = True
' Cleanup
' Delete old brush
lngRet = DeleteObject(hBrushImagePrev)
End Function

Copy the values from the immediate window after you run the function and post them back here and we'll try to see where to go from there.
edit: I'll also need the OS and architecture (32 or 64 bit) you're running please
Go to the top of the page
 
tracygj
post Jul 13 2011, 10:04 PM
Post#4



Posts: 78
Joined: 12-July 11



Hi
Thanks for your help.
Compiles OK with no errors.
Results of the immediate window below:
BrushImage: 923798740
hWndMDI: 5637156
lngRet: 1
hBrushImagePrev: 13
App is running on Windows XP SP3 / Access 2010 SP1
And also another PC at home is Windows 7 Ultimate / Access 2010 SP1
Getting the same result on each PC.
Cheers tracygj
Go to the top of the page
 
jleach
post Jul 14 2011, 11:36 AM
Post#5


UtterAccess Administrator
Posts: 10,466
Joined: 7-December 09
From: St. Augustine, FL


I'll have to digest this for a bit but probably won't get to it until later tonight or earlier tomorrow morning. I'll report back with at least one API declaration change and a few more tests.
Go to the top of the page
 
jleach
post Jul 15 2011, 08:47 PM
Post#6


UtterAccess Administrator
Posts: 10,466
Joined: 7-December 09
From: St. Augustine, FL


I'm going to have to do some pretty extensive testing in 2010 to try and determine which window we need to be referencing to make this work. I suspect that the window structure in 2010 is different from '97 (Stephen's most recent version of this code was written for '97). This will take me a little while, and I'm not sure I'll be able to accurately define the problem, so don't get your hopes too far up.
One last thing from your end for now: are both OS's 32 bit? Or is your Win7 a 64 bit machine... this may be key. Also, please confirm you are using the 32 bit version of Access 2010.
Thanks,
Go to the top of the page
 
tracygj
post Jul 18 2011, 03:42 PM
Post#7



Posts: 78
Joined: 12-July 11



Hi Jack
Thanks for your reply.
Using 32bit Access 2010 on a 32bit machine
And home machine is Win 7 (64 bit version) also using 32bit Access 2010
Hope this helps
Cheers tracygj
Go to the top of the page
 
jleach
post Jul 19 2011, 06:19 PM
Post#8


UtterAccess Administrator
Posts: 10,466
Joined: 7-December 09
From: St. Augustine, FL


Unfortunately I can't seem to make any headway on this. I was hoping that it would be a relatively minor problem of the window name changing, which would have been easy enough to reconfigure, but this doesn't seem to be the case (I tried setting any color background to every object in the access app to no avail). The problem seems to be with the actual application of the brush/color to the window flag. Either something's getting lost in the translation with the newer versions, or, more likely I think, there's security measures built into the newer versions that doesn't allow us to write the required value (there's a number of other characteristics of the window/object that can be changed here as well, so it could be a security risk, depending...)
010 isn't the only version effected: 2007 has the same problem as well, from the posts I've read while searching for clues. As far as I can tell, accomplishing the task in 2007 or later doesn't seem to be possible (as big as part as this can play in the appearance of an app, you'd think we'd be able to select it right from options, if not easily program it from VBA).
You may want to consider a different route, perhaps an actual background form resized to the window and set to a color/image with no window border. I haven't done a ton of design/layout work with 2010 but I believe this should be possible, if a trifle difficult to obtain seamless behavior.
Sorry I couldn't help more. I posted another thread inquiring if anyone else had clues based on what I'd found in the testing and it's been a few days without answer now, so I think we're SOL.
Go to the top of the page
 
tracygj
post Jul 21 2011, 07:00 PM
Post#9



Posts: 78
Joined: 12-July 11



Hi Jack
Thanks very much for your effort, seems strange that MS would change it from 2007 on.
I actually have all my forms positioned within the app window without any close button etc, so it looks like a seamless window.
The point of trying to change the Access window was to get a completely seamless look with a white background.
But alas - its not to be.
Thank you again for your efforts.
Cheers tracygj
Go to the top of the page
 
bsacheri
post Nov 7 2019, 11:30 AM
Post#10



Posts: 20
Joined: 3-February 05
From: Pittsburgh, PA


It's been a while since this question was posted.

Has anyone found a way to change the background color or set an image of the Access Application (not a form) in Access 2007+ ??

Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    5th April 2020 - 11:40 AM