disable "Save as"

Just want to know is there any way to disable the "Save as" function from SE file menu. In our case we don't want any one to use "save as". How could this be done? What are the options?

 

Lei

 

 

 

Posted by: L S
Post date: 6/17/2006 3:48:31 AM

5 REPLIES

RE: disable "Save as"

Lei,

 

I think I have a way to accomplish this via an addin. We know when the SaveAs command is issued then we can return a E_ACCESSDENIED during the BeforeDocumentSave() event.

 

The only drawback to this approach is that the user can disable the addin via addin manager if they know how.

 

Posted by: Jason Newell
Post date: 6/17/2006 11:40:19 AM

RE: disable "Save as"

Thanks Jason,

 

I would like to know some detail on disabling "save as" through addin program, and possible solution package for real use. What is the best way to discuss this with you?

I would also like to ask all materials you’ve presented at “PLM world 2006” since I was not able to attend the event. Is there a place I can download?

 

Thanks for the help

 

Lei

 

 

Posted by: L S
Post date: 6/17/2006 3:26:54 PM

RE: disable "Save as"

Lei,

 

You can download everything that I presented this year here:

http://www.jasonnewell.net/public/SolidEdge/PLMWorld/2006/PLM_World_2006_Developer_Conference.zip

 

To answer your question about detail, what would you like to know? I don't know your background so I don't know where to start. Are you a developer or would you need me to develop something for you? i.e. Do you need me to tell you how to do it or do you just need me to do it for you? If you are a developer, it would help me to know what programming language you're targeting. I can pretty much do them all.

 

If you need to communicate to me directly you can send an email to admin@jasonnewell.net.

 

Thanks.

 

Posted by: Jason Newell
Post date: 6/17/2006 5:12:24 PM

RE: disable "Save as"

Lei,

 

In case you are a programmer, here is the C++ code to do what you want. Should be easily convertable to the language of your choice.

 

 

STDMETHODIMP CEventManager::raw_BeforeCommandRun(long theCommandID)

{

HRESULT hr = S_OK;

SolidEdgeDocumentPtr pDocument = NULL;

bool bBlockCommand = false;

 

try

{

pDocument = this->m_pApplication->ActiveDocument;

if (pDocument != NULL)

{

switch (pDocument->Type)

{

case SolidEdgeConstants::igAssemblyDocument:

bBlockCommand = theCommandID == SolidEdgeConstants::AssemblyFileSaveAs ? true : false;

break;

case SolidEdgeConstants::igDraftDocument:

bBlockCommand = theCommandID == SolidEdgeConstants:etailFileSaveAs ? true : false;

break;

case SolidEdgeConstants::igPartDocument:

bBlockCommand = theCommandID == SolidEdgeConstants:artFileSaveAs ? true : false;

break;

case SolidEdgeConstants::igSheetMetalDocument:

bBlockCommand = theCommandID == SolidEdgeConstants:Smiley FrustratedheetMetalFileSaveAs ? true : false;

break;

case SolidEdgeConstants::igWeldmentAssemblyDocument:

bBlockCommand = theCommandID == SolidEdgeConstants::WeldmentFileSaveAs ? true : false;

break;

case SolidEdgeConstants::igWeldmentDocument:

bBlockCommand = theCommandID == SolidEdgeConstants::WeldmentFileSaveAs ? true : false;

break;

}

 

if (bBlockCommand)

{

ISECommandPtr pCommand = this->m_pApplication->CreateCommand(SolidEdgeConstants::seNoDeactivate);

hr = pCommand->Start();

pCommand->Done = VARIANT_TRUE;

MessageBox(

(HWND)(ULONG_PTR)this->m_pApplication->hWnd,

"This command has been blocked by the addin",

"Addin",

MB_ICONINFORMATION | MB_OK);

}

}

}

catch(_com_error &e)

{

hr = e.Error();

}

 

return hr;

}

 

 

Posted by: Jason Newell
Post date: 6/17/2006 6:08:00 PM

RE: disable "Save as"

Posted By Jason Newell on 6/17/2006 4:40:18 PM

Lei,

 

...

 

The only drawback to this approach is that the user can disable the addin via addin manager if they know how.

 

 

 

Setting the AddIn property visible to false, prevents the AddIn from being listed in AddIn Manager, so the Users can not disable it.

 

Jürgen

 

Posted by: Sachin Chougule
Post date: 6/18/2006 5:53:52 PM