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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flicker free form resizing of a sizable Access form 1

Status
Not open for further replies.

patriciaxxx

Programmer
Jan 30, 2012
277
GB
I need flicker free form resizing of a sizable Access form, when there is a minimum size limit controlled by the form's Resize event, and the user tries to change the size.

The following code (which I did not write and do not fully understand) does accomplish this, however looking at it I believe it is intended for a msform (UserForm) not an Access form.

So can anybody modify the code so that it works with an Access form?

Code:
[COLOR=#204A87]Private Const MyFormWd As Long = 5000
Private Const MyFormHt As Long = 6000

'********************
' Form_Resize
' Resize the form
'********************
Private Sub Form_Resize()
  Select Case Me.WindowState
    Case vbMinimized
      Exit Sub
    Case vbNormal
      'if too small...
      If Me.Width < MyFormWd _
         Or Me.Height < MyFormHt Then
        With Me.tmrResize 'smooth w/timer
          .Enabled = False 'turn timer off
          DoEvents 'screen catch up
          .Enabled = True 'restart timer
        End With
        Exit Sub 'let timer do work
      End If
  End Select
  '
  'other control arrangement code goes here.
  '
End Sub

'********************
' tmrResize_Timer
' Check Win for too small
'********************
Private Sub tmrResize_Timer()
  '
  'turn off timer
  '
  Me.tmrResize.Enabled = False
  '
  'do nothing if minimized
  '
  If Me.WindowState = vbMinimized Then
    Exit Sub
  End If
  '
  'resize to minimum dims
  '
  If Me.Width < MyFormWd Then
    Me.Width = MyFormWd
  End If
  If Me.Height < MyFormHt Then
    Me.Height = MyFormHt
  End If
End Sub
[/color]
 
Alright - why would you want to load a library file at all, what IS a library file, how do you think "loading a library" file has been useful for your previous Access programs, and why do you think it might be useful on this occassion?

And you can guess all you want - only you shouldn't be guessing - but LoadLibrary works fine with my DLL.
 
Hello strongm

When I say I’m guessing its just a turn of phrase I was using that’s all, I wasn’t trying to be difficult.

You say LoadLibrary works with your dll, I did post code trying to use it along with the error it gave me, and asked the question if my code needed some change to make it work.
 
Are you going to answer any of my questions? I am not going to just keep feeding you code that you don't appear to understand and seemingly just cut and paste into your projects. Help yourself by showing what you understand currently.

I can assure you that LoadLibrary does exactly what it is supposed to with my DLL. But let's find out what it is you think LoadLibray does, which you seem to be being evasive about, and then we might be able to proceed.
 
Hello strongm

Please I’m not being deliberately evasive and apologize if that’s how I’m coming across to you.

I did answer what I thought LoadLibrary does and thought I could use it to load your dll and use it that way (like dynamically I suppose you would call it) instead of referencing it in the references window. That was all I was trying to achieve with the LoadLibrary code I posted.
 
Perhaps not deliberately evasive, but answering "LoadLibrary loads a library" does not suggest a real answer. It is a bit like saying "BitBlt blits some bits" - technically accurate, but devoid of meaning unless you understand both what bliting is and which bits it acts on and why you might use it. At this stage it is still unclear (to me, at least) that you actually know what LoadLibrary actually does.

Here's a starter: the sort of library that LoadLibrary would typically be used for NEVER appears in the references window.
 
Hello strongm

I do appreciate all your help and you trying to teach me things.

I can assure you that I’m not being deliberately evasive I simply can’t give you the answer you’re looking for when I don’t have it. I am what I am and know what i know after all.

I have no idea what BitBlt blits some bits means, I have never heard of it, if I didn’t think you were being serious I’d think you were making a joke.

I believe I have learnt some things and am still learning, and will always be learning.

What is clear to me is that there is a huge difference in what you know and can do compared to me. I don’t know how long it has taken you to gather all your experience and knowledge but imagine it’s significantly longer than me and realistically, I will never be able to match your level of experience and understanding.

I feel your trying to drag out of me something that just isn’t there with this LoadLibrary. The reason the code I poated doesn’t work is an indication I suppose of that together with an indication of my understanding of those functions. If I knew more / enough / as much as you about LoadLibrary my code would probably have worked, or I would have known it never could, either way this post would never have been posted.

Like I said, I do appreciate all your help and you trying to teach me things and am sorry if my lack of experience is frustrating for you.


 
>I am what I am and know what i know after all.

Indeed.

>no idea what BitBlt blits some bits means

Exactly my point. Simply quoting the name of a function call broken down into into consituents parts does not infer meaning or understanding - yet that is exactly what you did with LoadLibrary: quoted it back at me when I asked what you thought it did. (and yes, I chose BitBlt deliberatey, because it does really exist, but I rather suspected that blitting bits is not something you'd be familiar with and thus breaking down the function name would look like nonsense)

>If I knew more

It isn't a question of knowing more. It's a question of trying to establish what you currently know.

From your answers about LoadLibrary (or more accurately the lack of answers) you seem to be indicating that you are using LoadLibrary in other Access applications without knowing what it does. And you don't know why you need it. Is that correct?

 
Patricia, do you know what GetProcAddress and CallWindowProc are ?
 
I use a mix of code written and/or modified by me and/or others which I understand to varying degrees ranging from fair to good, sometimes not at all and rarely fully. If it works I tend to think (right or wrong) that it must be right, well anyway if it works and does what I wanted it to that’s where it stops.

I have used LoadLibrary in other dbs where I have dlls which sit in the app folder and there is no reference to them in the Reference window. I didn’t write the code but changed it round a bit from code I already had that was doing this in another db. My thinking (again right or wrong) was that it was loading the dlls without having to put them in the reference window and that was what I was going to try and do with LoadLibrary and your dll.

I have seen GetProcAddress and CallWindowProc used but don’t fully understand them. I mostly use SQL and anything else is usually for fun projects of my own, that’s how this one started out though it’s beginning to loose its appeal a bit now.

 
I have seen GetProcAddress and CallWindowProc used
So, by chance not in conjonction with LoadLibrary ?
 
Hello PHV

Yes, by chance, I don’t recall them being in the db I did and when I checked it and did a search they didn’t come up.

Are they then what’s missing from the code I posted and the reason it doesn’t work.
 
>that’s how this one started out though it’s beginning to loose its appeal a bit now

Why? Because you are being asked how things work? Noone here has any problem with you not knowing stuff, or not being as good as people with more experience. But I at least (and maybe some others) find it stunning that you call yourself a programmer, be coming here for assistance for over a year and yet seemed to have advanced your knowledge not at all, nor seem interested in understanding the code you get handed to you on a plate. "If it works I tend to think (right or wrong) that it must be right" stuns me.

Let's see ... here's a function that, given the name of any given month gives you the name of next month. Check it out. It works, whether you feed it a short month name, a long month name, or even just a number. Brilliant. So I guess you'd include it in your code. Even though, come September (but only September), it won't work...

Code:
[blue]Public Function NextMonth(strMonth As String)
    NextMonth = Format(DateAdd("m", 1 + Len(Format(Now, "mmmm")) \ 9, Format("1 " & strMonth & " " & Year(Now), "dd/mmm/yyyy")), "mmm") [green]'loads of formatting to ensure this works with any month format[/green]
End Function[/blue]

Surely it behoves you to do your best to understand the code you are putting in your programs?

>I have used LoadLibrary in other dbs where I have dlls which sit in the app folder and there is no reference to them in the Reference window

And I'll repeat: the type of library files that LoadLibrary typically works with are not supposed to appear in the references window; it isn't an oversite.

>GetProcAddress and CallWindowProc

LoadLibrary is basically completely useless in VB (and other languages) without the use of these two functions. So, given your apparant assertion that you don't actually use them in the code where you are using LoadLibrary ... well, the LoadLibrary code will be doing absolutely nothing whatsoever.

So this takes us right back to WHY you felt you needed LoadLibrary in those other projects.

What we are trying to do here is get YOU to help US to help you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top