📄 threadentry.cpp
字号:
// threadEntry.cpp: implementation of the CthreadEntry class.
//
#include "stdafx.h"
#include "thread.h"
#include "threadEntry.h"
#include "threadEntryDlg.h"
#include "Engine/Engine.h"
#include "Utils/ResourceKey.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
/////////////////////////////////////////////////////////////////////////////
// CthreadEntry
void CthreadEntry::InsertItems(CTreeCtrl* pTree)
{
// This method is called by the control panel property page when it
// needs to display its tree-view contents.
// Store pointer to tree-view in module data.
m_pTree = pTree;
// Request exclusive access to GUI in order to update control panel entries.
// Note: the call to LockGUI may block.
if (Engine.LockGUI())
{
// Insert root item for this class.
m_hRootItem = pTree->InsertItem(_T("threadEntry"));
// TODO: Insert items subordinate to the class root. Do this by
// iteratively calling pTree->InsertItem(_T("NextItem"), m_hRootItem).
// Save the handles returned so they may be tested later for membership
// in this branch.
// Release GUI lock.
Engine.UnlockGUI();
}
}
bool CthreadEntry::EditItem(CWnd* pParent, HTREEITEM hItem,
CTreeCtrl* pTree)
{
// This method is called by the control panel property page when the user
// presses the edit button with a node selected. hItem must be tested
// to see if the selected item belongs to this branch.
// An instance of TResourceKey is created and attached to threadSLL so that
// references to resources are assumed to be references to resources stored
// in this module.
TResourceKey key(threadSLL);
// Test hItem to see if it is the root item added in InsertItems.
if (hItem == m_hRootItem)
{
// TODO: Add controls and code to dialog to "edit" item as desired.
CthreadEntryDlg dlg(pParent);
if (IDOK == dlg.DoModal())
{
// Prompt to stop recording if recording is on (returns true if
// recording is already off). System will prompt to restart recording
// when user leaves setup tab.
if (PromptStopEngine())
{
// TODO: Incorporate changes.
}
// Set flag to cause automatic setup save on return.
m_bSaveNeeded = true;
}
}
else
{
// TODO: The selected item is not our root item. If items subordinate to
// the class root were added in InsertItems, then test hItem to see if
// it is one of those and, if it is, take the desired action.
}
// TODO: If the control panel tree should be rebuilt in order to show
// the changes made in this routine, then return true. Otherwise,
// return false.
return false;
}
bool CthreadEntry::DeleteItem(CWnd* pParent, HTREEITEM hItem, CTreeCtrl* pTree)
{
// If the right ("delete") button has been activated in GetButtonLabels() by
// having a label assigned, then this function will be called on the user's
// press of the right button. Define this function to perform the corresponding
// function.
// Return true only when the list must be rebuilt.
// TODO: Perform the function required when the user presses the right button.
return false;
}
bool CthreadEntry::NewItem(CWnd* pParent, HTREEITEM hItem, CTreeCtrl* pTree)
{
// If the left ("new") button has been activated in GetButtonLabels() by
// having a label assigned, then this function will be called on the user's
// press of the left button. Define this function to perform the corresponding
// function.
// Return true only when the list must be rebuilt.
// TODO: Perform the function required when the user presses the left button.
return false;
}
void CthreadEntry::GetButtonLabels(HTREEITEM hItem, CString& NewButton, CString& EditButton, CString& DeleteButton)
{
// This function is called by the framework to determine which buttons
// should be displayed below the tree window on the setup page. There are
// three buttons total, referred to by default as new, edit, and delete.
// More specifically, new is the left button, edit is the center button, and
// delete is the right button. To ensure the button is displayed, set the
// corresponding CString argument to the desired text. For example, to have the
// left button displayed with the text "Refresh", set NewButton = _T("Refresh").
// By default, the left and right buttons are empty and not displayed, while
// the center button is displayed with text "Edit".
// This function should only change or set button labels when the item identified in
// hItem belongs to this control panel entry.
// TODO: Define which buttons to display and their labels.
}
void CthreadEntry::OnKillActive(CWnd* pParent)
{
// This function is called when the focus is about to leave the control panel page.
// TODO: Perform actions required when the control panel loses focus.
}
extern "C" _declspec(dllexport)
void CreateControlPanelEntry(CControlPanelEntry** ppEntry)
{
// The control panel calls this function at startup to load the entry
// unique to this module.
CthreadEntry* pEntry = new CthreadEntry();
*ppEntry = dynamic_cast<CControlPanelEntry*>(pEntry);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -