void test() { LOGFONT logFont; memset(&logFont, 0x00, sizeof(logFont)); _tcscpy(logFont.lfFaceName, _T("Mic32New")); logFont.lfCharSet = DEFAULT_CHARSET; HDC hdc = ::GetWindowDC(adsw_acadMainWnd()); EnumFontFamiliesEx(hdc, &logFont,(FONTENUMPROC)EnumFontFamExProcGetRasterFontSize, 0, 0); ::ReleaseDC(adsw_acadMainWnd(), hdc); }
// // startDlg() // // Start up the modeless dialog. // // Adesk::Boolean startDlg() { CAcModuleResourceOverride resOverride; HWND hwndAcad = adsw_acadMainWnd(); if ( !hwndAcad ) { AfxMessageBox( "Unable to locate AutoCAD parent window." ); return Adesk::kFalse; } CWnd *pWnd = CWnd::FromHandle ( hwndAcad ); if( modelessDlg == NULL ) { if ( (modelessDlg = new CMDITestDialog ( pWnd )) == NULL ) { AfxMessageBox ( "Unable to allocate a CMDITestDialog." ); return Adesk::kFalse; } BOOL succeeded = modelessDlg->Create ( pWnd ); if ( !succeeded ) { AfxMessageBox ( "Unable to create the dialog." ); return Adesk::kFalse; } } modelessDlg->ShowWindow(SW_SHOWNORMAL); // add the reactor once the dialog was created acDocManager->addReactor( gpDocToModReactor ); return Adesk::kTrue; }
void dialogCreate() { // Modal SampleDlg dlg(CWnd::FromHandle(adsw_acadMainWnd())); int nReturnValue = dlg.DoModal(); }
void modalDlgTest() { // When resource from this ARX app is needed, just // instantiate a local CAcModuleResourceOverride CAcModuleResourceOverride resOverride; CTestDlg dlg(CWnd::FromHandle(adsw_acadMainWnd())); dlg.DoModal(); }
int ads_MyDialog() { // sample from brxtemplate //++-- See StdAfx for these types StringPairs LayerList; AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase(); pDb->layerTableId(); LayerTablePointer pLayerTable(pDb->layerTableId(),AcDb::kForRead); if(pLayerTable.openStatus() != eOk) { ads_retnil(); return( RSRSLT); } AcDbLayerTableIterator *pLayerTableIterator; pLayerTable->newIterator(pLayerTableIterator); //++-- iterate though and get our stuff for (pLayerTableIterator->start(); !pLayerTableIterator->done(); pLayerTableIterator->step()) { AcDbObjectId LayerId; TCHAR *LayerName; CString LayerColor; pLayerTableIterator->getRecordId(LayerId); LayerTableRecordPointer pLayerTableRecord(LayerId,AcDb::kForRead); pLayerTableRecord->getName(LayerName); AcCmColor clr = pLayerTableRecord->color(); LayerColor = clr.bookName(); LayerColor.Format(_T("Red = %03d Green = %03d Blue = %03d "), clr.red(), clr.green() , clr.blue()); LayerList.push_back(StringPair(String(LayerName), String(LayerColor))); } delete pLayerTableIterator; { // you should always call this before your diaog; CAcModuleResourceOverride resOverride; //show our dialog MyDialog dlg(LayerList,CWnd::FromHandle(adsw_acadMainWnd())); dlg.DoModal(); } ads_retnil(); return( RSRSLT); }
int ads_gm_import() { CProvidersCollection pc(true); StringPairs providersList = pc.ToStringPairs(); DlgProviders dlg(providersList, CWnd::FromHandle(adsw_acadMainWnd())); dlg.DoModal(); String providerName = dlg.GetProviderName(); if (providerName.length() == 0) { ads_retnil(); return( RSRSLT); } DlgProviderParam dlgProviders(pc.GetItem(providerName)); dlgProviders.DoModal(); CConnection * connection = dlgProviders.GetConnection(); if (connection != NULL) { FeatureClasses * featureClasses = CFeatureClass::GetFeatureClasses(connection); DlgLayers dlgLayers(featureClasses); dlgLayers.DoModal(); String featureClassName = dlgLayers.GetFeatureClassName(); if (featureClassName.length() == 0) { ads_retnil(); return( RSRSLT); } CFeatureClass * featureClass = featureClasses->operator [](featureClassName); if (featureClass == 0) { ads_retnil(); return( RSRSLT); } String extent = GetSelectedExtent(); connection->Open(); CFeatureReader featureReader = featureClass->SelectByExtent(extent); try { featureReader.DrawAll(); } catch (...) { } connection->Close(); delete featureClass; } delete connection; ads_retnil(); return( RSRSLT); }
void FileNavCommand() { LPCTSTR filterALL[] = { "*.*", NULL }; LPCTSTR filterCPP[] = { "*.zip", "*.c", "*.cpp", "*.h", NULL }; LPCTSTR filterDOC[] = { "*.doc", "*.txt", NULL }; LPCTSTR filterDWG[] = { "*.dwg", "*.dxb", "*.dxf", NULL }; LPCTSTR filterIMG[] = { "*.gif", "*.jpg", "*.tif", "*.tiff", NULL }; LPCTSTR filterDescription[] = { "All files", "C++ files", "Documents", "Drawings", "Images", NULL }; LPCTSTR *filterSpec[] = { filterALL, filterCPP, filterDOC, filterDWG, filterIMG, NULL }; CNavFilter *f; int i = 0, j; gFilterArray.RemoveAllData(); while (filterSpec[i] != NULL) { // Append a new filter. f = gFilterArray.AddData(); if (f != NULL) { // Set the filter's description. f->SetDescription(filterDescription[i]); // Assign the filter strings. j = 0; while (filterSpec[i][j] != NULL) { f->Add(filterSpec[i][j]); j++; } } // Prepare to add the next filter. i++; } while (true) { HWND acadHandle = adsw_acadMainWnd(); ::EnableWindow (acadHandle, true); ::SetFocus (acadHandle); CWnd *pWnd = CWnd::FromHandle(acadHandle); CFileNavDlg dlg(gDataArray, gFilterArray, 0, pWnd); dlg.SetMultiSelectAllowed(TRUE); dlg.SetDialogCaption("Browse down to a file"); if (dlg.DoModal() == IDOK) { for(int i = 0; i < gDataArray.GetCount(); i++) { LPITEMIDLIST id = gDataArray[i]->GetID(); //able to get the text string entered/selected by user in File Name Combo //along with its full parth CString sText = gDataArray[i]->GetText(); if (sText.GetLength() != 0) { acutPrintf ("The file name is:\n%s\n",sText.GetBuffer(sText.GetLength())); } } } break; } }