author | Michael Krelin <hacker@klever.net> | 2004-11-03 21:50:28 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2004-11-03 21:50:28 (UTC) |
commit | 5f552506513653f08acc6921b8c158489a7ebbbb (patch) (side-by-side diff) | |
tree | 74ab06cf90c488915b87f48e74359554521cbec9 /PumpKINDlg.cpp | |
parent | 4435ed85c3acb4df42135e009b133fb8e9d2f09c (diff) | |
download | pumpkin-5f552506513653f08acc6921b8c158489a7ebbbb.zip pumpkin-5f552506513653f08acc6921b8c158489a7ebbbb.tar.gz pumpkin-5f552506513653f08acc6921b8c158489a7ebbbb.tar.bz2 |
Added dialog box in case we can't bind listening socket.
git-svn-id: http://svn.klever.net/kin/pumpkin/trunk@47 fe716a7a-6dde-0310-88d9-d003556173a8
-rw-r--r-- | PumpKINDlg.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/PumpKINDlg.cpp b/PumpKINDlg.cpp index 0b3bf41..fc24596 100644 --- a/PumpKINDlg.cpp +++ b/PumpKINDlg.cpp @@ -298,64 +298,65 @@ void CPumpKINDlg::OnPaint() }
else
{
CPaintDC pDC(this);
CDC bmpDC;
bmpDC.CreateCompatibleDC(&pDC);
bmpDC.SelectObject(&m_bmpBack);
CRect rc;
GetClientRect(&rc);
for(int x=-m_bitmapBack.bmWidth*2/4;x<rc.Width();x+=m_bitmapBack.bmWidth)
for(int y=-m_bitmapBack.bmHeight*2/4;y<rc.Height();y+=m_bitmapBack.bmHeight)
pDC.BitBlt(x,y,m_bitmapBack.bmWidth,m_bitmapBack.bmHeight,&bmpDC,0,0,SRCCOPY);
bmpDC.DeleteDC();
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CPumpKINDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
int CPumpKINDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
m_Listener.m_Daddy=this;
if(!m_Listener.Create(m_ListenPort,SOCK_DGRAM)){
TRACE0("Failed to create socket\n");
+ AfxMessageBox(IDS_BOX_CANTBIND,MB_OK|MB_ICONEXCLAMATION);
return -1;
}
if(!m_Trayer->Create(NULL,"PumpKIN TrayIcon",WS_CHILD,CRect(0,0,0,0),this,0)){
TRACE0("Failed to create trayer\n");
return -1;
}
NOTIFYICONDATA nid;
memset(&nid,0,sizeof(nid));
nid.cbSize=sizeof(nid);
nid.hWnd=m_Trayer->m_hWnd;
nid.uID=IDC_TRAYICON;
nid.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP;
nid.uCallbackMessage=WM_TRAYICON;
nid.hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME);
// *** Load from resource
strcpy(nid.szTip,"PumpKIN");
VERIFY(Shell_NotifyIcon(NIM_ADD,&nid));
return 0;
}
void CListenSocket::OnReceive(int nErrorCode)
{
ASSERT(m_Daddy);
if(nErrorCode){
m_Daddy->LogLine(IDS_LOG_LISTENRECEIVEERROR);
return;
}
DWORD fionread = 0;
VERIFY(IOCtl(FIONREAD,&fionread)); // *** Do some checking on the value acquired
|