POST
|
I think I have found the solution. The confusion is about what IDatasetEdit::isBeingEdited( VARIANT_BOOL* pIsBeingEdited) actually means. If pIsBeingEdited is VARIANT_TRUE, then it means the current application is editing the dataset (or standalone feature class). If pIsBeingEdited is VARIANT_FALSE, then it means some OTHER application has a write lock on the dataset (or standalone feature class). Here is how I used this information to return the information I needed about which datasets are read-only to my application. Please note that in the C++ snippets below, the code is extracted from a class that has class members starting with m_. void MyClass::updateReadOnlyForDataset(BSTR dataset_name) { if(m_ipWorkspace == NULL) return; try { IFeatureDatasetPtr ipFeatureDataset = NULL; IFeatureWorkspacePtr ipFeatureWorkspace( m_ipWorkspace ); HRESULT hr = ipFeatureWorkspace->OpenFeatureDataset(dataset_name, &ipFeatureDataset ); if(ipFeatureDataset) { IDatasetEditPtr datasetEdit = NULL; datasetEdit = ipFeatureDataset; if(datasetEdit) { VARIANT_BOOL pIsBeingEdited = VARIANT_FALSE; //are we editing this dataset or does another app have it locked? hr = datasetEdit->IsBeingEdited(&pIsBeingEdited); if(pIsBeingEdited == VARIANT_FALSE) { //since we are not editing it, then it is locked by another app m_read_only = true; } } } } catch(...) { //report error } } void MyClass::updateReadOnlyForFeatureClass(BSTR layer_name) { if(m_ipWorkspace == NULL) return; try { IFeatureClassPtr ipFeatureClass = NULL; IFeatureWorkspacePtr ipFeatureWorkspace( m_ipWorkspace ); HRESULT hr = ipFeatureWorkspace->OpenFeatureClass(layer_name, &ipFeatureClass ); if(ipFeatureClass) { IDatasetEditPtr datasetEdit = NULL; datasetEdit = ipFeatureClass; //are we editing this standalone fc or does another app have it locked? if(datasetEdit) { VARIANT_BOOL pIsBeingEdited = VARIANT_FALSE; hr = datasetEdit->IsBeingEdited(&pIsBeingEdited); if(pIsBeingEdited == VARIANT_FALSE) { //since we are not editing it, then it is locked by another app m_read_only = true; } } } } catch(...) { //report error } } // main HRESULT hr = _ipWorkspaceEdit->StartEditing( VARIANT_FALSE ); ... BSTR layer_name = ::AoAllocBSTR( L"None" ); ... ipDataset->get_Name( &layer_name ); //if testing a dataset ... updateReadOnlyForDataset(layer_name ); //if testing a standalone feature class ... updateReadOnlyForFeatureClass(layer_name);
... View more
06-12-2010
11:38 AM
|
0
|
0
|
171
|
POST
|
Just a bit more info on my previous post. I also tried the IDatasetEditEx interface with the same disappointing result. And in the file GDB directory I can see many lock files which should indicate the editing session can be detected. Finally, when I do this in reverse order, i.e. open the layer for editing in my application, ArcMap is able to detect the locks. So what is the method for doing this? I find it hard to believe that an application is supposed to use file system calls to find the relevant locks. Thanks again, Gail
... View more
05-16-2010
04:53 PM
|
0
|
0
|
171
|
POST
|
Hello, I have a multi-layer file geodatabase. I have loaded a single layer into ArcMap and started editing. I then open this file geodatabase layer in another application and use the IDatasetEdit interface to query each subdataset object (i.e. layer by layer) if the subdataset is being edited. using this call: HRESULT IDatasetEdit::isBeingEdited( VARIANT_BOOL* pIsBeingEdited); Although the layer IS BEING EDITED, the argument pIsBeingEdited always returns false. How can I tell programmatically when a layer in a file GDB is being edited? My application is written in C++. BTW, the IWorkspaceEdit method with the same signature also says it is not being edited. Thank you, Gail
... View more
05-16-2010
04:14 PM
|
0
|
3
|
523
|
POST
|
Hello Kirk, Thanks for the reply. This is exactly what I hoped to do but was not sure how to exactly "load" the larger DLL. Of course I can call LoadLibrary(). In this scenario, I would not call regsvr32 to register the DLL since then it will be automatically loaded by ESRI. But I assume there must be some code that must run to allow ArcMap to handle its bookkeeping on a DLL. So I am not sure how this would work. But if you can shed any more light, I would be most grateful! Thanks again, Gail Nagle
... View more
05-05-2010
04:07 PM
|
0
|
0
|
517
|
POST
|
Hello, I am replying to this thread since it is the only hit I got on a forum search of IJITExtensionManager. My question is much more fundamental. First, I am coding in C++ but conceptually this should have no bearing on the answer. The question is related to what "loading" means for an ArcMap extention. As far as I can tell, even though our extention implementation contains the code below, the DLL is still being loaded when ArcMap starts up. BEGIN_CATEGORY_MAP(CSfaExt) IMPLEMENTED_CATEGORY(__uuidof(CATID_MxExtensionJIT)) END_CATEGORY_MAP() If it is being loaded, meaning that LoadLibrary() or LoadLibraryEx() has been called on our DLL, then this is not truly Just-In-Time loading. If we need to change the WINDOWS registration of a library once ArcMap has started, how can we truly control the loading of the DLL? Do we need to skip registration entirely and call LoadLibrary() ourselves in a seed DLL that is registered? Would this approach work with ArcMap? Having spent a week trying different approaches, and getting nowhere fast, your help would be greatly appreciated! Thanks, Gail
... View more
05-03-2010
05:19 PM
|
0
|
0
|
517
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|