Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1449

VB6 Blocking-Behaviour in Windows-NonClientAreas (and a solution)

$
0
0
Ever wondered, why e.g. an animation (or other time-critical processing) "stalls" -
when a given Forms Caption-Area is clicked with e.g. the right MouseButton?

From what I've googled, MS seems to have implemented a special MessageLoop which gets triggered,
when you click on such NonClient (NC) areas (including the Min, Max, Close-Buttons on a Form-Window).

Well, below comes a zipped solution, which prevents that (via a SubClassing-Handler, basically like this):
Code:

  Select Case Msg
    Case WM_NCLBUTTONDOWN, WM_NCRBUTTONDOWN
      '...
      Select Case wParam 'don't call the DefaultWinProc in case of the following NC-HitTest-results
        Case HTCAPTION, HTMINBUTTON, HTMAXBUTTON, HTCLOSE: Exit Sub
      End Select
    '...

Although the example-zip below is using RC6-WidgetForms (using the built-in RC6-SubClasser),
the demonstrated solution should be easy enough to apply also to "normal VB-Forms" -
using ones own, preferred SubClasser.

Here's the Demo-Zip: NCAreaBlocking.zip
(which uses a simple Counter, reflected in the Forms.Caption, to simulate "animated progress")

HTH

Olaf
Attached Files

Viewing all articles
Browse latest Browse all 1449

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>