ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   WM_SETREDRAW doesn't work unless...what? (https://www.excelbanter.com/excel-programming/410682-wm_setredraw-doesnt-work-unless-what.html)

[email protected]

WM_SETREDRAW doesn't work unless...what?
 
RM Smissaert kindly replied to my recent Q of how to disable screen
updating in a TreeView:

Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal HWND As Long, ByVal wMsg _
As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const WM_SETREDRAW = &HB

***

SendMessage TreeView1.HWND, WM_SETREDRAW, IIf(EnableTheBugger, 1, 0),
0

(The 1 and 0 in my IIf are reversed from his example, which I presume
is correct, 'cause it seems to work for me.)

But this call fails, UNLESS (I found empirically) I, like, make the
call, then show a MsgBox (which interrupts processing and "seeds" the
screen first...?) Sort of like having to turn off the pilot before
turning off your stove.

What additional API call must I make if any to make WM_SETREDRAW work?

***

Better yet, how do you do this in a native VBA way?

What I'm doing is cleaning & pruning the tree--deleting & moving
hundreds or even thousands of nodes. Each operation of which has to
wait for my ancient video card, which I inherited from Johannes
Vermeer, to repaint (in slow-to-dry Old Master oils) my screen.

Thanks much.

***

RB Smissaert

WM_SETREDRAW doesn't work unless...what?
 
Try a DoEvents in a few places.
Will need a bit of experimenting.

RBS


wrote in message
...
RM Smissaert kindly replied to my recent Q of how to disable screen
updating in a TreeView:

Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal HWND As Long, ByVal wMsg _
As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const WM_SETREDRAW = &HB

***

SendMessage TreeView1.HWND, WM_SETREDRAW, IIf(EnableTheBugger, 1, 0),
0

(The 1 and 0 in my IIf are reversed from his example, which I presume
is correct, 'cause it seems to work for me.)

But this call fails, UNLESS (I found empirically) I, like, make the
call, then show a MsgBox (which interrupts processing and "seeds" the
screen first...?) Sort of like having to turn off the pilot before
turning off your stove.

What additional API call must I make if any to make WM_SETREDRAW work?

***

Better yet, how do you do this in a native VBA way?

What I'm doing is cleaning & pruning the tree--deleting & moving
hundreds or even thousands of nodes. Each operation of which has to
wait for my ancient video card, which I inherited from Johannes
Vermeer, to repaint (in slow-to-dry Old Master oils) my screen.

Thanks much.

***




All times are GMT +1. The time now is 02:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com