|
|
1.1 ! root 1: // tracer.cpp : Contains TRACER.DLL implementation and initialization ! 2: // code. ! 3: // ! 4: // This is a part of the Microsoft Foundation Classes C++ library. ! 5: // Copyright (C) 1992 Microsoft Corporation ! 6: // All rights reserved. ! 7: // ! 8: // This source code is only intended as a supplement to the ! 9: // Microsoft Foundation Classes Reference and Microsoft ! 10: // QuickHelp documentation provided with the library. ! 11: // See these sources for detailed information regarding the ! 12: // Microsoft Foundation Classes product. ! 13: ! 14: ! 15: #include <afxwin.h> ! 16: #include "traceapi.h" ! 17: ! 18: #ifndef _DEBUG ! 19: #error This source file must be compiled with _DEBUG defined ! 20: #endif ! 21: ! 22: ///////////////////////////////////////////////////////////////////////////// ! 23: // Dialog class ! 24: ! 25: class CPromptDlg : public CModalDialog ! 26: { ! 27: TracerData FAR* m_lpData; ! 28: public: ! 29: CPromptDlg(TracerData FAR* lpData) ! 30: : CModalDialog("PROMPT") ! 31: { m_lpData = lpData; } ! 32: ! 33: BOOL OnInitDialog(); ! 34: void OnOK(); ! 35: }; ! 36: ! 37: BOOL CPromptDlg::OnInitDialog() ! 38: { ! 39: if (m_lpData->bEnabled) ! 40: ((CButton*)GetDlgItem(512))->SetCheck(TRUE); ! 41: ! 42: for (int i = 0; i < 16; i++) ! 43: { ! 44: CButton* pCheck = (CButton*)GetDlgItem(256 + i); ! 45: if (pCheck == NULL) ! 46: break; // no more checkboxes ! 47: if (m_lpData->flags & (1 << i)) ! 48: pCheck->SetCheck(TRUE); ! 49: } ! 50: return TRUE; ! 51: } ! 52: ! 53: void CPromptDlg::OnOK() ! 54: { ! 55: m_lpData->bEnabled = ((CButton*)GetDlgItem(512))->GetCheck(); ! 56: m_lpData->flags = 0; ! 57: ! 58: for (int i = 0; i < 16; i++) ! 59: { ! 60: CButton* pCheck = (CButton*)GetDlgItem(256 + i); ! 61: if (pCheck == NULL) ! 62: break; // no more checkboxes ! 63: if (pCheck->GetCheck()) ! 64: m_lpData->flags |= (1 << i); ! 65: } ! 66: EndDialog(IDOK); ! 67: } ! 68: ! 69: ///////////////////////////////////////////////////////////////////////////// ! 70: // Public C interface ! 71: ! 72: extern "C" ! 73: BOOL FAR PASCAL _export PromptTraceFlags(TracerData FAR* lpData) ! 74: { ! 75: TRACE("Inside Tracer DLL\n"); ! 76: CPromptDlg dlg(lpData); ! 77: ! 78: return (dlg.DoModal() == IDOK); ! 79: } ! 80: ! 81: ///////////////////////////////////////////////////////////////////////////// ! 82: // Library init ! 83: ! 84: class CTracerDLL : public CWinApp ! 85: { ! 86: public: ! 87: virtual BOOL InitInstance(); ! 88: ! 89: // nothing special for the constructor ! 90: CTracerDLL(const char* pszAppName) ! 91: : CWinApp(pszAppName) ! 92: { } ! 93: }; ! 94: ! 95: BOOL CTracerDLL::InitInstance() ! 96: { ! 97: // any DLL initialization goes here ! 98: TRACE("TRACER.DLL initializing\n"); ! 99: return TRUE; ! 100: } ! 101: ! 102: extern "C" ! 103: BOOL FAR PASCAL _export FilterDllMsg(LPMSG lpMsg) ! 104: { ! 105: return AfxGetApp()->PreTranslateMessage(lpMsg); ! 106: } ! 107: ! 108: CTracerDLL tracerDLL("tracer.dll"); ! 109: ! 110: /////////////////////////////////////////////////////////////////////////////
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.