c 學習之路 dialog

2021-05-28 11:00:10 字數 4678 閱讀 3769

testdlg.h
#if !defined(afx_testdlg_h__27b71158_bb67_4588_ab06_f01281624513__included_)

#define afx_testdlg_h__27b71158_bb67_4588_ab06_f01281624513__included_

#if _msc_ver > 1000

#pragma once

#endif // _msc_ver > 1000

// testdlg.h : header file///

// ctestdlg dialog

class ctestdlg : public cdialog

; cedit m_edit3;

cedit m_edit2;

cedit m_edit1;

int m_num1;

int m_num2;

int m_num3;

//}}afx_data

// overrides

// classwizard generated virtual function overrides

//}afx_virtual

// implementation

protected:

// generated message map functions

//}afx_msg

declare_message_map()

private:

bool m_biscreate;

cbutton m_btn;

};//}

// microsoft visual c++ will insert additional declarations immediately before the previous line.

#endif // !defined(afx_testdlg_h__27b71158_bb67_4588_ab06_f01281624513__included_)

testdlg.cpp
// testdlg.cpp : implementation file

//#include "stdafx.h"

#include "mybole.h"

#include "testdlg.h"

#ifdef _debug

#define new debug_new

#undef this_file

static char this_file = __file__;

#endif

/// ctestdlg dialog

ctestdlg::ctestdlg(cwnd* pparent /*=null*/)

: cdialog(ctestdlg::idd, pparent)

}afx_data_init

m_biscreate=false;

}void ctestdlg::dodataexchange(cdataexchange* pdx)

}afx_data_map

}begin_message_map(ctestdlg, cdialog)

//}afx_msg_map

end_message_map()

/// ctestdlg message handlers

void ctestdlg::onbtnadd()

else

*//* if(!m_btn.m_hwnd)

else

*//* int num1,num2,num3;

char ch1[10],ch2[10],ch3[10];

getdlgitem(idc_edit1)->getwindowtext(ch1,10);

getdlgitem(idc_edit2)->getwindowtext(ch2,10);

num1=atoi(ch1);

num2=atoi(ch2);

num3=num1+num2;

itoa(num3,ch3,10);

getdlgitem(idc_edit3)->setwindowtext(ch3);*/

/* int num1,num2,num3;

char ch1[10],ch2[10],ch3[10];

getdlgitemtext(idc_edit1,ch1,10);

getdlgitemtext(idc_edit2,ch2,10);

num1=atoi(ch1);

num2=atoi(ch2);

num3=num1+num2;

itoa(num3,ch3,10);

setdlgitemtext(idc_edit3,ch3);*/

/* int num1,num2,num3;

num1=getdlgitemint(idc_edit1);

num2=getdlgitemint(idc_edit2);

num3=num1+num2;

setdlgitemint(idc_edit3,num3);*/

/*updatedata();

m_num3=m_num1+m_num2;

updatedata(false);*/

/* int num1,num2,num3;

char ch1[10],ch2[10],ch3[10];

m_edit1.getwindowtext(ch1,10);

m_edit2.getwindowtext(ch2,10);

num1=atoi(ch1);

num2=atoi(ch2);

num3=num1+num2;

itoa(num3,ch3,10);

m_edit3.setwindowtext(ch3);*/

/* int num1,num2,num3;

char ch1[10],ch2[10],ch3[10];

//::sendmessage(getdlgitem(idc_edit1)->m_hwnd,wm_gettext,10,(lparam)ch1);

//::sendmessage(m_edit1.m_hwnd,wm_gettext,10,(lparam)ch1);

//getdlgitem(idc_edit1)->sendmessage(wm_gettext,10,(lparam)ch1);

m_edit1.sendmessage(wm_gettext,10,(lparam)ch1);

m_edit2.sendmessage(wm_gettext,10,(lparam)ch2);

num1=atoi(ch1);

num2=atoi(ch2);

num3=num1+num2;

itoa(num3,ch3,10);

m_edit3.sendmessage(wm_settext,0,(lparam)ch3);*/

int num1,num2,num3;

char ch1[10],ch2[10],ch3[10];

senddlgitemmessage(idc_edit1,wm_gettext,10,(lparam)ch1);

senddlgitemmessage(idc_edit2,wm_gettext,10,(lparam)ch2);

num1=atoi(ch1);

num2=atoi(ch2);

num3=num1+num2;

itoa(num3,ch3,10);

senddlgitemmessage(idc_edit3,wm_settext,0,(lparam)ch3);

senddlgitemmessage(idc_edit3,em_setsel,0,-1);

m_edit3.setfocus();

}void ctestdlg::onnumber1()

else }

void ctestdlg::onbutton2()

else

static crect rectlarge;

static crect rectsmall;

if(rectlarge.isrectnull())

if(str=="收縮<<")

else }

void ctestdlg::onok()

wndproc prevproc;

lresult callback winsunproc(

hwnd hwnd, // handle to window

uint umsg, // message identifier

wparam wparam, // first message parameter

lparam lparam // second message parameter

) else }

bool ctestdlg::oninitdialog()

android學習之路3 dialog使用

首先我們來看最簡單的dialog使用 使用系統預設的對話方塊 basealertdialog.builder builder new basealertdialog.builder this builder.setmessage 確定退出當前登入賬號嗎?setpositivebutton 確定 ne...

C 學習之路

由淺入深 錢能的c 程式設計或thinking in c 中文版就不要看了 c primer effective c more effective c exceptional c more exceptional c 看完這幾本書開始coding 最好跟乙個比較大的專案 同時自己用c 來重做資料結構...

C 學習之路

經過近半個月的時間,完成了 完善 答辯,近來無事,是時候鞏固一下c 了 就只記得三個特徵 封裝 繼承 多型,僅此而已,像模板 stl已經忘光了,設計模式更不用說了,總之,又是乙個新的起點,打算在乙個星期之內複習完c 有志同道合之人可與我一起進步,希望各位大佬給予我更多的指導!第乙個程式 hello ...