Getting the mouse position #2

Hi,

I'm using a derived class, CMyListCtrl, derived from CListCtrl.

When the user right-clicks an item, I want to open a messagebox at the
location they clicked. How do I capture the mouse position? Norming
RButtonUp() has a CPoint argument, but OnRclick() does not.

What to do?

0
Hamish.Dean (174)
9/29/2006 12:16:38 PM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
369 Views

Similar Articles

[PageSpeed] 52

"hamishd" <Hamish.Dean@gmail.com> wrote in message
news:1159532198.011892.81980@m7g2000cwm.googlegroups.com...
>
> I'm using a derived class, CMyListCtrl, derived from CListCtrl.
>
> When the user right-clicks an item, I want to open a messagebox at the
> location they clicked. How do I capture the mouse position? Norming
> RButtonUp() has a CPoint argument, but OnRclick() does not.

GetMessagePos()?

-- 
Tim Ward
Brett Ward Limited - www.brettward.co.uk


0
tw2 (223)
9/29/2006 12:28:08 PM
> > I'm using a derived class, CMyListCtrl, derived from CListCtrl.
> >
> > When the user right-clicks an item, I want to open a messagebox at the
> > location they clicked. How do I capture the mouse position? Norming
> > RButtonUp() has a CPoint argument, but OnRclick() does not.
>
> GetMessagePos()?

Returns an integer?

Also, GetCursorPos does not seem to work either? Maybe I need to call
GetParent()->GetCursorPos()

0
Hamish.Dean (174)
9/29/2006 12:39:36 PM
> Also, GetCursorPos does not seem to work either?

GetCursorPos works fine. What exactly is the problem. Keep in mind that
it returns value in screen coordinates. Depending upon what you are
doing, you may need to convert this to client coordinates.

> Maybe I need to call
> GetParent()->GetCursorPos()

This  has no  meaning.


---
Ajay

0
ajaykalra (6842)
9/29/2006 1:39:38 PM
Take a look at these links:

http://msdn2.microsoft.com/en-us/library/3fyay5aa.aspx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/cursors/cursorreference/cursorfunctions/getcursorpos.asp

You might be able touse a context menu function as well OnContextMenu since 
you are doing a right click.  You would pop up your dialog instead of a 
menu.

http://msdn2.microsoft.com/en-us/library/a8ak6d0a.aspx

You can hook into WM_CONTEXTMENU using the wizard.

Tom

"hamishd" <Hamish.Dean@gmail.com> wrote in message 
news:1159532198.011892.81980@m7g2000cwm.googlegroups.com...
> Hi,
>
> I'm using a derived class, CMyListCtrl, derived from CListCtrl.
>
> When the user right-clicks an item, I want to open a messagebox at the
> location they clicked. How do I capture the mouse position? Norming
> RButtonUp() has a CPoint argument, but OnRclick() does not.
>
> What to do?
> 


0
tserface (3861)
9/29/2006 1:49:38 PM
I think what Ajay is referring to is you need to have a POINT to pass in a 
point to and the function fills it in:

POINT CursorPos;
GetCursorPos(&CursorPos);

Tom

"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message 
news:1159537178.178388.252770@m7g2000cwm.googlegroups.com...
>> Also, GetCursorPos does not seem to work either?
>
> GetCursorPos works fine. What exactly is the problem. Keep in mind that
> it returns value in screen coordinates. Depending upon what you are
> doing, you may need to convert this to client coordinates.
>
>> Maybe I need to call
>> GetParent()->GetCursorPos()
>
> This  has no  meaning.
>
>
> ---
> Ajay
> 


0
tserface (3861)
9/29/2006 2:06:12 PM
> You might be able touse a context menu function as well OnContextMenu since
> you are doing a right click.  You would pop up your dialog instead of a
> menu.
>
> http://msdn2.microsoft.com/en-us/library/a8ak6d0a.aspx
>
> You can hook into WM_CONTEXTMENU using the wizard.

This is perfect. Thanks.

0
Hamish.Dean (174)
9/29/2006 2:08:29 PM
Reply:

Similar Artilces:

Have Outlook 2000. How do I get rid of spam?
I need step by step directions because I don't know the termenology. When we open Outlook it comes up under my husband's e-mail. Then I Open mine. He is not spamed. I get hundreds each day. HELP! winnieB <winnieB@discussions.microsoft.com> wrote: > I need step by step directions because I don't know the termenology. > When we open Outlook it comes up under my husband's e-mail. Then I > Open mine. He is not spamed. I get hundreds each day. HELP! Step by step: 1) Open Internet Explorer. 2) Browse to http://spambayes.sourceforge.net/ 3) Downoad SpamBaye...

parsing a date and time field #2
I am having trouble parsing the date and time in a field. I download data from a data base and the date and time come together in one field. I want to seperate the two. The date and time comes across as the following: "2/1/2009 14:37" in the cell. When I parse it, it seperates into three columns as follows: "2/1/2009", 2:37 AM", and "PM" I can see what is going on but I would like to get two columns with one as the date and the other as the correct time. are they any ideas on how to address this? Try using the TimeValue and DateValue functions. First format ...

Money Central Portfolio #2
My print function has gotten corupted. When I print it flips to WORD / format and prints in a format that is 4x normal. ...

macro #2
I am pretty new to using (or attempting to use) a Macro in a workbook. I am having trouble following how and what to do to even start the process; ie If there needs to be a worksheet already in progress or can I start from a new sheet. THEN where to go from there. Can I have some help in this area? Can some one supply me with a sample MACRO? Any help would be greatly appreciated Dan The best way to get started with macros is to use the Macro Recorder. Go to the Tools menu, choose Macros, then Record New Macro. Then, carry out some simple tasks and examine the code that is produced. ...

merging 2 cells without losing data?
How can I merge 2 cells without losing data from the other cell? Hi Bob Not possible I'm afraid. Try placing the dat from both cells into one and use "Center across selection" under Format>Cells>Alignment Merge cells always end up causing grief. they are best avoided. ***** Posted via: http://www.ozgrid.com Excel Templates, Training & Add-ins. Free Excel Forum http://www.ozgrid.com/forum ***** "bob" <bobree@hotmail.com> wrote in message news:%23JuOM9HGEHA.2308@tk2msftngp13.phx.gbl... > How can I merge 2 cells without losing data from the other...

Statements #2
How are statements sorted? Alphabetically by name or by account number? Does anybody know? -- Any help is appriciated, Deb Mine are done alphabetically by name. -- Elizabeth M. "Deb" <Deb@discussions.microsoft.com> wrote in message news:D58FEF32-7509-473B-A554-6A48E02697CF@microsoft.com... > How are statements sorted? Alphabetically by name or by account number? > Does > anybody know? > -- > Any help is appriciated, Deb ...

how to config Server for one user which has 2 mail address.
we have one NT4.0 + Exchange 5.5 Server "A" Email abc@xxx.com.cn ��and another windows2003 + exchange 2003 Server "B" abc@cn.xxx.com user name is same in A B��Mx record was be set ,question is how to config Exchange 2003 to receive down the mail to Server A , because of we need to replace A with B. thanks a lot. E2K3 setup guides you through common scenarios (like yours) pretty much holding your hand - on welcome screen tell it that you have existing E55 org and want to join it, then follow on-screen instructions. Having usable backup of Exchange databases and AD i...

Getting contents of adjacent cells
I want to divide the y1-axis column and save it to radius (y1/2) column. How do I do that? x-axis y1-axis radius(y1/2) 0 0.00 8.0000 1 0.25 8.0242 2 0.50 8.0691 3 0.75 8.1281 4 1.00 8.1989 5 1.25 8.2803 6 1.50 8.3716 7 1.75 8.4729 8 2.00 8.5832 hi divide the y1-axis by what? 2 as an guess with y1-axis in column c in the y1/2 column(d?), enter =C2/2 copy down. regards FSt1 "Rocky" wrote: > I want to divide the y1-axis column and save it to radius (y1/2) column. How > do I do that? > > x-axis y1-axis radius(y1/2) > 0 ...

Macro
Here is one for you experts - I am a novice I want to add a macro to a worksheet that will print selected information held on certain rows of the worksheet. Once the 'button' has been selected a mesage box will pop up asking the user to input which row number he/she wishes to print. On input that number is matched to the corresponding row of the worksheet and that row is copied (without any formula - just cell values) and pasted into another worksheet where it is placed into other formats and printed. Seems like a simple(!!) job - but far to difficult for me to programme Can an...

Getting font properties
I have a LOGFONT - complete with all desired properties including face name. I use CFont::CreateFontIndirect() to create a font. If the font I have specified is not available on my machine then it uses the nearest available in some appropriate sense. So far so good. But CFont::GetLogfont() just returns me the LOGFONT which I used to create the font, and not the one it actually adopted - in particular as regards face name. Is there an easy way to get the face name of the font it actually used? Dave -- David Webber Author MOZART the music processor for Windows - http://www.mozart.co.uk...

Sum amount if = 2 value's
I have a spreadsheet of payment types for which I want to sum the tota amount per type per month A B C Type Amount Month I'm able to get the total amount per type by usin =SUMIF(A:A,"TYPE",B:B), but can't work out how to get a total for eac type each month Somthing along these lines: =SUMIF((A:A,"TYPE",B:B)&C:C,"MONTH")) ???? Any idea's -- loscherlan ----------------------------------------------------------------------- loscherland's Profile: http://www.excelforum.com/member.ph...

Excel pivot table #2
i encountered an error in my pivot table. i created an olap cube using the analysis manager. the cube displays the correct data of my measures but on my pivot report, it displays #N/A.... i need help to fix this one... thanks.... =) ...

Outlook Express 6 Spell Check #2
I am using Outlook Express 6 on Windows XP, and I have a problem with spell check. When you send an email, it says "spell check has been haulted, do you want to send anyway" and if I ask it to spell check, it says an error has occured in spell check. All my spelling options are correctly set, so I don't know what the problem is. Kimberly McNabb <knmcnabb@hotmail.com> wrote: > I am using Outlook Express 6 on Windows XP, and I have a > problem with spell check. Ask in an Outlook Express newsgroup. -- Brian Tillman ...

Where can I get a good holiday booking form for my golf business?
I need a quality Booking Form for my Golf Holiday business on the Costa Del Sol. One which includes sections for accommodation, dates, numbers, flight enquiries and car hire enquiries. Any help would be much appreciated on a tight budget. Thanks Dave Wrong forum. Try templates or doing it yourself. :-) -- Russell Dawson Excel Student Please hit "Yes" if this post was helpful. "Dave" wrote: > I need a quality Booking Form for my Golf Holiday business on the Costa Del > Sol. > One which includes sections for accommodation, dates, numbe...

Database #2
Hi I'm new to Outlook. I hear of an Outlook database in other threads. Is this synonymous with the ..pst or .ost files people mention? Does it corrupt often and if so are there tools to repair it? Regards Craig. There's a utility called ScanPST.EXE that will scan and attempt to repair the file. Yes, typically when a user says Outlook database they're referring to their PST file "Craig Roberts" <craigroberts@jkr.co.uk> wrote in message news:C4C8E141.211DE%craigroberts@jkr.co.uk... > Hi > > I'm new to Outlook. > > I hear of an Outlook d...

unique with 2 columns
I have 2 columns with duplicates in the first column and no duplicates in the second. I neeed to only see one value for each in the left and only one of the accounts from the right. ie: abc 1234 abc 12345 bcd 251 eft 600 eft 607 I would like to see either of the abc with the 1234 or 12345 I would like to see the bcd since it's individual with the 251 I would like to see either of the eft with the 600 or the 607 Use a totals query and one of the aggregate functions (First, Last, Min, or Max) on the...

Excel number formatting #2
I receive spreadsheets with separate columns of numbers and text. The problem is that the numbers column is not in number or general format (when sorting behaves like text). Is there a way to turn those columns into numbers (except stepping into each one separately)? When I just highlight the number in the cell and hit enter, the cell automatically becomes numeric (I'm looking for a more global solution). Thanks, A You can do this: 1. Type 1 (the number 1) into a blank cell. Highlight this, select Edit, Copy. Now highlight entire column(s) that you want changed to numeric, and sel...

host unreachable #2
hi, if i send a email with a wrong address or mispelled it, i don't get a message that the address, destination is wrong until 4 days later after being deletedj from the outgoi queue im using E5,5 sp4 thks Is that for all domains, even for Yahoo and Hotmail? Rick wrote: > hi, > > if i send a email with a wrong address or mispelled it, i > don't get a message that the address, destination is wrong > until 4 days later after being deletedj from the outgoi > queue > > im using E5,5 sp4 > > thks ...

Frame window does not get displayed properly
Hi All, I have a Dialog based applciation. I want to create a Frame window when clicked on the button on Dialog. The problem is I handled the Painting of the dialog (I draw a picture on so WM_PAINT message I handle.) but doing this I am not able to draw the frame window properly. It appears to be transparent to me . I am setting the CFrameWnd to be the child of CDialog Please Can you let me know how to draw the farme window of how can I have a floting window on a dialog. Thanks Anup I don't know if what you are doing is a good idea. But if you want to have a floating window ins...

Closing Excel #2
I have inherited an App desigend by an ex employee Sometimes the program leaves Excel in the task manager The programe uses various routines and calling various functions that define Excel sheets etc (badly named) I'm finding it hard to follow (my 1st experince of .NET) is there a way to KILL any Excel instence when exiting the program. I have come across some posts about GC (garbage collection) like this System.Runtime.InteropServices.Marshal.ReleaseComObject(oXLWsheet) oXLWsheet = Nothing 'System.Runtime.InteropServices.Marshal.ReleaseComObject(oXLWs) oXLWs = Nothing oBook.Clos...

hidden transactions #2
I have a problem with account balances: the balance for checking is way off on the hiome page than in the account register view. When I tried to find out why, I got some greyed out transaction when I went from bill schedule through right click to payee. This transaction cannot be changed or deleted, but in total all such transactions made up the difference in balance. Any suggestions? Oscar -- Elvart In microsoft.public.money, elvigor wrote: >I have a problem with account balances: the balance for checking is way off >on the hiome page than in the account register view. When I ...

Stats/PivotTables #2
I have to produce stats from data exported as a CSV file from a piece of custom made software we use here. The data displayed in Excel looks like this: 01/04/2003 05:31 Dr JESSICA STROUDLEY 01/04/2003 08:56 Dr JESSICA STROUDLEY 01/04/2003 11:16 Dr JESSICA STROUDLEY 02/04/2003 11:42 Dr JESSICA STROUDLEY 02/04/2003 05:31 Dr JESSICA STROUDLEY 02/04/2003 08:56 Dr JESSICA STROUDLEY 03/04/2003 11:16 Dr JESSICA STROUDLEY 03/04/2003 11:42 Dr JESSICA STROUDLEY I have to produce a spreadsheet saying how many examinations were done by a particular doctor over a certain timespan. Each date li...

How did I break the cell display limit? #2
If there is anyone out there who can help with this, I would be most most grateful. Here's the facts: - I'm working in a MS Excel worksheet. - I am aware of Excel's 255-character-per-cell display limit. (As understand it, each cell can hold up to 32,000 characters, but wil only display/print 255 characters.) This is a major pain in th petunski, as most of my cells contain more than 255 characters Therefore, most of my spreadsheet shows cells that look like this ###############. I have to look in the formula bar to see the actua contents of each cell. - In cell C35, I have 1,05...

OWA Setup Questions #2
Hi All, I am attempting to install the newly released owaadmin tool. My IIS server currently hosts 3 websites all of which are published to their own urls via host headers all of the sites are using ssl. When Installing the owaadmin tool, it creates a new "Default Web Site" as the orginal "Default Web Site" has been renamed. The new "Default Web Site" contains only the files and path names pointing to "%systemroot%\Program Files\Outlook Web Access Administration" what I am doing is removing this new "Default Web Site" site using the I...

Excel chart linked in Word gets formatted when updateing.
Hi, I have a bit of an annoying issue with excel and word 2007, I have a Chart in excel, and the text on the horizontal axis is rotated 270 degrees,This Chart is linked in a Word document and when i do an update of the linked chart the text gets all messed up. Both of the files are saved in 97-2003 format. ...