System Programming
--
Questions
--
Followers
Top Experts
I was pointed to a better way to convert from a string IP to an unsigned long but my problem still exists. Everytime I try to set the IP address via SetAddress() I get an assertion fault error. This is absolutely driving me nuts lol.
here is how I am now converting to and from the CIPAddressCtrl.
This is when I try to set the IP address to the control. The IP address is grabbed from a registry entry I have setup. propertiesdialog in an instance of the Dialog the CIPAddressCtrl is on.
const char *ip = registry.getserverip();
serverip = inet_addr(ip);
serverip = htonl(serverip);
propertiesdialog.m_serveri
This is where I blow up every time (the last line above).
Now the retreival from the CIPAddressCtrl works just fine and the funny thing is the value returned from GetAddress() is exactly the same as the value I am trying to push into SetAddress(). Here is my retreival function from the control.
DWORD dwip;
char *ip;
IN_ADDR addr;
m_serverip.GetAddress(dwip
addr.S_un.S_addr = ntohl(dwip);
ip = inet_ntoa(addr);
Any further info would be great. I have searched high and low on the internet but there is very little reference to this control.
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
It seems I was referencing the CIPAddressCtrl outside the dialog class that declares it. Doing so is what was causing the assertion fault. I then overrided the OnInitDialog method in my CDialog class to initialize the CIPAddressCtrl to the value from the registry. I am still getting the assertion fault error though.
I beleive the assertion fault error is because the control is not yet created as I can set the actual control if I wanted to in the function that runs when the OK button on the CDialog is pressed but nowhere else.
How would I go about this? I think I need to call the CIPAddressCtrl::Create method or something first but that will require a structure containing information I am not sure how to reference at this time.
Raising the points for a good detailed explantion.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
If this is the case, make sure your implementation inside the OnInitDIalog is done AFTER the call to the base implemetation.
If you will send the specific line where the assertion occures, maybe it will give me a better idea about the problem.
Header File:
#if !defined(AFX_EQLP_SERVER_P
#define AFX_EQLP_SERVER_PROPERTIES
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// EQLP_Server_Properties.h : header file
//
//////////////////////////
// EQLP_Server_Properties dialog
class EQLP_Server_Properties : public CDialog
{
// Construction
public:
EQLP_Server_Properties(CWn
void SetIP(DWORD ip);
BOOL OnInitDialog();
// Dialog Data
//{{AFX_DATA(EQLP_Server_P
enum { IDD = IDD_DIALOG1 };
CIPAddressCtrl m_serverip;
CEdit m_svrportnumedit;
CString m_svrportnum;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(EQLP_Serve
protected:
virtual void DoDataExchange(CDataExchan
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(EQLP_Server_Pr
afx_msg void OnServerPropOk();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EQLP_SERVER_P
OnInitDialog member in cpp file:
BOOL EQLP_Server_Properties::On
char *ip;
DWORD dwIp;
ip = EQLP_Registry::getserverip
dwIp = inet_addr(ip);
m_serverip.SetAddress(ntoh
return TRUE;
}
Exact Assertion Fault error:
Debug Assertion Failed!
Program: c:\EQLP_Client\Debug\EQLP_
File: afxcmn.inl
Line: 301
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog(); //This is the line of code I was missing
// Add my code here
return TRUE;
}

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
System Programming
--
Questions
--
Followers
Top Experts
Kernel and system programming is the process of creating the software necessary for a computer or device to function and operate other programs. Some operating systems (such as Microsoft Windows) are proprietary, but others, such as the various Linux distributions, are open source.