1manik 0 Newbie Poster

Hi, I have one program with DLL. Function OpenPort(portNumber) is in this DLL. It is used for open RS232 ports. The program is writted in VC++ Professional edition with using of MFC header. And in this program, there is this important parts for my question:

CReadSRNDlg::CReadSRNDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CReadSRNDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CReadSRNDlg)
	m_commPort = 0;
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	AfxOleInit();
}
CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CReadSRNDlg)
        .......
	DDX_Radio(pDX, IDC_RADIO1, m_commPort);
	//}}AFX_DATA_MAP
void CReadSRNDlg::OnOpenPort() 
{
	// TODO: Add your control notification handler code here
	
	UpdateData();
	if (OpenPort(m_commPort+1))
        .......

Can I write it in Win32 application like this:

case IDC_RADIO1:
							
							if(IsDlgButtonChecked(hlok, IDC_RADIO1) == BST_CHECKED)
							{
							m_commPort = 0;
							CheckDlgButton(hlok, IDC_RADIO1, BST_UNCHECKED);
							}
							else
							{	
							CheckDlgButton(hlok, IDC_RADIO1, BST_CHECKED);
							}
							break;

						case IDC_RADIO2:
							
							if(IsDlgButtonChecked(hlok, IDC_RADIO2) == BST_CHECKED)
							{
							m_commPort = 1;
							CheckDlgButton(hlok, IDC_RADIO2, BST_UNCHECKED);
							}
							else
							{	
							CheckDlgButton(hlok, IDC_RADIO2, BST_CHECKED);
							}
							break;

						case IDC_RADIO3:

							if(IsDlgButtonChecked(hlok, IDC_RADIO3) == BST_CHECKED)
							{
							m_commPort = 2;
							CheckDlgButton(hlok, IDC_RADIO3, BST_UNCHECKED);
							}
							else
							{	
							CheckDlgButton(hlok, IDC_RADIO3, BST_CHECKED);
							}
							break;

						case IDC_RADIO4:

							if(IsDlgButtonChecked(hlok, IDC_RADIO4) == BST_CHECKED)
							{
							m_commPort = 3;
							CheckDlgButton(hlok, IDC_RADIO4, BST_UNCHECKED);
							}
							else
							{	
							CheckDlgButton(hlok, IDC_RADIO4, BST_CHECKED);
							}
							break;

If you need more informations, I can send you it by private message..
Thanks for all advices.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.