void NetControl::OnSorc() { int k; k=MessageBox(GetActiveWindow(),"你是否建立主机?(主机/客户机 Y/N)","建立主机",MB_OKCANCEL); if(k==1) { CServer ser1; ser1.DoModal(); m_Port=atoi(ser1.m_Port); OnSet(); m_Isserver=true; manager.PlayerAc=0; } else { CGetin dlg1; if(dlg1.DoModal()==IDOK) { CString *p=new(CString); *p=dlg1.m_IP; m_Server=*p; m_Port=atoi(dlg1.m_Port); OnOpen(); m_Isserver=false; } manager.PlayerAc=1; } }
ModeAction ParamModeBase::OnModeChange(User* source, User*, Channel* chan, std::string& parameter, bool adding) { if (adding) { if (chan->GetModeParameter(this) == parameter) return MODEACTION_DENY; if (OnSet(source, chan, parameter) != MODEACTION_ALLOW) return MODEACTION_DENY; chan->SetMode(this, true); // Handler might have changed the parameter internally parameter.clear(); this->GetParameter(chan, parameter); } else { if (!chan->IsModeSet(this)) return MODEACTION_DENY; this->OnUnsetInternal(source, chan); chan->SetMode(this, false); } return MODEACTION_ALLOW; }
INT_PTR CALLBACK CLyricsDlg::DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_DESTROY: KillTimer(hDlg, ID_TIMER); break; case WM_CLOSE: EndDialog(hDlg, IDCANCEL); break; case WM_COMMAND: { switch (LOWORD(wParam)) { case IDOK: OnOk(hDlg); break; case IDCANCEL: EndDialog(hDlg, IDCANCEL); break; case IDC_SET: OnSet(hDlg); break; } } break;//case WM_COMMAND case WM_INITDIALOG: OnInitDialog(hDlg, lParam);break; case WM_DRAWITEM: { DRAWITEMSTRUCT* pDraw = (DRAWITEMSTRUCT*)lParam; HDC hMemDC = CreateCompatibleDC(pDraw->hDC); HBITMAP hOldBmp; if (pDraw->itemAction & ODA_SELECT || pDraw->itemAction & ODA_DRAWENTIRE) { if (pDraw->itemState & ODS_SELECTED) hOldBmp = (HBITMAP)SelectObject(hMemDC, m_hbSet2); else hOldBmp = (HBITMAP)SelectObject(hMemDC, m_hbSet); } else hOldBmp = (HBITMAP)SelectObject(hMemDC, m_hbSet); BitBlt(pDraw->hDC, 0, 0, 22, 19, hMemDC, 0, 0, SRCCOPY); SelectObject(hMemDC, hOldBmp); HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); RECT rect;// = {0, 0, 21, 18}; GetClientRect(pDraw->hwndItem, &rect); SetBkMode(pDraw->hDC, TRANSPARENT); DrawTextA(pDraw->hDC, "Setează", -1, &rect, DT_CENTER | DT_VCENTER | DT_EXTERNALLEADING | DT_SINGLELINE); DeleteDC(hMemDC); } break; case WM_LBUTTONUP: OnLButtonUp(hDlg, wParam, lParam); break; case WM_MOUSEMOVE: OnMouseMove(hDlg, wParam, lParam); break; } return 0; }
/* * Manual page at function.def */ INT16 CGEN_PUBLIC CFunction::OnSet() { // Delegate to running function // ------------------------------------ FNC_DELEGATE OnSet(); // Use a weird macro (see function.def) // Initialize // ------------------------------------ const char* lpsId = GetNextToken(TRUE); // Determine field name CDlpObject* iCont = GetActiveInstance(); // Get first instance argument if (m_nStackLen<=0) // Stack is to contain the new value return IERROR(this,FNC_STACKUNDERFLOW," on method ","-set",0); // | if (m_aStack[0].nType==T_INSTANCE && m_aStack[0].val.i==iCont) PopInstance(1);// Pop the active instance // Validate // ------------------------------------ if (!dlp_strlen(lpsId)) // If no field name committed return IERROR(this,FNC_EXPECT,"field identifier after -set",0,0); // Error SWord* lpWrd = iCont->FindWord(lpsId,WL_TYPE_FIELD); // Find field in container if (!lpWrd) // If not found { // >> iCont = this; // Use this instance as container lpWrd = FindWord(lpsId,WL_TYPE_FIELD); // And seek again } // << if (!lpWrd ) return IERROR(this,ERR_NOTFIELD,lpsId,0,0); // If still not found --> error if (lpWrd->nFlags & FF_NOSET) return IERROR(this,FNC_NOSET ,lpsId,0,0); // If write-protected --> error // Set new value // ------------------------------------ switch (lpWrd->ex.fld.nType) // Branch for field variable type { // >> case T_BOOL : { BOOL bTmp=( BOOL)PopLogic(2); iCont->SetField(lpWrd,(void*)&bTmp); } break;// - Boolean case T_UCHAR : { UINT8 nTmp=( UINT8)PopNumber(2).x;iCont->SetField(lpWrd,(void*)&nTmp); } break;// - Unsigned character case T_CHAR : { INT8 nTmp=( INT8)PopNumber(2).x;iCont->SetField(lpWrd,(void*)&nTmp); } break;// - Signed character case T_USHORT : { UINT16 nTmp=( UINT16)PopNumber(2).x;iCont->SetField(lpWrd,(void*)&nTmp); } break;// - Unsigned short integer case T_SHORT : { INT16 nTmp=( INT16)PopNumber(2).x;iCont->SetField(lpWrd,(void*)&nTmp); } break;// - Signed short integer case T_UINT : { UINT32 nTmp=( UINT32)PopNumber(2).x;iCont->SetField(lpWrd,(void*)&nTmp); } break;// - Unsigned integer case T_INT : { INT32 nTmp=( INT32)PopNumber(2).x;iCont->SetField(lpWrd,(void*)&nTmp); } break;// - Signed integer case T_ULONG : { UINT64 nTmp=( UINT64)PopNumber(2).x;iCont->SetField(lpWrd,(void*)&nTmp); } break;// - Unsigned long integer case T_LONG : { INT64 nTmp=( INT64)PopNumber(2).x;iCont->SetField(lpWrd,(void*)&nTmp); } break;// - Signed long integer case T_FLOAT : { FLOAT32 nTmp=(FLOAT32)PopNumber(2).x;iCont->SetField(lpWrd,(void*)&nTmp); } break;// - Single precision floating point case T_DOUBLE : { FLOAT64 nTmp=(FLOAT64)PopNumber(2).x;iCont->SetField(lpWrd,(void*)&nTmp); } break;// - Double precision floating point case T_COMPLEX : { COMPLEX64 nTmp= PopNumber(2); iCont->SetField(lpWrd,(void*)&nTmp); } break;// - Double precision complex floating point case T_TEXT : /* Fall through */ // - Text (depreciated type!) case T_CSTRING : /* Fall through */ // - Constant string case T_STRING : { char* lpsTmp = PopString(2); iCont->SetField(lpWrd,(void*)&lpsTmp);}break;// - String case T_INSTANCE: // - Instance { // >> CDlpObject* iVal = PopInstance(2); // Get new value if // Check instance type ( // | dlp_strlen(lpWrd->ex.fld.lpType)>0 && // - Typed instance field? iVal != NULL && // - New value non-NULL? OfKind(lpWrd->ex.fld.lpType,iVal)==NULL // - Type cast impossible? ) // | { // >> return // Error IERROR(this,FNC_TYPECAST,0,iVal->m_lpClassName,lpWrd->ex.fld.lpType); // | } // << iCont->SetField(lpWrd,(void*)&iVal); // Set new value break; // . } // << default: // - Other types if (lpWrd->ex.fld.nType>0 && lpWrd->ex.fld.nType<=256) { // Character array? char* lpsTmp=PopString(2); // Set new value iCont->SetField(lpWrd,&lpsTmp); // | } else // Type unknown! DLPASSERT(FMSG("Unknown field type")); // Error } // << return O_K; // Done. }
INT_PTR CALLBACK VirtMemDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { PVIRTMEM pVirtMem; UNREFERENCED_PARAMETER(lParam); pVirtMem = (PVIRTMEM)GetWindowLongPtr(hwndDlg, DWLP_USER); switch (uMsg) { case WM_INITDIALOG: pVirtMem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(VIRTMEM)); if (pVirtMem == NULL) { EndDialog(hwndDlg, 0); return FALSE; } SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pVirtMem); OnInitDialog(hwndDlg, pVirtMem); break; case WM_DESTROY: OnDestroy(pVirtMem); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: EndDialog(hwndDlg, 0); return TRUE; case IDOK: OnOk(pVirtMem); EndDialog(hwndDlg, pVirtMem->bModified); return TRUE; case IDC_NOPAGEFILE: OnNoPagingFile(pVirtMem); return TRUE; case IDC_SYSMANSIZE: OnSysManSize(pVirtMem); return TRUE; case IDC_CUSTOM: OnCustom(pVirtMem); return TRUE; case IDC_SET: OnSet(pVirtMem); return TRUE; case IDC_PAGEFILELIST: switch (HIWORD(wParam)) { case LBN_SELCHANGE: OnSelChange(hwndDlg, pVirtMem); return TRUE; } break; } break; } return FALSE; }