Get CtrlID from Msg info at WM_LBUTTONUP

Hi all,

We can get CtrlID from msg info at WM_LBUTTONUP event? In Msg info, we can 
get Handle of Ctrl, but i dn't know how  to get CtrlID.

any one know, please me know, thanks very much. 


0
vietdoor (39)
11/22/2007 6:06:28 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
406 Views

Similar Articles

[PageSpeed] 1

Used function below, it works

int GetCtrlID(HWND hWnd)
{
 CWnd* pChild = CWnd::FromHandle( hWnd );

 pChild->FromHandle(hWnd);
 return pChild->GetDlgCtrlID();
}

"James Duy Trinh" <vietdoor@gmail.com> wrote in message 
news:ORP3U3MLIHA.1168@TK2MSFTNGP02.phx.gbl...
> Hi all,
>
> We can get CtrlID from msg info at WM_LBUTTONUP event? In Msg info, we can 
> get Handle of Ctrl, but i dn't know how  to get CtrlID.
>
> any one know, please me know, thanks very much.
> 


0
vietdoor (39)
11/22/2007 6:22:33 AM
This seems unnecessarily complex.  If you have a handler, you can simply call

	ctl->GetDlgCtrlId();

If you have an HWND (and why do you have only an HWND?) you can do
	return ::GetDlgCtrlId(hWnd);
and you don't need to create a lot of ::FromHandle objects.  I don't even understand what
the  second FromHandle accomplishes, since the result is not stored anywhere.  Since
FromHandle is a static method, there is no reason to write pChild-> anyway.

The code below seems to do nothing useful along the way; a simple ::GetDlgCtrlId() would
have worked just fine.


On Thu, 22 Nov 2007 13:22:33 +0700, "James Duy Trinh" <vietdoor@gmail.com> wrote:

>Used function below, it works
>
>int GetCtrlID(HWND hWnd)
>{
> CWnd* pChild = CWnd::FromHandle( hWnd );
>
> pChild->FromHandle(hWnd);
> return pChild->GetDlgCtrlID();
>}
>
>"James Duy Trinh" <vietdoor@gmail.com> wrote in message 
>news:ORP3U3MLIHA.1168@TK2MSFTNGP02.phx.gbl...
>> Hi all,
>>
>> We can get CtrlID from msg info at WM_LBUTTONUP event? In Msg info, we can 
>> get Handle of Ctrl, but i dn't know how  to get CtrlID.
>>
>> any one know, please me know, thanks very much.
>> 
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
11/22/2007 6:34:26 AM
Show the exact code.  Where is the WM_LBUTTONUP event being handled?  The simple answer is
that for the raw WM_LBUTTONUP message, as the documentation explicitly states, the LPARAM
is the control ID.

Without knowing the context of the code, the question has no answer.  Explain your
problem, don't ask in terms of a message you will never see.
					joe

On Thu, 22 Nov 2007 13:06:28 +0700, "James Duy Trinh" <vietdoor@gmail.com> wrote:

>Hi all,
>
>We can get CtrlID from msg info at WM_LBUTTONUP event? In Msg info, we can 
>get Handle of Ctrl, but i dn't know how  to get CtrlID.
>
>any one know, please me know, thanks very much. 
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
11/22/2007 6:36:41 AM
Reply:

Similar Artilces:

Reliable way to get window underneath mine?
What is a reliable way to get the window underneath mine? Say that my window is "Window A"... "Window A" is being dragged around the screen by its title bar. The mouse cursor is at x,y. I need to know if I can drop it on the window thats at x,y (not counting "Window A"). So I need to get this window handle somehow. WindowFromPoint() obviously gets "Window A". I'd rather not enumerate all the windows since that seems like a performance issue. Thanks. Somebody wrote: > What is a reliable way to get the window underneath mine? > > Say tha...

CSliderCtrl -- can't get TB_THUMBTRACK
Hello, I added a CSliderCtrl to a dialog using the Resource editor, but to my surprise there is no way in the Class Wizard to add a callback for TB_THUMBTRACK, so that I can have my app do something when the user moves the "tic". I'm prevented from adding that message to the paltry list of 3 default usable messages. Can someone explain how to get around this unexpected problem? Thanks. All of the messages that are related to a CSliderCtrl being changed come through as with a WM_HSCROLL message. void CMyDlg::OnHScroll(UINT nSBCode, UINT nPos,CScrollBar *pScrollBar) { if (...

Is it possible to get text values in a pivot table?
From this: ROW COL VAL A HD1 X B HD2 Y B HD1 Z C HD3 J A HD3 Z B HD3 R C HD1 S Get this? Var of VAL COL ROW HD1 HD2 HD3 A X Z B Z Y R C S J (If 2 rows go to same cell, would need to get maximum or first). Not with Pivot Table Let you A, B C data be A1:A7, the HDn data in B1:B7 and the other data in C1:C7 In some convenient place (I use A11) enter =A1&B1 and copy down the column (you could put this in another sheet or in a hidden column) Make the heading HD1, HD2 - I did this in F1:H1 and the row ...

Credit Card Info
I want to feed credit card info from another SQL table into GP 8.0. The external credit card info is already associated to a SOP number by different process integration. Where is the credit card info located or is it spread out across different tables? Can I add this info directly to the table? Thanks in advance. You could achieve this using VBA to access the SQL table directly. Lookup the sample applications and look for demos of using ADO, SQL and RetrieveGlobals.dll. David Musgrave [MSFT] Senior Development Consultant Escalation Engineer MBS Support - Asia Pacific Microsoft Business ...

Get $500 to your PAYPAL Account by just one CLICK #2
i have hidden the form of getting $500 to your PAYPAL ACCOUNT....CLICK on the IMAGE which is on the RIGHT SIDE of the website http://tricks-4u.4-all.org/ ...

can't get "sum" to add up properly
Hi, I'd appreciate any help with my problem. I have the following A B C 1 Benefit Coverage Amount Monthly Premium 2 Employee Life .21/$1,000 $67,000.00 $14.07 3 Dependent Life (if applicable) family $2.00 4 Employee AD&D .04/$1,000$67,000.00 $2.68 5 LTD 2.58/100 $1,529.00 $39.45 6 Dental family 47.86 7 Health family 48.90 8 EAP (if applicable) yes $2.20 9 ...

can i create formula giving totals based on financial & text info
Am i able to create a formula that gives me monetray totals for expenditure on hotels, split into totals for 6 varying business sectors? ...

Outlook does not display all contact info...
I have MS Outlook 2002 on XP - and for some reason, not all of the information I have entered for a particular contact is automatically displayed - I have to actually open up the contact and get the info. Seems odd... and I have searched through the options, etc... but I haven't had any luck. Thanks in advance for the help. -Lee What view setting are you using on the contacts folder (View | Current View)? You may want to experiment with all the default views to see if any of them suit your needs, and if not, you can always create a custom view. -- Jocelyn Fiorello MVP - Outlook **...

Outgoing msg header problem
Having recently switched to Outlook 2003 for my mail, I can't send mail to certain mailing lists (they bounce)... msgs to private receipients appear to arrive ok. Contact with my ISP reveals "This can be caused by a malformed header in the message you are trying to send." Checking in Outlook > any outgoing msg > right click > Options, I find that the 'Internet headers' of all my outgoing msgs are blank. Could that be the problem? Does anyone know how to solve this? Thanks, Astrid ...

Ref Transfering Info from a table
I don't know if I'm asking the impossible here but I'll give it a try. I have a excel program which I am trying to set up a function whereby it will create a work rota based on a shift pattern. It currently will create a table with staff names on it and there shift pattern for a given week. What I am trying to do is let the user select shift pattern 1 for example and have excel transfer this onto the rota but place the name instead of shift in the appropriate shift. ie If I select shift 1 it will place name A onto the early shift and place A on the Day off line whi...

Problem with getting warning banner message working in OWA
We are using Exchange 2003 with a front-end & back-end server setup and using forms based authentication. Has anyone successfully implemented a Warning banner for OWA that users have to click the OK button before getting to the login page? I have tried out the steps provided at http://www.somorita.com/E2K324seven/Ch21-OWA-WarningBanner.doc but the warning banner still doesn't show up. Would greatly appreciate if anyone has implemented could provide any information to get this working. Thanks in advance. Mark While you are looking at the logon page in IE, use the View/Source...

Email can not get through between two domains
I am new to Exchange. Sorry for stupid questions. This is my question: An office used to have an Exchange 5.5 box to manage emails for two companies A.com and B.com. Just add a new Windows SBS 2003 for A.com. Now, the SBS 2003 server is managing emails for both A.com and B.com (did by following http://support.microsoft.com/?kbid=260973). That is, a connector is created in the new server to deliver mails to B.com. After that, users at B.com can not send email to A.com users. But A.com user can send email to B.com and users in both companies can send and receive email from outside. When user...

How can I get AutoShapes to "chase" in PowerPoint?
I am told that it is possible to have AutoShapes chase each other in a straight line and around curves (like through a pipe) but I can't figure out how. You need to use a motion path. There's an example here http://www.pptalchemy.co.uk/PowerPoint_Motion_Path.html -- john ATSIGN PPTAlchemy.co.uk Free PPT Hints, Tips and Tutorials http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html "John-Novatec" wrote: > I am told that it is possible to have AutoShapes chase each other in a > straight line and around curves (like th...

How do get the years and days Between two dates
if you had 5/1/2006 and 2/28/2002 how would you get 4.17? If 5/1/2006 is in A1 and 2/28/2002 is in A2, then maybe: =(a1-a2)/365 or =(a1-a2)/365.25 But if you're trying to find differences between dates, you may want to take a look at =datedif(). You can find lots of info at Chip Pearson's site: http://www.cpearson.com/excel/datedif.htm (=datedif() was only documented in xl2k's help.) jhon doe wrote: > > if you had 5/1/2006 and 2/28/2002 how would you get 4.17? -- Dave Peterson ...

Info store Defrag
What is the best/safest way to defragment my exchange 2000 databases? 328804 How to Defragment Exchange Databases http://support.microsoft.com/?id=328804 -- Michael Barta [MSFT] Microsoft Exchange Support Please do not send e-mail directly to this alias. This alias is for newsgroup purposes only. This posting is provided "AS IS" with no warranties, and confers no rights. "chellea" <eric@putnamcompany.com> wrote in message news:O7q6Fdm8DHA.712@tk2msftngp13.phx.gbl... > What is the best/safest way to defragment my exchange 2000 databases? > > ...

How to get the Network Utilization?
In the Task Manager of Windows System, we can see the Network Utilization of the local connection. But how to get the percentage through my own program? Thanks in advance! ...

Block all .info email
Using Outlook 2003, is there any way to setup the Blocked Senders function so that ALL incoming email from any .INFO domain is marked as Junk and sent to the Junk Mail folder? Thanks, David David Lipetz <dlipetz@hotmail.com> wrote: > Using Outlook 2003, is there any way to setup the Blocked Senders > function so that ALL incoming email from any .INFO domain is marked > as Junk and sent to the Junk Mail folder? You can create a rule that looks for ".info" in the headers and moves any matching messages to the Junk E-mail folder. -- Brian Tillman Yes, but ru...

Queue info slow to load
We're using two front-end gateway servers that route email to and from the Internet, and also to internal routing and admin groups (a "hub and spoke" topology). They're more or less identical and are setup to load balance email traffic. Both are Ex2k3 on Win2k3 with all the latest service packs and updates. The back-end environment is Ex2k/Ex2k3 mixed mode. When i look at the queues for either front-end server by going through their local Exchange Administrator, one server takes a loooong time to load (a minute or more), while the other one loads the same informatio...

How to get weekly open high low close from a range of data?
Hello, I've set up a spreadsheet to download mutual fund prices daily from a certain website and have stored up quite an amount of data already. Now I want to use this data to produce weekly candlestick charts, so I need to get the weekly open, high, low, close from the data. The easiest way I can think of in general is to use a GROUP BY query to extract all such data from the data range, but I don't know how to set up such a query in Excel. Anyone out there can tell me? Thank you very much. Herbert if you have daily dates in column a, and the open, hi, lo, close i columns b-e...

Simple Javascript to get the current CRM user
I'm looking to add an OnChange event to restrict changes to a certain picklist field in the Account table. Simple logic, except I can't seem to figure out who the current user is... This has to be a simple one for you JavaScript jocks, and I'd really appreciate your saving me hours... Many thanks, Dave ...

Error msg. "Failed to grant access to regenerated view" when adding field to schema using deployment mgr.
Hi, I'm running into a error simply creating a new field in the schema for LEADS. The error tells me to go to the event viewer, which in turn tells me the following: Failed to grant access to the regenerated view Lead after inserting new attribute CFSepassword. Is the system trying to add the field to a view in addition to the table? How can I proceed with this? Any help would be appreciated. Phillip ...

Macros get disconnected
Hi All I would be very grateful for a little guidance over an issue that is puzzling me. I have a template with a number of macros attached. When I send the template by email to my co-worker, some of the macros don't appear on the form field's "Run macro on Entry or Exit". The macros do appear, however, in the Visual Basic editor. The template works perfectly well, until it is unprotected an edited. Thereafter, those form field that have "lost" the macro name/limk from their form fields don't work anymore. So, as long as the macros in the templ...

I need to get week start and week end dates to change automatically
I'm trying to get the week start and week end dates to chang automatically on a time sheet that I am working on. Anybody have formula? Joh -- Message posted from http://www.ExcelForum.com John, =INT(NOW()+2-WEEKDAY(NOW())) will return Monday's date, and =INT(NOW()+6-WEEKDAY(NOW())) will return Friday's date. Format as dates. HTH, Bernie MS Excel MVP "jlyons360 >" <<jlyons360.192pxt@excelforum-nospam.com> wrote in message news:jlyons360.192pxt@excelforum-nospam.com... > I'm trying to get the week start and week end dates to change > automa...

Simple hack to get $500 to your home. 06-03-10
Simple hack to get $500 to your home at http://dailyupdatesonly.tk Due to high security risks,i have hidden the cheque link in an image. in that website on left side below search box, click on image and enter your name and address where you want to receive your cheque.please dont tell to anyone. ...

where do i get info on how to use excel?
i don't have a manual or anything. can i buy one? is there a college course or something? hi, all of the above. most good book stores with have an excel for dummys book. microsoft site has books for all version. college course tend to be generic and way too short. books are better. and cheaper. the net is a good source too. try these sites http://www.mvps.org/dmcritchie/excel/excel.htm#tutorials http://www.j-walk.com/ss/books/xlbook25.htm http://www.cpearson.com/excel/KeyboardShortcuts.htm http://www.contextures.com/ http://www.mrexcel.com http://www.rondebruin.nl/ and you can hang ar...