Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Centering the Main Access Window

Status
Not open for further replies.

huskerdon

Programmer
Aug 26, 2002
67
US
Hi everybody,

I'm developing an Access DB, and it will be used by monitors with both 1024 x 768 and 1208 x 1024 resolutions. I don't want to resize any of the forms or objects, so I just would like to know if it's possible to resize and center the Main Access window (classname = "OMain"). This is the main container, and the caption is the default "Microsoft Access" or the Application Title if it's been set. I've experimented with getting the handle to the main window, and also the form that is being displayed, but no success with setting sizes, etc.

I know the size of the forms that I'm using, and have set the border style to "Thin" so they can't be resized. Is it possible to minimize the main window, or set the size in code, so all I see is the actual form that's being used at any given time?

If anyone's had experience with doing this, I'd sure appreciate some suggestions. Thanks a lot,

huskerdon

 
under the form properties, I think you can select "auto center". to center it. and you auto resize to rezie the form window.

I hope this helps.
 
Hello huskerdon:

Sounds like you want to hide the Access Shell all together, and have your form fill the entire screen, with no resize capability? If this is the path you want to go down then I can help. This requires the creation of a new module, a few macro's and setting the forms to "Popup", as well as creating internal navigation controls.


If this is correct post back and I will provide the solution I implememnted.



Cheers,
 
mikelev,

Thanks for your response. That is what I want to do, I think??. I did a lot of experimenting last night, and now I have really messed up Access. I made a quick new DB with a popup form, and on the form open event, added DoCmd.RunCommand acCmdAppMinimize

That worked, and the Access App window minimized, and the form was displayed by itself. But now when I open any DB, new or old, and go to a form in design view, I can't get the Property Window to appear!!! The icon in the toolbar switches from depressed to not, and clicking it causes the form to lose focus, etc. - but no Properties box will show!

(I also found some code using a function called fSetAccessWindow, and I think that had something to do with the problem also.)

I'll wait until I see your response, but I'll probably have to reload Access to get this problem fixed.

Thanks a lot!
 
huskerdon - You first asked if you could resize and center the Access Application window. Yes you can. The handle to that Access Application window is already exposed under the variable name hWndAccessApp. To center and/or resize it, I would suggest using that handle to either the MoveWindow, or SetWindowPos APIs, with the appropriate parameters.

Slight correction. The Access Application window is NOT the main container. The main container is another child window to the Access Application window with a ClassName of MDIClient. The only way that I've been able to get the Access Client Window handle is to Enum through the Access Windows checking for the classname, until MDIClient is found. No application form or window can exceed the boundaries of the Access Client Window unless that window is a popup. That means that every window in the application has to be a popup, or it must reside within the confines of the Access Client Window.

I know of a couple of ways (there may be others) of hiding the Access Application window. One way is to make every form a popup, which is fairly easy, but comes at price of lost functionality. Another way is to use transparent regions, at the price of increased code, complexity, risk, and code management. But this does completely hide Access, even from the taskbar.

What's best really depends on what exactly you're trying to accomplish by hiding Access.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Thanks everybody,

I'll look into using the hWndAccessApp and SetWindowPos to position it. I guess what I'd rather do than minimizing the Access Application window, is to make it full screen, and then center each form within the Application window as they're used.

The main issue originally was to avoid having everything skewed to the upper left corner, when using on a larger screen resolution size than 1024 x 768 (which it was designed for). I don't want to mess with resizing the forms, controls, etc.

I need to leave for several hours, but will check back tonight. My concern now is why does the Property Window refuse to show? This happens not only in the current DB where I was experimenting with things earlier, but in any new DB also. I'll probably post another thread for that issue tonight.

Thanks for your help!
 
It's hard to say, especially without knowing what your experiments entailed. I would suggest that you Uninstall Access, and then reinstall it. But don't feel bad doing it. Trust me, you're not the first to have to do it.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
CajunCenturion,

Thanks for your input. I'm going to start a new thread now about the Property Window not showing. It's a pain to design a form when you can't easily access the properties. I don't have time right now to mess with the Access Application window issue metioned earlier.

huskerdon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top