How to detect mouse events on listbox

Hi Experts,

Can we detect mouse events on list box? If there is a list box on dialog box 
and i add wm_lbuttondown message for dialog box. When i click mouse on 
dialog box then function for lbutton down is called while when i click mouse 
on list box then this function is not called.
Can i detect mouse events like lbutton down rbuttondown etc for list box? 


0
mfcquery (42)
6/22/2006 11:18:57 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
1041 Views

Similar Articles

[PageSpeed] 58

MFCQuery wrote:
> Hi Experts,
> 
> Can we detect mouse events on list box? If there is a list box on dialog box 
> and i add wm_lbuttondown message for dialog box. When i click mouse on 
> dialog box then function for lbutton down is called while when i click mouse 
> on list box then this function is not called.
> Can i detect mouse events like lbutton down rbuttondown etc for list box? 

When you click on the list box Windows sends the message to the list 
box, not to the dialog.  You can handle list box messages by subclassing 
the control.  You derive a class from CListBox, then use class wizard to 
create a control member variable of this class in the dialog.  Then if 
you add a mouse message handler to your list box class it will receive 
the message.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
6/22/2006 12:29:22 PM
Thanks
"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in message 
news:%23n%23%23%23dflGHA.4044@TK2MSFTNGP03.phx.gbl...
> MFCQuery wrote:
>> Hi Experts,
>>
>> Can we detect mouse events on list box? If there is a list box on dialog 
>> box and i add wm_lbuttondown message for dialog box. When i click mouse 
>> on dialog box then function for lbutton down is called while when i click 
>> mouse on list box then this function is not called.
>> Can i detect mouse events like lbutton down rbuttondown etc for list box?
>
> When you click on the list box Windows sends the message to the list box, 
> not to the dialog.  You can handle list box messages by subclassing the 
> control.  You derive a class from CListBox, then use class wizard to 
> create a control member variable of this class in the dialog.  Then if you 
> add a mouse message handler to your list box class it will receive the 
> message.
>
> -- 
> Scott McPhillips [VC++ MVP]
> 


0
mfcquery (42)
6/22/2006 1:49:35 PM
Try this,

Handle the list message in ur dialog

ON_NOTIFY( wNotifyCode, id, memberFxn )
Ex: ON_NOTIFY ( NM_CLICK, IDC_LISTBOX, OnRtClick)

-Kiran

MFCQuery wrote:
> Thanks
> "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in message
> news:%23n%23%23%23dflGHA.4044@TK2MSFTNGP03.phx.gbl...
> > MFCQuery wrote:
> >> Hi Experts,
> >>
> >> Can we detect mouse events on list box? If there is a list box on dialog
> >> box and i add wm_lbuttondown message for dialog box. When i click mouse
> >> on dialog box then function for lbutton down is called while when i click
> >> mouse on list box then this function is not called.
> >> Can i detect mouse events like lbutton down rbuttondown etc for list box?
> >
> > When you click on the list box Windows sends the message to the list box,
> > not to the dialog.  You can handle list box messages by subclassing the
> > control.  You derive a class from CListBox, then use class wizard to
> > create a control member variable of this class in the dialog.  Then if you
> > add a mouse message handler to your list box class it will receive the
> > message.
> >
> > -- 
> > Scott McPhillips [VC++ MVP]
> >

0
6/22/2006 3:43:29 PM
Reply:

Similar Artilces:

Help!!! Click event not working as expected.
This code is not working properly. What do you think is wrong? Private Sub cmdChangeVendor1_Click() DoCmd.Close acForm, "Invoice by Market Reviewer", acSaveYes DoCmd.OpenForm "Selections", acNormal End Sub The issue is, I have a form,form1, that has txtbox1, a subform and a cmdbutton1. And I have another form, form2, that has a cmbbox2 and a cmdbutton2. What I want to do is click the cmdbutton2 and open form1 with txtbox filled out with the value of cmbbox2. When I click on cmdbutton2 I want to return to form1 hence,the above code snippet. But What happens is...

Exch 2003 Event ID 10002
Hi all I was hoping somebody may be able to shed some light on the following error I am getting on a server after a reboot:- Event Type: Error Event Source: DCOM Event Category: None Event ID: 10002 Date: 25/05/2004 Time: 08:20:24 User: NT AUTHORITY\SYSTEM Computer: INTMAIL1 Description: Access denied attempting to launch a DCOM Server. The server is: {9DA0E103-86CE-11D1-8699-00C04FB98036} The user is SYSTEM/NT AUTHORITY, SID=S-1-5-18. There are no other errors or warnings in the event log. I have looked through the knowledge base and the only articles I could find were related to the...

Display a bmp when you mouse over a control
Is it possible to have a .bmp display when you mouse over a control? I have saved the help screens from another application to seperate files and would like to display them when you mouse over a control. This would be exactly like every control on this page. For example, when you mouse over the GO button this message appears "Click to search". Ther are probably other ways to do this, but here's one: Place the bmp on the form and set the Visible property to NO. On the MouseOver event of the GO Button: Me![MyBmp].Visible = True Place rectangle around the Go Button. On the Mo...

Detect tab id
Hi, I have a form with 4 Tabs. Each Tab has a subform, each subform has an ID field to link to the main form. I want to refresh a subform when a the cursor is on that specific tab, but I don;'t know how to refer to a Tab index. For example If cursor is on Tab 2 then frmSubForm2.requery end if Could someone help me SF You can get the name of the tab by using: Me.TabCtl1.Pages.Item(Me.TabCtl1.Value).Name Or just the Index number: Me.TabCtl1.value -- Bob Larson Access World Forums Super Moderator Utter Access VIP Tutorials at http://www.btabdevelopment.com _________________...

GP 9 Client Install
Anyone ever run into an error "A version of .NET Framework isn't detected" when trying to install GP Client version 9???? Any help would be greatly appreciated. ..NET 1.1 and 2.0 are both installed??? I have also uninstalled and re-installed both of these version. Thanks! Cameron Have a look at Knowledge Base (KB) Article 947538. https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?scid=kb;en-us;947538 David Musgrave [MSFT] Escalation Engineer - Microsoft Dynamics GP Microsoft Dynamics Support - Asia Pacific Microsoft Dynamics (formerly Microsoft Business Solutions...

i can't see a past event
Some of my past events are shaded blue and I can't access them. Auto archiving is set to off for my calandar. I have looked at those past events which still show but can't see the difference. Any ideas welcome. "CMck" <CMck@discussions.microsoft.com> wrote in message news:6F32C2AD-FB6F-43EE-8AE0-BCECA26307E6@microsoft.com... > Some of my past events are shaded blue and I can't access them. Auto > archiving is set to off for my calandar. I have looked at those past events > which still show but can't see the difference. Outlook v...

Embedded IE7 browser object
We have an MFC app that embeds the WebBrowser ActiveX control. We use custom URLs to send commands to the C++/MFC implementation class of the browser control, which we handle in a method for the BeforeNavigate2 event, and Cancel the navigation. The problem is that starting with IE7, URLs are being URL Escaped before the call to the event handler. In particular, the '{' and '}' characters are being changed to '%7B' and '%7D'. This didn't happen with IE5 through 6. This is breaking our applications in the field. Obviously the C++ code can be modifi...

Owner Draw ListBox and ON_LBN_SELCHANGE
Hello. I have an Owner Draw (Fixed) ListBox and I would like to catch ON_LBN_SELCHANGE event. But it looks like it is impossible in case of owner drow controls, is it? Thank you. No it's not impossible. You can catch it. Make sure that LBS_NOTIFY is set. AliR "German" <german.koninin@crmDASHworldwideDOTnet> wrote in message news:%23FB0JEZxEHA.3976@TK2MSFTNGP09.phx.gbl... > Hello. > I have an Owner Draw (Fixed) ListBox and I would like to catch > ON_LBN_SELCHANGE event. But it looks like it is impossible in case of owner > drow controls, is it? > Thank ...

Outlook and disappearing Calendar Events
I work for a large company with 30,000 users on Microsoft Outlook. Some of us have Outlook 2003 while others are still using Outlook 2002 or Outlook 2000. All of the groups in our company seem to have this same problem. As an example, if a calendar event is sent to 30 users and accepted, everything is fine. If that same calendar event is updated by the originator, some but not all users have problems with that event. In some cases the calendar event disappears or cannot be opened or saved while in others the object can't be found. Does this sound like an Exchange error or an en...

SMTPSVC Event Id 402
We seem to get hit often with a rash of Event ID 402 messages -- which have a description of: Virtual Server 1: xx.xx.xx.xx (ip address) Maximum number of connections has been reached. Connection being closed. I've checked to ensure that we are not an open relay -- I checked both the SMTP Virtual server settings and the Internet Mail Service settings and have monitored the queues often. I don't believe we are allowing relaying. I have Exchange Server 2000 SP3 with SP3 hot fix rollup installed, and also have the following other software on this system: CA's BrightStor Arc...

Event sink #2
Hey fellows !!! how ya'll doin'? (No, I'm not from NY) Guy, I need HHHEEEELLLPPP, I got the following problem: Messages to uol.com.br get stuck on queue, force connection gives event sink. I am able to send emails to anyone in this universe, BUT the domain uol.com.br, my smtp connector says that it is due to an event sink. I called them and asked them if we are in some sort of blacklist with them, cause my company does have a huge client database and we send newsletters frequently so somehow there were a misundertanding, they said no. I enabled the tracking system and I ...

All day events shown as shaded, not white.
2 users with Outlook 2007. When one creates an all day busy event the day becomes shaded. When the other creates the same all day busy event, the day stays white. White is preferred. How can I change the setting for the person who does not want the shading? Don't set a color category and set it to show time as busy. See http://www.outlook-tips.net/beginner/colored_dates.htm -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by email: mailto:dailytips-subs...

Update listbox on a tab
Hi, I have a tabcontrol on a form that contains two tabs. The first tab is used to enter new projects into a table. On the second tab I am using a listbox to view the projects, the problem that I am having is that when the new records are added into the table from the first tab the listbox only updates with the new record when I close and reopen the form. I tried using the code below to requery the data when the tabs are changed but it's not working and I am only a novice at VBA so I don't even know if it is right. Please help, below is the code I was using to updated the listbox....

Registered Events not firing and visible in users Inbox
We have several Exchange 2000 environments and we have written an Exchange onSave event handler that is registered against a users Inbox to process all incoming mail. However, in one of our environments, the registration results in the event being visible in the users Inbox via OWA. We use regevent.vbs from the SDK and it works fine in all other environments. When the event is visible in the Inbox, it does not fire. Upon examining this item via the Exchange Explorer, we notice that:- - It appears as hidden by appending "(hidden)" to the end of the item name in the list of items. - ...

Detect Edit Box control
Hi, I need to know if the focus control is an Edit control (or RichEdit control). How do I do it ? Yoav. you can check it using its runtime class information, like: CWnd pEditCtrl = GetFocus(); if (pEditCtrl->IsKindOf(RUNTIME_CLASS(CEdit))) { //its CEdit } else { // its RichEdit } But Iam not sure how it will work if a pointer pEditCtrl is a temporary window. M. U�ytkownik "Yoavo" <yoav@cimatron.co.il> napisa� w wiadomo�ci news:uaSy2egrFHA.1172@TK2MSFTNGP11.phx.gbl... > Hi, > I need to know if the focus control is an Edit control (or RichEdit > con...

Event service attachments
Hi all, The bottomline of my goal is to read in an excel file send to a certain mailbox and save its content into a database. My first problem is how to read in the excel file without having to save it to disk. I know you can use writetofile to save the attachment on disk, however I would rather open it directly or save it into a stream and read into that stream. More over first I need to know for sure that the attachment is indeed of contenttype application/ms-excel. Any ideas? Cheers, ....Tim ...

Event ID: 9302
anyone knows what this means? The transport configuration type 1 for the directory entry with DN or GUID CN=MICROSOFT MTA,CN=PRMTL- SVRWEB,CN=SERVERS,CN=PROMTEL01,CN=ADMINISTRATIVE GROUPS,CN=PROMTEL PTY LTD,CN=MICROSOFT EXCHANGE,CN=SERVICES,CN=CONFIGURATION,DC=PROMTEL,DC=LOCAL is not one of the supported values. Reconfigure the transport configuration type in the identified directory entry. [BASE IL OPERATOR 23 217] (8) For more information, click http://www.microsoft.com/contentredirect.asp. hi, as per the kb: This warning message does not reflect any problems with Microsoft Exc...

Still event 9665 after applying /3GB switch and the USERVA setting in the Boot.ini file
We got Exchange Server 2003 with 2,5 Gb RAM. When rebooting Exchange Sever, I still have Event 9665 Warning (memory settings are not optimal). Anyone got a solution to this problem ? I followed Q815372 - How to Optimize Memory Usage in Exchange Server 2003.This is what I did: 1) Registry change - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager HeapDeCommitFreeBlockThreshold = REG_DWORD 0x00040000 2) Boot.ini change - /3GB switch and the USERVA setting added Thanks Jesper ...

List Listbox items in column by macro
Hi all, I got two listboxes on a spreadsheet and in those listboxes I got data like (see below) Listbox1 Listbox2 XX AA VV XX AA SS etc=85=85=85.. I need macro on a button which should match listbox1 items with listbox2 items and then list matched items one time in column A and list unmatched items as normal in column A. So the result in column A should look like as below A=85=85=85..col XX VV AA SS Please can any frined can help me on this. ...

event before application
I wanted to write some code when user opening the database. All the even bases on forms. The earliest event is form load. Are there any even at application level lile onApplicationLoad or onApplicationActivate even to wrong some code even before user opens the form? Your help is great appreciated, Souris wrote: >I wanted to write some code when user opening the database. All the even >bases on forms. The earliest event is form load. > >Are there any even at application level lile onApplicationLoad or >onApplicationActivate even to wrong some code even before user opens t...

how do i change controls from mouse 2 keyboard on Links LS pc game
HOW DO I CHANGE THE CONTROLS FROM MOUSE TO KEYBOARD ON THE LINKS LS GOLF GAME FOR THE PC? ALSO, ARE THERE ANY CHEATS? MANY THANKS DANIEL. boy are you in the wrong newsgroup. .. 1. Lower your caps. 2. What does this have to do with Publisher? -- JoAnn Paules MVP Microsoft [Publisher] "DANIEL" <DANIEL@discussions.microsoft.com> wrote in message news:8B86A4CC-3200-4CA7-AFEE-62BCB77043F5@microsoft.com... > HOW DO I CHANGE THE CONTROLS FROM MOUSE TO KEYBOARD ON THE LINKS LS GOLF > GAME > FOR THE PC? ALSO, ARE THERE ANY CHEATS? > MANY THANKS > DANIEL...

Right click mouse in CButton
Hi, I need to implement Right click mouse for simple CButton in CDialog. I Worte subclass to CButton and I implemented OnRButtonDown() , OnRButtonUp() functions . In the OnRButtonUp() I notify the parent dialog about this event and it works fine. The problem is how to change the button view (like usuall left mouse click) when the mouse right button pressed (down) and return it back when realeased (up) ?. VC++ 6.0 Thanks --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.717 / Virus Database: 473 - Release Date: 09/07/2004 ...

left/right scrolling with mouse wheel
Here's the problem side scrolling is not workign right. 1. split a spreadsheet vertically so you have left and right sides. 2. Pick a cell on the right side and using your mouse wheel side scroll. When my user does this the left split side scrolls, not the right one where he selected. I have used Detect and Repair to set Excel back to default settings with no luck. I have uninstalled and re-installed the Intellipoint 6.2 software for the mouse. I have tried 2 MS wireless mice. Any ideas? Ken If you freeze the left pane then the idea is that it is frozen for horizontal scro...

dropdown listbox
vb .net 2005 aspx I have a dropbox that is binded to a table i.e. ...... item = "New York " and Item value = "NY" in the If not ispostback I read an SQL table and use the State Item value to lookup the index in the dropbox and set the selectedindex . I tested this by making a list instead of binding to a table and it works. DDState.SelectedIndex = DDState.Items.IndexOf(DDState.Items.FindByValue(IsRecordReader("State"))) The only thing I can think of is that i perform the lookup and then the binding to the table occurs which makes my lo...

invalid names were detected in this workbook
Hi Please help me to rectify the problem. I have excel file created in office 2003 when I open the file in 2007 it prompt for an error message "One or more invalid names were detected in this workbook. Those invalid names have been changed to #REF " and when the file open the chart is not displayed properly. the file was open in compatibility mode. I tried also to save it in Excel 2007 but stil the chart is not displayed right. Please advice. Hi, You do not need to post twice to the same newsgroup, let alone between newsgroups. -- If this helps, please click the Yes butt...