How to subclass the Access app window

G

Guest

Hi there,

I want to trap resizing of the Access application Window by using
subclassing. I tried it with changing code snippets I grabbed from the
Internet, but I cannot get it to work. Does anyone have any sample code
available?
 
B

Bob Hairgrove

Hi there,

I want to trap resizing of the Access application Window by using
subclassing. I tried it with changing code snippets I grabbed from the
Internet, but I cannot get it to work. Does anyone have any sample code
available?

Knowing that Microsoft uses "back door" (i.e. undocumented) APIs in
developing many of their applications, I would highly doubt that you
would ever get this to work properly. It's certainly not good
engineering practice, at any rate; might be fun, though, trying to
hack into it ... ;)

I assume that you want to prevent the main window from resizing (or
are you doing something else in the resize event)? You can set the
window size programmatically by calling the Windows API functions
Get-/SetWindowPlacement() and then mask out the window style bits
(call GetWindowLong, mask out the appropriate bits, then call
SetWindowLong with the modified style DWORD) which control whether or
not the min/max/restore buttons are shown. No need to subclass
anything.
 
G

Guest

Bob,

Thanks for your reply. I want to adjust the size of certain forms when the
size of the Access app window changes. I know it is possible with
subclassing, but I don't know how to code it.
 
B

Bob Hairgrove

Bob,

Thanks for your reply. I want to adjust the size of certain forms when the
size of the Access app window changes. I know it is possible with
subclassing, but I don't know how to code it.

I think it would be easier to have a timer event running in one of
the forms which checks the Access main window size every so often and
takes care of resizing the other forms. That way, at least you don't
run the risk of doing anything weird.
 
S

Stephen Lebans

With A2K and later, due to abug in the integration of the VB IDE and Access,
subclassing code should be contained within an external DLL.

A GoogleGroups search on:
http://groups.google.ca/advanced_search?q=&hl=en&

subclass window resize group:*basic*

yields 100's of threads with sample code. If you are not comfortable
programming, you might consider using a Subclassing ActiveX control. There
are several out there written in VB or C++ that work on Access forms. They
allow you to select the Message(s) you want to monitor and trigger and event
for you to react to.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top