Re: activex issue - document image viewer - access 2003



First I have experimented quite a bit with the control and have never had it
cause the current Access session to improperly terminate.

For your redraw issue, you can force a redaw of the control. I believe it
exposes a hWnd property.


Here is a previous post of mine on a similiar issue.

From: Stephen Lebans (NoEm...@xxxxxxxxxx)
Subject: Re: Menu Navigation
Newsgroups: comp.databases.ms-access
View: Complete Thread (18 articles) | Original Format
Date: 2002-03-05 17:31:27 PST


This issue has come up many times in the past. What's happening is the
ListBox needs to be repainted but Access seems to have missed the
message. As you pointed out Marshall, resetting the RowSource prop
solves the issue.
There may be occasions, where because of performance considerations, you
do not want to have to reset the RowSource. In these cases we can force
the Access GUI to redraw the ListBox and clear the selection(s).
Here's a post of mine on this subject.


From: Stephen Lebans (NoEm...@xxxxxxxxxx)
Subject: Re: How to clear data in a List box?
Newsgroups: microsoft.public.access.forms
View this article only
Date: 2001-09-16 20:43:12 PST


Hi Arvin,
just as a point of interest, I have had trouble with programmatically
clearing selections from a ListBox. It seems sometimes Access will not
redraw the ListBox unless the entire control's window needs to be
redrawn.
For the ListBoxRownumbers project on my site I had to force the
control's window to be redrawn.
http://www.lebans.com/listboxrownumbers.htm


' API Declarations for Sub to clear selections
Private Declare Function InvalidateRect Lib "user32" (ByVal hWnd&,
lpRect As RECTL, ByVal bErase&) As Long
Private Declare Function GetFocus Lib "user32" () As Long
Private Declare Function GetClientRect Lib "user32" (ByVal hWnd&, lpRect
As RECTL) As Long


Private Type RECTL
left As Long
top As Long
right As Long
bottom As Long
End Type


Private Const API_TRUE As Long = 1&


' This sub is required to eliminate a bug/feature
' in Access with ListBoxes that we programmatically select rows in.
' Access does not redraw the control unless we cover up the entire
' control. We fake this by invalidating the entire window.
' Unless you have cached the hWnd the control must have the focus for
this
' to work.


Public Sub ClearSelections(Optional hWnd As Long)
Dim rc As RECTL


' Were we passed a hWnd?
' If not then get current control's hWnd
If hWnd = 0 Then hWnd = GetFocus


Call GetClientRect(hWnd, rc)
Call InvalidateRect(hWnd, rc, API_TRUE)


End Sub
' Code End



--

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


"mikez" <mikemaxed@xxxxxxxxx> wrote in message
news:1153323159.922984.34550@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Anybody? Anyone have any further ideas or suggestions?
THanks!
mike



.



Relevant Pages

  • Re: HWND of Listbox in UserForm in Excel macro
    ... more than one listbox, I do not know if it is easy to distinguish them ... You don't need FindWindow or FindWindowEx to get the HWnds and associate ... Public HWnd As Long ... Or for the reverse, to get the Name of a control based on its HWnd, you'd ...
    (microsoft.public.excel.programming)
  • Re: HWND of Listbox in UserForm in Excel macro
    ... If you want to relate the name of a control with its HWnd, first create a collection object in a standard module, in declarations section. ... Dim ListBoxCollection As Collection ... you have a collection of classes that relate the HWnd to the Name of the ListBox. ...
    (microsoft.public.excel.programming)
  • Re: listbox control refill
    ... > I have a CListBox control on a dialog which has to be ... I fill the listbox with AddString(). ... > Which way should I go to avoid that extensive redraw? ...
    (microsoft.public.vc.mfc)
  • listbox control refill
    ... I have a CListBox control on a dialog which has to be ... I fill the listbox with AddString(). ... Which way should I go to avoid that extensive redraw? ...
    (microsoft.public.vc.mfc)
  • Re: i dont want to coloumn headers resisizing for a listview control in vb
    ... I am using listview control version6, i don't want to coloumn headers resizing, how can i avoid this. ... The "best" way to prevent the columns from being resized is to subclass the listview's header control and eat the WM_SETCURSOR message. ... Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long ... SubclassHeader = False ...
    (microsoft.public.vb.controls)