Get Button ID at OnClickButton

I have a lot of buttons that when I clicked I want to do 
the same, just changing a little bit base on button's 
caption.
I set all button's OnClick to same method, so its only 
one OnCLickButton1 but my problem is how do I know which 
button send to this message, if I know which button was 
clicked i can get the text.

thanks in advance for your help,

Eduardo
0
Eduardo
9/11/2003 11:57:21 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
1739 Views

Similar Articles

[PageSpeed] 17

"Eduardo" <a@a.com> wrote in message
news:05a801c378c0$70aebe60$a401280a@phx.gbl...
> I have a lot of buttons that when I clicked I want to do
> the same, just changing a little bit base on button's
> caption.
> I set all button's OnClick to same method, so its only
> one OnCLickButton1 but my problem is how do I know which
> button send to this message, if I know which button was
> clicked i can get the text.

See if you can use the ON_CONTROL_RANGE message-map macro. This handler
function is passed the UINT id of the control sending the notification.
Otherwise, maybe you gould use GetCurrentMessage and parse the
LOWORD(wParam) yourself.

Jeff...


0
jeffp (1711)
9/12/2003 12:23:35 AM
Use GetFocus()->GetDlgCtrlID()

Say
if ((GetFocus()->GetDlgCtrlID()) == IDBUTTON1)
  AfxMessageBox("Button 1");

"Eduardo" <a@a.com> wrote in message
news:05a801c378c0$70aebe60$a401280a@phx.gbl...
> I have a lot of buttons that when I clicked I want to do
> the same, just changing a little bit base on button's
> caption.
> I set all button's OnClick to same method, so its only
> one OnCLickButton1 but my problem is how do I know which
> button send to this message, if I know which button was
> clicked i can get the text.
>
> thanks in advance for your help,
>
> Eduardo


0
Devikala (5)
9/12/2003 12:34:50 AM
This doesn't really solve anything. Where is the handler? The earlier suggestion of
ON_COMMAND_RANGE is the correct solution.
					joe

On Thu, 11 Sep 2003 17:34:50 -0700, "D.K." <Devikala@speakeasy.net> wrote:

>Use GetFocus()->GetDlgCtrlID()
>
>Say
>if ((GetFocus()->GetDlgCtrlID()) == IDBUTTON1)
>  AfxMessageBox("Button 1");
>
>"Eduardo" <a@a.com> wrote in message
>news:05a801c378c0$70aebe60$a401280a@phx.gbl...
>> I have a lot of buttons that when I clicked I want to do
>> the same, just changing a little bit base on button's
>> caption.
>> I set all button's OnClick to same method, so its only
>> one OnCLickButton1 but my problem is how do I know which
>> button send to this message, if I know which button was
>> clicked i can get the text.
>>
>> thanks in advance for your help,
>>
>> Eduardo
>

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)
9/15/2003 7:10:07 AM
Reply:

Similar Artilces:

To get fomula to display a Zero
I Have a foumula in G35 that takes the sum of 2 other cells(G32).This formula "=SUM(G32,-69.4*113/119)" in G35 generates a number when the sum in the cell G32 is 0, which is probably what I'm telling it to do. But in reality I would like G35 to display a "0" (Doing the formula on my calculator yields -65.9008 which is what excell G35 does.) I have tried using a fix that was supplied to me earlier. Can someone Help please? -- Geo =IF(G32=0,0,SUM(G32,-69.4*113/119) -- HTH RP (remove nothere from the email address if mailing direct) "Geo" <Geo@dis...

How do I get the macro "stop recording" tool bar back?
While recording a macro in excel (11.63...), I clicked the X (close button) and now can not get the "stop recording" macro tool bar to show. I would like to use the tool bar for the reference button. Hi choose tools / macro / record new macro click OK now display the stop recording toolbar (view / toolbars / stop recording) now click on the little blue square box and everything should be fine again when you next go to record a real macro Cheers JulieD "RBD04" <RBD04@discussions.microsoft.com> wrote in message news:67DA2DFF-6EA7-41CD-88B6-636B5B7A0C76@microsoft....

Any way to get around the 240-character line limit on text output?
I'm trying to save an Excel file into a fixed-length file for import into a mainframe and the biggest problem (as pointed out in another post on this board) is that there is a limit of 240 characters per line. This causes the rest of each line to be placed at the end of the file. My record layout length is around 300 and we're talking about 50,000 records. How can I get around the 240 character limit to save this file in an acceptable format? Otherwise it will take hours of work to get the file in the proper format. http://support.microsoft.com/default.aspx?scid=kb;en-us;13155...

get with the program!
I find it down right ludicrous and offensive as a web designer that MS has yet to get to the same CSS rendering standards as other major browsers such as Firefox, Chrome, and Safari. Why is it that when anyone designs a site, they always have to follow up with, "OK now what hacks do I need to put in place to make it look the same on IE?" You are single handedly setting back web design. I understand the desire to be different from other browsers, but it should NOT be in the way you render code. IE is a joke in the designer community. I wish you would just get in line on ...

Help on retrieving Machine ID
Hi All, I have a requirement, when I need to get the following information. 1. MAC Address. 2. HDD Serial Number 3. CD/DVD Drive Serial Number. 4. CPU Processor ID. I have my application in VC++ using MFC. Any help will be highly appreciated. Thanks, Sachin. "Sachin Bhave" <sachinbhave@rediffmail.com> wrote in message news:e3$U2XjiGHA.3408@TK2MSFTNGP05.phx.gbl... > Hi All, > > I have a requirement, when I need to get the following information. > > 1. MAC Address. > 2. HDD Serial Number > 3. CD/DVD Drive Serial Number. > 4. CPU Processor ID. >...

junk mail buttons
it seems my junk mail buttons are missing "THIS IS JUNK" any ideas? outlook 2003 windows xp Meg <meg(removeme)@yahoo.com> wrote: > it seems my junk mail buttons are missing "THIS IS JUNK" > > any ideas? > > outlook 2003 > windows xp There is no such button in Outlook. There is (on Actions>Junk E-mail) an "Add Sender to Block Sender List", but that's not the same thing as marking a message as junk. -- Brian Tillman [MVP-Outlook] Meg, I beleive Outlook 2007 is the only version of Outlook that has a 'Junk'/'N...

Why cant outlook get past my firewall
Facts.... Running Outlook 2003 via VPN (Checkpoint) and when I have my router/firewall hooked up Outlook cant see my exchange server Unplug the router/Firewall everything is fine..... I can authenticate to the VPN server my vpn client with the firewall, but Outlook just says..."Exchange Server Unavalible" Any thoughts? I have the same ezact problem....help Hi - you haven't quoted the original message in this reply, and I can't see the original message, so I don't know what you mean. Note - "me, too" posts aren't the best way to get help - if you c...

Click button enter current time
I am creating a form using Access 2003. One field on my form is Start. I would like to add a button next to this field so that when I click the button on the Form the current time will display in the field. Can you tell me what I need to do to the Start field in the table and the form where it exists in order to make this work? Teddy wrote: > I am creating a form using Access 2003. One field on my form is Start. I > would like to add a button next to this field so that when I click the > button on the Form the current time will display in the field. > >...

Creating some sort of button that will take you to a new worksheet
I am not so much of a new user, but use Excel so infrequently that I usually spend an entire day re-learning everything. I am using Excel 2002. My client is requesting I create a form in Excel. Everything was going well until I get to the request where they want some sort of button or something that will allow them to click it and automatically be taken to a new form (work sheet) if they click it. I am thinking it should go to the first cell enterable cell in the new worksheet. Any suggestions? Is this even possible? Do you want to move to another (existing) sheet, or do you want t...

i want notifier in outlook express , please help how can i get ?
i want notifier for new mail on my screen but i am unable to find the same . Ask in an Outlook Express group. This group is for Outlook, which has nothing to do with Outlook Express. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "raman sharma" <raman sharma@discussions.microsoft.com> wrote in message news:078E35DB-16E5-4840-81D1-52763D5C7AB4@microsoft.com... >i want notifier for new mail on my screen b...

ID of CFileDialog
Hi all, i am trying to find Resource ID of CFileDialog, what number is it? i can know this? Let me know if you can help me. Thanks Duy It is not a resource in your project. The dialog is created by Windows when you call GetOpenFileName / GetSaveFileName. -- Sheng Jiang Microsoft MVP in VC++ "James Duy Trinh" <vietdoor@gmail.com> wrote in message news:eOrRoVReIHA.1212@TK2MSFTNGP05.phx.gbl... > Hi all, > > i am trying to find Resource ID of CFileDialog, what number is it? i can > know this? > > Let me know if you can help me. Thanks > > Duy > ...

Open a form using a comand button on another form
By using a command button on a certain form I am oppenig an other form at a cetain record by using some criteria. I am using the command button wizard to do that. When the form oppens however, I want to be able to move to other records of the form record source. Is there an easy way to do that? Thanks in advance Michalis Instead of passing the criteria in the WhereCondition, pass it in OpenArgs instead. Then use the form's Load event to FindFirst in the RecordsetClone, and set the Bookmark. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http:/...

Wrong Vendor ID
One of the Vendor ID contains single quote(eg: MAMA'S) and purchasing T/B report is not generating when we include this vendor. Thanks This is either by design or a bug. My bets are on the latter. However, using quote symbols in fields is always a potential problem. Your best bet is to check with support to see if this is a bug. If it is, it won't cost you a support call. "JC" <anonymous@discussions.microsoft.com> wrote in message news:00b601c4ab00$7e4160a0$a401280a@phx.gbl... > One of the Vendor ID contains single quote(eg: MAMA'S) > and purchasing T/...

attachment gets garbled
When sending an attatchment with outlook e-mail, usually .pdf or .jpeg, it becomes garbled and ends up at the other end as a .dat file. any help would be greatly appreciated. "Greg" <gdmartin@mchsi.com> wrote in message news:04dc01c35097$9fa17bf0$a301280a@phx.gbl... > When sending an attatchment with outlook e-mail, > usually .pdf or .jpeg, it becomes garbled and ends up at > the other end as a .dat file. any help would be greatly > appreciated. Change your email format from "Rich Text" to either "HTML" or "Plain Text". -- Andrew ...

excel worksheets getting deleted in shared files on P4
Hi all I am using a workbook of 3 Mb on a network where I am using Excel 9 and MS Windows. File contains 32 worksheets for a month. Network trafic is more but th comp has 512 MB ram and uses some oracle app also. The files are sometimes shared and contains some 3d as well as arra formulas. The worksheets are getting deleted automatically when we are trying t save the file. What can be the possible reasons. Why do sheets ge deleted????? Thanx in advance Keda -- Message posted from http://www.ExcelForum.com ...

OnEraseBkgnd sometimes get NULL CDC* and then Screen of application goes black
Hi All, I have a application which use to erase background but some times I get parameter of the OnEraseBkgnd, CDC* as Null. Can you please let me know what needs to be done to fix this issue. Here is the code where I am facing problem BOOL CDailog2::OnEraseBkgnd(CDC *pDC) { // Sometime I get pDC==NULL if(pDC==NULL) return FALSE; CPen myPen ; CRect rect ; myPen.CreatePen(PS_SOLID, 1, RGB(210,224,234); CPen *oldPen = pDC->SelectObject(&myPen) ; GetClientRect(&rect); for(int i = 0 ; i <= rect.bottom;i++) { pDC->MoveTo(0, i); pDC->LineTo(rect.right, i); } pD...

Unique ID of an email? or how to identify them?
Hi, I once saw a fax-application that puts faxes as email in a pst-file, sends the ID of that email to a user, and than an application opens that specific email/fax on the screen of the user. I also would like to be able for my application to identify emails uniquely: where should I find this unique ID? Or is it based on other stuff like The sender and time of reception? Any help would be really appreciated. Thanks a lot, Pieter Pieter, For every unique ID is the Guid http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemguidclasstopic.asp I hope this...

Excel Save As getting "folder is read only" error.
I'm getting a "folder is read only" error when trying to use "save as" to save a file. I can use save as from another computer, logged in to the network the same without the error. The machine getting the error can copy and paste files to the folders without error, just happens when using the "save as" from the file menu. Is there someplace to change folder attributes that only office 2003 is using? OK, I've figured this one out myself. When using a Novell server and Office 2003, it would seem that it is necessary to use Novel Client 4.83 sp...

using sum button
I try pasting a bunch of numbers from a website into excel. Everything comes over fine, but when I try to sum the column using the sigma button, the result is just zero. Please help! I have a lot to sum. Thanks for your help. Adam sounds like the "numbers" are being pasted as text. That would probably be the case if trailing spaces are included in the copy. Regards Trevor "adam h" <anonymous@discussions.microsoft.com> wrote in message news:0a7601c3baac$b7e2c820$a001280a@phx.gbl... > I try pasting a bunch of numbers from a website into > excel. Ever...

Get PCI Bus/Function/Device Number
Hi All, Is there a way to get the PCI bus, function and device number on which my current driver is installed. I could only find bus number in DEVICE_REGISTRY_PROPERTY. I had used WdfDeviceQueryProperty to retrieve this data. How can I get the function and device number? Thank You. Regards, Sushma Sushma <sushma.yella@gmail.com> wrote: > >Is there a way to get the PCI bus, function and device number on which >my current driver is installed. Why? That information is not very useful. >I could only find bus number in >DEVICE_REGISTRY_PROPERTY. I h...

FrameWnd not getting WM_NCMOUSEMOVE
Hello everyone, I am implementing my own custom sizing functions for a child FrameWnd that has only the WS_BORDER style (no sizing border.) The problem is that this window does not receive a Non- Client Mouse Move message when the Left mouse button is pressed. It receives the message just fine as long as the button is NOT pressed, but not when it is. Now, as we know, the usual procedure for sizing a window is to press the mouse button when the pointer is over the Non-Client area, and then drag the window to the new size. But this makes it impossible if it doesn't receive a WM_N...

Add no. of days to a workday to get new workday?
Looking for a formula so I can add a number of workdays to an existing date to get the new workday (i.e. existing date + workdays = new workday). Here's an example: 1) Starting point: 4/15/10 2) Add: 4 3) Result: 4/21/10 (because it's 4 workdays after start date -- skipped weekend) Look in Help for details on the WORKDAY() function "blswes" wrote: > Looking for a formula so I can add a number of workdays to an existing date > to get the new workday (i.e. existing date + workdays = new workday). > > Here's an example: > 1) Starting po...

How to get rid of the update now extra sceen
When I perform and update now function in Money 2005, it pops up a warning screen that has a check box to "hide the pop up" on future runs of the function. This does indeed occur for subsequent runs on the same Money 2005 session, but if I close Money and re-open it, the box re-appears. How can I permanently get rid of the box. I assumed that this would be in the FAQ, but was unable to find it. Thanks Art McClinton Hi, there's a registry fix to remove it. It can be gotten from http://money.mvps.org/patches.aspx -- Glyn Simpson, Microsoft MVP - Money http://money.mv...

Getting Started Section in Office 2003
whenever I open an Office application like Excel, there is that section to the right 'Getting Started.' I am using Office 2003. this happens in Word as well. How can I remove them? I've looked in Tools > Options but wasn't able to find anything myself. I don't want them open when I intially open the application. Thanks in advance. Hi dsimoens! No need to post to more than one group. Press any key to continue on opening the file Make a couple of minor changes The save the file and re-open If created in an earlier version of Excel I think that saving will produce a di...

Publishing to Web
I published my website to web then uploaded the index.htm file and created directory for the index_files then uploaded all of the files created by Publisher 2003 to it. However, none of my graphics will display on the website. All that is displayed are the alternate text. The url for this is wsitinc.com Can some one help explain what I did wrong and where to put the graphics to get them to display? thanks! > I published my website to web then uploaded the index.htm > file and created directory for the index_files then > uploaded all of the files created by Publisher 2003...