| |

VerySource

 Forgot password?
 Register
Search
View: 686|Reply: 4

Function call problem, thank you

[Copy link]

5

Threads

17

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-3-12 09:00:01
| Show all posts |Read mode
In a button event, I want to call a custom function to trigger the event
Is this right thank you

void CListDlg :: OnBtnShow () // Button event
{
// TODO: Add your control notification handler code here
UpdateData (TRUE);
CListDlg Show;
Show.fun1 (); // fun1 is a custom function, responsible for displaying variables in the edit box
UpdateData (FALSE);

}
Reply

Use magic Report

0

Threads

3

Posts

0.00

Credits

Newbie

Rank: 1

Credits
0.00

 China

Post time: 2020-3-12 09:27:35
| Show all posts
MFC defines it for you, it's just the basic framework. What you do in the framework is up to you.
Reply

Use magic Report

0

Threads

14

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 Unknown

Post time: 2020-6-7 01:00:01
| Show all posts
reference:

void CMy1Dlg::OnButton1()//Button click event
{
   // TODO: Add your control notification handler code here
   fun();
}

void CMy1Dlg::fun1()
{
   CWnd *pWnd;
   pWnd=this->GetDlgItem(IDC_EDIT1);
   pWnd->SetWindowText("Hello!");
}
Reply

Use magic Report

0

Threads

14

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-6-7 09:15:01
| Show all posts
Sorry, there is a missing one above, as follows:
void CMy1Dlg::OnButton1()//Button click event
{
   // TODO: Add your control notification handler code here
   fun1();
}
Reply

Use magic Report

5

Threads

17

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

 Author| Post time: 2020-6-7 23:00:01
| Show all posts
Ok thanks
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list