Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Form Caption Mouse Events (WM_NCLBUTTONUP)


I'm trying to detect mouse down and up events in a Form's caption area by subclassing the form's window.

On my laptop (XP home), I get WM_NCLBUTTONDOWN but not WM_NCLBUTTONUP messages

The same for right-clicks as well ... anybody know what's going on???

I'll post a short demo - maybe it's just XP home??




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Mousemove And Keypress Events When Mouse Is Not Over Form
I would like to have a mousemove event that works no matter where the mouse is. I also need an event for any kind of keypress. basically I want the same sort of trigger that deactivates a screensaver, but a screensaver wont be on and the mouse may not be over the form. (keypress also needs to work when form does not have focus, is not active, whatever)

Does this neccesarily require API calls? Because

<understatement>

I am somewhat of a novice with API

</understatemnt>

If anyone could help I would really apprieciate it.

I've already posted this in the API Forum, but it isn't getting much play there. Here it is for reference.

Subclassed Form No Longer Responds To Mouse Events
Hello all!

While subclassing a TreeView control to gain better control of its mouse events than VB provides, I thought I would create a kind of 'framework' for subclassing windows/controls to provide a quick & easy way of accessing UI messages.

It wasn't working very well so I started from scratch and created the attached project to simply subclass a VB Form and catch its WM_PAINT messages (although the idea is the framework can manage multiple subclassed windows and multiple message hooks).

The weird thing is, the form now doesn't respond to mouse events. I know the subclass is working correctly, because I can control the window with the keyboard (Alt+[space], 'Move' [enter], [arrow keys]) and the 'paint' messages are caught when they should be.

If you add child windows (ie. controls) to the Form, they all behave as expected, you just can't move the window, and if you try to subclass the controls, they ignore the mouse events too.

Can anyone see what's going on here?

Many thanks in advance!

reinholdmesner

Hooking Mouse: Receiving Unexpected Mouse Events Every 45 Seconds
I was given code which hooks the mouse events. Everytime the mouse is moved the mouse hook procedure which was linked into the even handler is called as expected. However (about 2/3 of the time after I start my application) I notice the mouse hook procedure is being called every 45 seconds even though I am not touching my computer or mouse in any way. Any ideas what could be causing a mouse event to fire every 45 seconds without me touching the computer/mouse, thus causing my mouse hook procedure to be called?

Some Trick To Send Mouse Events (without The Mouse) Over My Menu?
I'm reading mouse events inside my app, then I reproduce it.
The reading is fine when Im over the menu, but when I reproduce it, just when the menu popups my program stops executing, waiting for the menu to close, after that, it continues.

Any way to keep in control in the Menu zone? Hooking or subclassing would do it? I just want this to happend inside my app.
Im using mouse_event API.

EDIT: Its Resolved now, everything goes fine after removing a not necessary Do Events.

Help On Caption Events
I am running a series of "IF" and "Then" statements. I am having a ComboBox List of names that if the combobox = "milk " then

lbl1.caption = "icecream"

Though I want to run a second event that will always check what is in lbl1.caption without having a command button to check it. So... something like...

if lbl1.caption = "icecream" then
lbl7.caption = "yum"

BUT I put the above code in and lbl7 caption does not change...though if I make a command button to do this effect it works just fine, but I don't want to use a button.

Any help at all would be great!

WM_NCLBUTTONUP
Hello,
Can anyone tell me how can I trap WM_NCLBUTTONUP message from VB. WM_NCLBUTTONDOWN is working fine for me. It seems window is capturing the mouse to check dragging of form. How can I trap WM_NCLBUTTONUP message, process my work and let Window do whatever it likes to!!

Keep Form Caption ...but Change Taskbar Caption...how?
I want to keep the Form caption as is...but kind of need that the button in the TaskBar shows the percentage of completion of a task... since it'll be sometimes working in the background

this is just like it happends in the application FlashFXP ...in the main it shows the app.caption and the FTP where I'm logged and in the TaskBar it shows the percentage of the file being retrieved and total time to finish...

I just need to find out the ...How to do it... been searching here in general and in the API section but all (that I've found) reffers to borderless or without titlebar forms ...


Thanks in advance for any lead provided!

How To Get Mouse Events When Mouse Cursor Is Outside My App?
Hi all, I am trying to update a mouse cursor position indicator (x, y) in my application whenever the mouse moves. The problem is, I am not receiving any mouse events anymore once the cursor leaves the area of my application!
I have tried using the MouseMove() event, I have tried capturing mouse movement in a window procedure, but neither works. I might register a global mouse event handler, but then I'd need an external C++ DLL with the event proc. For many reasons, I don't want to do polling.

So.

The only solution I can see is to use a JournalRecordProc (WH_JOURNALRECORD). The Microsoft docs say that for a journal hook, I don't have to use the external DLL.

How can I register a journal hook?

Thanks!

Can You React To Events Using APIs Similarly To VB6 Form Events, Etc
Hello,

Please excuse this question if it is laughably ignorant. I am having trouble trapping the Tab key on a VB6 form. Since all of the controls have their own hwnds, I was wondering if there was anything I could do with an API and child windows to determine when it changed.

I have worked with APIs only a very little bit, so please bear with me on this one if possible. Thanks in advance!

Have a great day!

j2consulting@yahoo.com

Getting Title/Caption Of Program Mouse Is Focused On
What i am trying to do is have:

Code:
text1.text = (Caption of current program the mouse is focused on/clicked)
Example:
Text1.text = Mozilla Firefox

Also i need to know how i could send a message box after the textbox has 20 characters in it.

Sorry if i didnt explain this enough, i didnt really know how to explain, I hope you understand

Thanks, iTHUG

Mouse Events
Mouse events
how ywould i make an image on mouse over disply image1 and on mouse offdisply mage2

Mouse Events
Hello

I want to Use Mouse_entered and Mouse_Exit Event of any Object. How Could as there is no Built in Events for this purpose

Mouse Events
I'm planning to attempt a card game. My first step was to be able to actually move the card. I succeeded, but I had to use form-level mouse events, meaning I had to actually click on the form itself, not the card, in order to get it to move. Here's the functioning code.

Private Sub frmCardMoveTest_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
m_MouseisDown = True
End Sub

Private Sub frmCardMoveTest_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
m_MouseisDown = False
End Sub

Private Sub frmCardMoveTest_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If m_MouseisDown = True Then
m_objPoint.X = e.X - 100
m_objPoint.Y = e.Y - 148
pbxCard.Location = m_objPoint
End If
End Sub

I tried changing all those events from frmCardMoveTest to pbxCard (and of course changing "MyBase" to "pbxCard") but when I do, I get a very strange effect. I click on the card and drag, and it produces two card images which flicker very quickly. I can't explain this. Can anyone tell me the correct way to code the clicking and dragging of a control, like a picture box? The effect I want is as follows: if a specific picture box is clicked, I want to enable the box to be moved with the mouse. If it isn't clicked, I don't want a mousemove event to fire.

Mouse Events
Hi folks,

in a FPS when i got the angle off movement of the camera how can i calculate the lookat point in 3d space?

lets say my camera (view) is at point (0,0,0) and my lookat point is at (0,0,1)
when i rotate it 1 degree how can i calculate the next lookat point?

Mouse Events
Hey Guys,

Quick Question (i think). I have a picture box and i want it to execute two different codes on two different events. These are: MouseDown and DblClick.

I was wondering, is this possible? Because the mousedown event triggers first and therefor not allowing the DblClick event to be executed.

Mouse Events
My app has a design area for creating a layout. This can be viewed by clicking on a menu option which shows the layout in another form. If I right click on this form, the image zooms in and left click the image zooms out. The zoom acts until it reaches a limit then just ignores the event. If I click slowly on the image, I can zoom in and out with no problem. If I click quickly in succession, then the calling form seems to capture the next mouse event. I placed a breakpoint in the Activate event and the second mouse click stops here. There isn't a mouse event handler defined in the calling form.

Is there a way of preventing this from happening.
I want to keep the mouse events within the view form until I close the form down.

Mouse Anywhere + Events
i am new to programming and i am trying to make a program that works like this:
no matter where the mouse is, when the middle mouse button is pressed in it will create an L every tenth of a second. so basically, you could be looking at a textbox, hold down the middle button and a string of L's appear. if someone could mainly help me with detecting the mouse button being held in i would GREATLY appreciate it! thanks in advance!

Mouse Events
how do you disable all mouse events?

Mouse Events
how do you make the mouse left or right click on cretain coordinates?

Mouse Events
I'm currently making a map editor for tile based games. I have a picture box as a container and Imageboxes being loaded in dynamically in place, by use of a control array, representing each tile in the map.

How would I allow the image boxes to recognize when i'm over them with the mouse down. A simple MouseDown event won't work because when i'm painting tiles it would require me to click on each image box individually.

I wan't to be able to just keep my mouse button held down and continue moving the mouse and have each imagebox recognize that.

How To Get Mouse Events
Hi....

I am developing my own media player. For this I am using MCISendString API to decode and playing purpose.

I have got a form and a picture box on it. While opening the media say a .mpeg movie, I am passing handle (hWnd) of the picture box, and WS_CHILD style parameter to the API. That API maps a new window to the picture box, in which you will get movie.

Now I am able to play the files. But my problem is when user clicks or moves mouse over the picture box, I am not getting any events for that picture box . Now I want you people to help me out.

I tried to Hook the message queue. I got the window handle of the window created by API. In message queue I am not getting any Mouse_Down message. I am getting only Mouse_Initialize and Parent_Notify message.

Please help out...

Mouse Events
How I can Get the Left And The Top Of the Mouse

Mouse Events
You can hook all the mouse messages system wide using EventVB release H thus:-


VB Code:
Option Explicit Dim WithEvents vbLink As EventVB.APIFunctionsDim WithEvents vbHook As EventVB.ApiSystemHook Private Sub Form_Load() Set vbLink = New APIFunctions Set vbHook = vbLink.System.Hooks vbHook.StartHook WH_JOURNALRECORD, HOOK_GLOBAL End Sub Private Sub vbHook_JournalMouseMessage(ByVal msg As EventVB.WindowMessages, ByVal x As Long, ByVal y As Long, ByVal time As Long, ByVal TargetWindow As EventVB.ApiWindow) If msg = WM_LBUTTONDOWN Then    Debug.Print "Mouse down at " & x & "," & yEnd If End Sub


Hope this helps,
Duncan

Mouse Events????
When I right click on the day in the calendar I want a menu to pop up. But I don't want the menu to pop up every time I use the left button!! Need Help!!!!!

Mouse Events
Dear All,
This is a problem relating to control events. I have a list box in my form. When a user clicks once on the control, a certain method should be called and when the user double clicks, another method should be called. But the problem is that the click event is fired both for single click and double click. so even for double click, the first method gets called.

Can somebody please tell as to how to distinguish between single click and double click event so that the correct method is called.

Thanking all the patrons in advance.

Regards,
Sanjhu.

Mouse Events
Hi Guys, talk to me I need your help I'm stuck here, It seems easy but not for me . I'm doing a vb program MDI Parent form and child forms. I need your help Guys with the mouse events, Shift key, ctrl key, and alt key on these events, clicking on any of the child forms will change the caption of the label or the command button, but only on that form. A left click Changes the label, a right click changes the command button. if the shift key is down when the click occurs,change the font size to 18. if the shift key is not down, change the font size to 8. If ctrl key is down make the font bold, if not it not bold. if the alt key is down make the font italic, if not make it not italic. More than one of these keys can be used with a single click. please this is very important, I am not going to leave until i get response from U Guys

Mouse Events
Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

does anybody know how to use this funtion to tell when mouse buttens are click like tell when left button is double click mouse down mouse up all the good stuff like this.

'left-click constants.
Global Const WM_LBUTTONDBLCLK = &H203 'Double-click
Global Const WM_LBUTTONDOWN = &H201 'Button down
Global Const WM_LBUTTONUP = &H202 'Button up

'Right-click constants.
Global Const WM_RBUTTONDBLCLK = &H206 'Double-click
Global Const WM_RBUTTONDOWN = &H204 'Button down
Global Const WM_RBUTTONUP = &H205 'Button up

also if this is not what you use to do it can some one tell me what to use.

Mouse Events On All The App's
I Need Function Or Any Way To Get The Event Of Clicking The Mouse On All The Applications !
Like The Babylon Program Where ever You Click The Right Mouse
The Program Lunched !!!

HLP PLZ THX

Mouse Events
I am coding a program that would retrieve the x and y coordinates anywhere on the screen. I am using the API GetCursorPos to acomplish this, but I want to also be able to click anywhere on the screen and record the x and y coordinates, retrieve them and once y have them use the SetCursor APi to click that particular area. Thanx in advanced.

And if this is not possible, then how can i use a bitmap or icon to drag it to that particular area on the screen and when i release the mouse button the x and y coordinates are automatically recorded.


Thanx

Mouse Events
Does anybody know how to force a window to respond to mouse events (if it is not already) like VB's MsgBox.

It has focus and is responding to keyboard operations but will not respond to mouse clicks.

It's too complicated to explain why I'm in this situation but if anybody knows of a suitable API call it would be much appreciated.

Simon.

Mouse Over Events
Hi all is there any event like mouse over so where my mouse goes over an image it changes to a different one and then when it exits that image it goes bak to a normal deselected image thx from mark please let me no asap

Listview Mouse Events...
hi,
i have a multiselect able listview in reportstyle and need it to fire up an event when i have selected one or multiple items...but only one time when i finished the selection!

i am currently using the itemclick event! which is ok, but it fires up on every new item i select, which means it fires up 20 times in a selection of 20...which forces my database to be asked 20 times for new values instead of one time when selection is finished!

any ideas??

thx & greets

matthias

Simulate Mouse Events..?
hey,

is it possible (stupid question, of course it is.) to simulate a clicking a mouse button (preferably right) via VB ? if so, could someone plz attach the code or any msgs, sites, other things that would be of use.. cheers in advance ! ta,

Confused... Mouse Events Ect...
Well, I've been stumped on this one for two days now. Please stick with me... it's kind of confusing but hopefully someone here can help. Basically, my goal is to use the get & setcursorpos() functions to move the mouse where I want it, and getpixel() to test for a certain color, and after fighting with sendmessage() I decided to try using the mouse_events to send clicks for me.

All in all, I was successful. Program runs great, up to a point. I'm calling all these inside a for loop, with a 1/20th of a second delay between loops. (yes, I want fast clicks, alot of them) After 9700 and some odd loops, my program kinda dies, screws up the windows gui, but still is moving the mouse... just not clicking...

I was curious, so I opened up ctrl-alt-delete to check memory usage, and sure enough, it's eating up the page file. about 25 megs worth, and incrementing the kernal memory by 24k every second until it dies.

Do API calls really need that much memory? Code will follow shortly, just trying to get the core of the problem out here.

-Binary10110

Track Mouse Events
Hey,
We need to implement the timeout feature in our project i.e log out of the machine after a specified time period if no mouseclick or key is pressed.Hence,our VB project needs to detect this change in mouse events on the screen/desktop, and not just for the VB form(as most websites are giving us).
Is there any kind of API which can help us do this?Please help..

Intercept Mouse Events
I need to intercept the right mouse button before any other application recieves the message. The reason I want to do this is because I want a window to display when I right click the mouse no matter what window is active. I don't want the other applications to recieve the right click message. I just want my application to get the right click message and do other things when the button is clicked.

Example:

The user is browsing the web with internet explorer and when they right click my window should display instead of Internet Explorers right click menu.

How do I do this? I think it has something to do with these API calls: WindowProc or GetMessage. Any help would be appriciated.

Mouse Click Events
When subclassing a window you can handle for mouse messages using the following constants:

VB Code:
Private Const WM_MOUSEMOVE = &H200Private Const WM_LBUTTONDBLCLK = &H203Private Const WM_LBUTTONDOWN = &H201Private Const WM_LBUTTONUP = &H202Private Const WM_RBUTTONDBLCLK = &H206Private Const WM_RBUTTONDOWN = &H204Private Const WM_RBUTTONUP = &H205

If I wanted to raise the normal events from my control, like MouseMove, MouseUp etc how would I trap and raise the MouseClick event? Would I raise this when I receive the MouseUp message?

This is more of a cosmetic problem that a bug. I am just trying to get my control so it acts in the same way as do all others on the market...

Woka

Scroll Mouse Events
Hello,

I am using Visual Basic 6.0 Enterprise on a M.S. Windows NT 4.0
net work.
I came accross the next problem : In my application a modal form is placed over a non modal form. Now this works exactly as it should be. You cannot access the the non modal form.
However when i dial the scroll button on my mouse (a scroll mouse) the application crashes and Dr Watson is started.
If i scroll the mouse on the modal form, nothing strange happens,
same when i scroll outside the application.
It happens when the mousepointer is placed on a non modal form. If someone knows a solution for this problem, i would be most grateful.

Send Mouse Events
Hello,

I am wondering how to send mouse events to the system. For example, I wish to create a program which sends a mouse click message to the system (auto clicking). If anyone could tell me how this can be done, it would be greatly appreciated!

Thanks!

Desktop && Mouse Events
Like wow man........
Can anyone tell me how to detect mouse events from the desktop? My program needs to perform an action when someone clicks anywhere on the desktop. I'd sure be grateful if somebody can help with this. Thanks

For The Experts...( WOT NO MOUSE EVENTS !!)
Anybody aware of a way to drag text from the text field of a combo box to a standard text box, considering the combobox has no mousedown event to signify the start of the operation ?

Delayed Mouse Events
I have a PictureBox that when the mouse is pressed, BackColor
changes to Blue and when the mouse is unpressed, BackColor is
set to Red for demo purposes.

The Mouse_Down event fires just fine until you click the mouse
button fast. There is a delay of about .5 seconds.

It seems to be when I double click the PictureBox, the second
Mouse_Down event doesn't fire timely.

Any solutions, comments?

Listview: Mouse Events?
Private Sub lstApplications_Click()
'Fired between MouseDown and ItemClick
End Sub

Private Sub lstApplications_ItemClick(ByVal Item As MSComctlLib.ListItem)
PopupMenu mPopOnApplication
End Sub

Private Sub lstApplications_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
PopupMenu mPopOffApplication
End Sub

I want the popup menu mPopOnApplication to be called when you right click one of the listview items, and mPopOffApplication to be called when you right click anywhere else on the listview control. The problem is that the mouse down event is fired before lstApplications_ItemClick. And so is lstApplications_Click.
So mPopOnApplication never shows up.
Any sugestions?

Send Mouse Events To IE5
id like to be able to send repeatable click events to certain radio and push buttons on a web page from my own external VB app.

http://www.glitchless.com/kingdoms/rwk2.html (not this page but the page after it once you log in)

would anyone like to point me in the right direction? Sending click events to certain positions on the page wont work. The varying add banners that are displayed change the coordinates of the buttons after each refresh.

thanks,

Scott Healey

Generating Mouse Events.
I can get VB to move the cursor to a location on the screen, but how can I get it to click there? I have tried SendInput, but I don't know how to use it. Can someone tell me how to use SendInput or another method on how to click somewhere.

Thanks.

Coding For Mouse Down Events
I remember seeing some code on vb-world.net a while back on how to make the system right click or left click and also how to make them double click. I searched and i can't find it anymore on the web at all. Can someone link me to somewhere or can someone just make a bas file and send me a copy of it to my email address? i really need this for some program i am working on. Thanks, i need this asap...
&lt;BantyRan@optonline.net&gt;

Mouse Events On Mschart
how can i drag/change the data series in a mschart at runtime ??

thanks

Mouse Events Outside Your Window
Is there a way to detect if the left mouse button is being held down outside your form window?
(Mouse left down)



Edited by - Maltadav on 10/15/2007 9:06:29 AM

Automated Mouse Events
A while back I received a demo project from someone that used a timer control and automated mouse events to make the right mouse button click every second. It works great, but I don't know how to use other events that might be more useful to me.
Please help me


Now, don't get me wrong, 'cause baseball's a great sport.
It teaches little children simple eye-hand coordination with little effort or exhaustion.

 -byufan

Copyright © 2005-08 www.BigResource.com, All rights reserved