本文整理汇总了C++中CObArray::GetAt方法的典型用法代码示例。如果您正苦于以下问题:C++ CObArray::GetAt方法的具体用法?C++ CObArray::GetAt怎么用?C++ CObArray::GetAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CObArray
的用法示例。
在下文中一共展示了CObArray::GetAt方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
extern "C" DWORD PASCAL EXPORT STDFUFILES_DestroyImage(PHANDLE pHandle)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
BOOL bFound=FALSE;
DWORD dwRet=STDFUFILES_NOERROR;
for (int i=0;i<=g_Images.GetUpperBound();i++)
{
if ((HANDLE)g_Images.GetAt(i)==*pHandle)
{
CImage *pImage=(CImage *)(*pHandle);
delete pImage;
*pHandle=0;
bFound=TRUE;
g_Images.RemoveAt(i);
break;
}
}
if (!bFound)
dwRet=STDFUFILES_BADPARAMETER;
return dwRet;
}
示例2: CImage
extern "C" DWORD PASCAL EXPORT STDFUFILES_DuplicateImage(HANDLE hSource, PHANDLE pDest)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DWORD dwRet=STDFUFILES_NOERROR;
BOOL bFound=FALSE;
for (int i=0;i<=g_Images.GetUpperBound();i++)
{
if ((HANDLE)g_Images.GetAt(i)==hSource)
{
bFound=TRUE;
break;
}
}
if (!bFound)
dwRet=STDFUPRT_BADPARAMETER;
else
{
CImage *obImage=new CImage((CImage*)hSource);
if (obImage->GetImageState())
{
g_Images.Add(obImage);
*pDest=(HANDLE)obImage;
}
else
{
delete obImage;
dwRet=STDFUFILES_BADFORMAT;
}
}
return dwRet;
}
示例3: ExitInstance
int CSTDFUFILESApp::ExitInstance()
{
int i;
for (i=0;i<=g_Images.GetUpperBound();i++)
{
CImage *pImage=(CImage*)g_Images.GetAt(i);
delete pImage;
}
g_Images.RemoveAll();
for (i=0;i<=g_DFUFiles.GetUpperBound();i++)
{
CDFUFile *pFile=(CDFUFile*)g_DFUFiles.GetAt(i);
delete pFile;
}
g_DFUFiles.RemoveAll();
return CWinApp::ExitInstance();
}
示例4: SyncServerConnections
/**
* SyncServerConnections
*
*/
void CFtpManager::SyncServerConnections()
{
CConnectionManager connectionManager;
connectionManager.Load();
CObArray * listOfConnections;
listOfConnections = connectionManager.GetConnections();
int i = 0;
for(i = 0; i < listOfConnections->GetSize(); i++){
CConnection * con = (CConnection *)listOfConnections->GetAt(i);
if(con->host.GetLength() > 0)
{
SyncServerConnection(con);
}
}
}
示例5: OnExecuteComplete
LRESULT CSessionWnd::OnExecuteComplete(WPARAM wParam, LPARAM lParam)
{
WFSRESULT *pResult = (WFSRESULT *)lParam;
// finding serviceBasic
CServiceBasic *pServiceBasic = 0;
for(long i=0; i<g_arrayService.GetSize(); i++)
{
pServiceBasic = (CServiceBasic *)g_arrayService.GetAt(i);
if(pServiceBasic->m_nRequestedID == pResult->RequestID)
{
pServiceBasic->m_hResult = pResult->hResult;
*pServiceBasic->m_lppResult = pResult;
break;
}
pServiceBasic = 0;
}
if(pServiceBasic) pServiceBasic->m_nRequestedID = 0;
if(pServiceBasic) pServiceBasic->m_eventExecute.SetEvent();
return 0;
}
示例6: WorkerThread
// **************************************************************************
// WorkerThread ()
//
// Description:
// Worker thread function.
//
// Parameters:
// void *pvArgs Pointer to a WORKERTHREADARG structure which
// describes task to be performed.
//
// Returns:
// unsigned int - 0
// **************************************************************************
unsigned _stdcall CKDocument::WorkerThread (void *pvArgs)
{
// Cast argument to proper type so we can extract the required data
// about the task we are to perform:
WORKERTHREADARG *pWTA = (WORKERTHREADARG *)pvArgs;
ASSERT (pWTA);
// Execute specified task:
switch (pWTA->eTask)
{
case WORKERTHREADARG::START_SINGLE_SERVER:
case WORKERTHREADARG::STOP_SINGLE_SERVER:
{
// Extract pointer to server we are to start or stop from
// argument structure:
CKServer *pServer = (CKServer *)pWTA->pvObjectA;
ASSERT (pServer);
// Start or stop the server as the case may be:
if (pWTA->eTask == WORKERTHREADARG::START_SINGLE_SERVER)
pServer->Start ();
else
pServer->Stop ();
}
break;
case WORKERTHREADARG::START_MULTIPLE_SERVER:
case WORKERTHREADARG::STOP_MULTIPLE_SERVER:
{
// Extract the list (object array) of servers to start or stop
// from argument structure:
CObArray *pList = (CObArray *)pWTA->pvObjectA;
ASSERT (pList);
// Get the number of server in the list:
int cnServers = pList->GetSize ();
CKServer *pServer = NULL;
// Loop over the servers in the list:
while (--cnServers >= 0)
{
// Get pointer to next server in list:
pServer = (CKServer *) pList->GetAt (cnServers);
ASSERT (pServer);
// Start or stop that server as the case may be:
if (pWTA->eTask == WORKERTHREADARG::START_MULTIPLE_SERVER)
pServer->Start ();
else
pServer->Stop ();
}
}
break;
case WORKERTHREADARG::ADD_ITEMS:
{
// Extract the list (object array) of items to add from
// argument structure:
CObArray *pList = (CObArray *)pWTA->pvObjectA;
ASSERT (pList);
// Extract the number of items from the argument structure:
int cnItems = *(int *)pWTA->pvObjectB;
// Get pointer to first item from list. We will use it to
// get the group object these items will be added to:
CKItem *pItem = (CKItem *)pList->GetAt (0);
ASSERT (pItem);
// Get group that we are adding the items to:
CKGroup *pGroup = pItem->GetParentGroup ();
ASSERT (pGroup);
// Add the items to this group:
pGroup->AddItems (*pList, cnItems);
}
break;
default:
// unhandled task ?
ASSERT (FALSE);
break;
}
return (0);
}
示例7: OnLoadUrl
/**
* OnLoadUrl
*
* Description: Load a url into the view
*
* Parameters: wparam: - 0 = no callback, 1 = yes callback
* lparam: CString url path
*/
LRESULT CMainFrame::OnLoadUrl(WPARAM wParam, LPARAM lParam)
{
CConnectionListView * connectionView = (CConnectionListView *)m_mainSplitter.GetPane(0,0);
CFileListView * fileListView = (CFileListView *)m_mainSplitter.GetPane(0,1);
CString * urlArg = (CString*)lParam;
if(urlArg){
TRACE1(" Load url: %s \n", urlArg->AllocSysString());
CString url(urlArg->AllocSysString());
delete urlArg;
CString host(_T(""));
CString dir(_T(""));
// Parse
if(url.Find(_T("ftp://")) != -1){
url = url.Mid(url.Find(_T("ftp://")) + 6, url.GetLength() - url.Find(_T("ftp://")));
}
int pos = url.Find('/');
if(pos != -1){
host = url.Mid(0, pos);
dir = url.Mid(pos, url.GetLength() - pos);
} else {
host = CString(url);
dir = CString(_T("/"));
}
// select connection
int connection_id = -1;
CObArray * listOfConnections;
listOfConnections = m_connectionManager.GetConnections();
int i = 0;
for(i = 0; i < listOfConnections->GetSize(); i++){
CConnection * con = (CConnection *)listOfConnections->GetAt(i);
if(con->host.Compare(host) == 0){
connection_id = i;
connectionView->SelectConnection(connection_id);
}
}
// Prompt for new connection information
if(connection_id < 0){
CConnectionDialog dlg;
dlg.SetHost(host); // prefill in host
dlg.DoModal();
// Update view with updated connections
connectionView->UpdateConnections();
// Re check host in connections
m_connectionManager.Load();
listOfConnections = m_connectionManager.GetConnections();
int i = 0;
for(i = 0; i < listOfConnections->GetSize(); i++){
CConnection * con = (CConnection *)listOfConnections->GetAt(i);
if(con->host.Compare(host) == 0){
connection_id = i;
connectionView->SelectConnection(connection_id);
}
}
if(connection_id < 0){
return 1; // No connection entered, abort
}
}
// Load file list view
fileListView->LoadServerConnection(connection_id);
fileListView->LoadDirectory(dir);
// Load url in header history.
if(m_headerDoc && ((int)wParam) == 1){
m_headerDoc.SetUrl( CString(host + dir) );
m_headerDoc.SetConnectionID(connection_id);
m_headerDoc.m_path = CString(dir); // This needs work
CFileListView * v = (CFileListView *)m_mainSplitter.GetPane(0,1);
m_headerDoc.m_path = CString(v->GetPath());
}
// Cleanup
delete urlArg;
}
return 1;
}
示例8: GetContacts
//.........这里部分代码省略.........
mapiContact.GetName(strText,PR_SURNAME);
pContact->SetLastName(strText);
mapiContact.GetEmail(strText);
pContact->SetEmail(strText);
mapiContact.GetEmail(strText,2);//Email 2
pContact->SetEmail2(strText);
mapiContact.GetEmail(strText,3);//Email 3
pContact->SetEmail3(strText);
mapiContact.GetPhoneNumber(strText,PR_BUSINESS_TELEPHONE_NUMBER);
pContact->SetBusinessPhone(strText);
mapiContact.GetPhoneNumber(strText,PR_COMPANY_MAIN_PHONE_NUMBER);
pContact->SetCompanyPhone(strText);
mapiContact.GetPhoneNumber(strText,PR_BUSINESS_FAX_NUMBER);
pContact->SetFax(strText);
mapiContact.GetPhoneNumber(strText,PR_MOBILE_TELEPHONE_NUMBER);
pContact->SetMobilePhone(strText);
mapiContact.GetPhoneNumber(strText,PR_HOME_TELEPHONE_NUMBER);
pContact->SetHomePhone(strText);
if(m_pCtrl->FetchUnique())
{
BOOL isContactExist = FALSE;
for(int i=0;i<contactArray.GetCount();i++)
{
CContact* pTemp = (CContact*)contactArray.GetAt(i);
if(pContact->GetEmail() != "" && pTemp->GetEmail() == pContact->GetEmail())
{
isContactExist = TRUE;
break;
}
else if(pContact->GetFullName() != "" && pTemp->GetFullName() == pContact->GetFullName())
{
isContactExist = TRUE;
break;
}
else if(pContact->GetMobilePhone() != "" && pTemp->GetMobilePhone() == pContact->GetMobilePhone())
{
isContactExist = TRUE;
break;
}
else if(pContact->GetHomePhone() != "" && pTemp->GetHomePhone() == pContact->GetHomePhone())
{
isContactExist = TRUE;
break;
}
else if(pContact->GetBusinessPhone() != "" && pTemp->GetBusinessPhone() == pContact->GetBusinessPhone())
{
isContactExist = TRUE;
break;
}
}
if(isContactExist)
{
continue;
}
示例9: DoImportLibrary
void CDialogPlacePart::DoImportLibrary()
{
CDraftDrawDoc *pDoc = theApp.GetActiveDocument();
std::wstring sFilter = _T("External library file (*.xml)|*.xml||");//All Files (*.*)|*.*||;
CStringArray saExtensions;
saExtensions.Add(_T("xml"));
CFileDialog fdialog(
TRUE, //save dialog box
NULL,
NULL,
0, //no flags
sFilter.c_str(),
NULL);
if (fdialog.DoModal() == IDOK){
//Get filename from dialog
int offset = fdialog.m_ofn.nFileExtension;
CString strFile = fdialog.m_ofn.lpstrFile;
int nFilterIndex = fdialog.m_ofn.nFilterIndex;
if ((!offset) || (fdialog.m_ofn.lpstrFile[offset] == 0)){
strFile += _T(".") + saExtensions[fdialog.m_ofn.nFilterIndex - 1];
sFilter = saExtensions[fdialog.m_ofn.nFilterIndex - 1];
}
//Try to import library
CImporter *pImporter = new CImporter();
CObArray *pObArray = new CObArray();
pImporter->ImportLibrary(strFile, pObArray, pDoc->m_szGrid);
//Create new library
CString strLib = strFile.Left(strFile.ReverseFind('.'));
if (strLib.ReverseFind(_T('\\')) >= 0){
strLib = strLib.Right(strLib.GetLength() - strLib.ReverseFind(_T('\\')) - 1);
}
if (strLib.GetLength() == 0) strLib = strFile;
DoInsertNewLibrary(strLib, TRUE);
//Iterate all shapes to bounding rect union
CRect rectUnion;
for (int i = 0; i < pObArray->GetSize(); i++){
CShapeUnit *pSh = (CShapeUnit *)pObArray->GetAt(i);
CRect rect;
pSh->GetRectTemp(rect);
TRACE(_T("Importing part %s.\n"),(LPCTSTR)(pSh->m_sUnitName));
//rectUnion.UnionRect(rectUnion, rect);
if (rect.Width()>rectUnion.Width()){
rectUnion = CRect(CPoint(0, 0), CSize(rect.Width(), rectUnion.Height()));
}
if (rect.Height()>rectUnion.Height()){
rectUnion = CRect(CPoint(0, 0), CSize(rectUnion.Width(), rect.Height()));
}
}
//rectUnion.InflateRect(DCABLE_PADDINGX_DEFAULT << 1, DCABLE_PADDINGY_DEFAULT << 1);
rectUnion.InflateRect(DCABLE_GRIDX_DEFAULT, DCABLE_GRIDY_DEFAULT);
CSize size=rectUnion.Size();
rectUnion = CRect(CPoint(0, 0), rectUnion.Size());
//Insert/update parts
for (int i = 0; i<pObArray->GetSize(); i++){
//Insert part
CShapeUnit *pSh = (CShapeUnit *)pObArray->GetAt(i);
//Do insert in librarry
DoInsertPart(pSh->m_sUnitName);
//Get bounding rect
CRect rectTemp;
pSh->GetRectTemp(rectTemp);
((CShapeFrmRect*)pSh->m_obarrShapearr[0])->m_Rect = rectUnion;
CPoint offset = CPoint((rectUnion.Width() - rectTemp.Width()) >> 1, (rectUnion.Height() - rectTemp.Height()) >> 1);
//Call a method to normalize ShapeUnit from bounding rect TopLeft to (0,0) or any other offset
//pSh->NormalizeChildShapes(CPoint(DCABLE_PADDINGX_DEFAULT, DCABLE_PADDINGY_DEFAULT));
pSh->NormalizeChildShapes(offset);
//Save parts
//Create new method in CDocument to be called from here and serialize the parts
CString strFile = pSh->m_sUnitName;
//Keep previous part edition status
BOOL bFlagPartEdit = pDoc->m_bFlagPartEdit;
//Set part edition mode to save the save
pDoc->m_bFlagPartEdit = TRUE;
CObArray* prevObArray = pDoc->m_pObArray;
pDoc->m_pObArray = &pSh->m_obarrShapearr;
pDoc->OnDatabaseSave(strLib + _T(".") + strFile);
pDoc->m_pObArray = prevObArray;
//Restore flag
pDoc->m_bFlagPartEdit = bFlagPartEdit;
}
}//End dialog result OK