Click here to Skip to main content
15,884,176 members
Home / Discussions / COM
   

COM

 
GeneralRe: How to Rreference COM object(tlb file) in VC++ Pin
Jahnson K22-Mar-08 11:31
Jahnson K22-Mar-08 11:31 
GeneralRe: How to Rreference COM object(tlb file) in VC++ Pin
User 21559723-Mar-08 2:28
User 21559723-Mar-08 2:28 
AnswerRe: How to Rreference COM object(tlb file) in VC++ Pin
pnpfriend24-Mar-08 9:34
pnpfriend24-Mar-08 9:34 
GeneralRe: How to Rreference COM object(tlb file) in VC++ Pin
Jahnson K25-Mar-08 7:35
Jahnson K25-Mar-08 7:35 
GeneralRe: How to Rreference COM object(tlb file) in VC++ Pin
Jahnson K27-Mar-08 13:04
Jahnson K27-Mar-08 13:04 
GeneralRe: How to Rreference COM object(tlb file) in VC++ Pin
Vi23-Apr-08 20:19
Vi23-Apr-08 20:19 
GeneralRe: How to Rreference COM object(tlb file) in VC++ Pin
Jahnson K7-Apr-08 8:19
Jahnson K7-Apr-08 8:19 
AnswerRe: How to Rreference COM object(tlb file) in VC++ Pin
Member 38312474-Apr-08 3:21
Member 38312474-Apr-08 3:21 
GeneralTAPI related Question Pin
ritz123421-Mar-08 0:44
ritz123421-Mar-08 0:44 
GeneralGetting E_ACCESSDENIED when calling IPersistFile:Save Pin
TClarke20-Mar-08 6:08
TClarke20-Mar-08 6:08 
Hi all

I'm calling IPersistFile:Save on my local machine logged in with administrator rights and I'm getting a security error any ideas would be very welcome.
I'm using VS2005 on XP SP2

Here's the code, it's basically pulled out of the VS documentation:

HRESULT CShellLink::CreateLink(LPCSTR lpszPathObj, LPCSTR lpszPathLink, LPCSTR lpszDesc, LPCSTR lpszArgs) 
{ 
	HRESULT hres; 
	IShellLink* psl; 
	::CoInitialize(NULL);
		// Get a pointer to the IShellLink interface. 
	hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, 
		IID_IShellLink, (LPVOID*)&psl); 
	if (SUCCEEDED(hres)) 
	{ 
		
		IPersistFile* ppf; 

		// Set the path to the shortcut target and add the description. 
		psl->SetPath(lpszPathObj); 
		psl->SetDescription(lpszDesc); 
		psl->SetArguments(lpszArgs);

		// Query IShellLink for the IPersistFile interface for saving the 
		// shortcut in persistent storage. 
		hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf); 

		if (SUCCEEDED(hres)) 
		{ 
			WCHAR wsz[MAX_PATH]; 

			// Ensure that the string is Unicode. 
			if ( ! MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1, wsz, MAX_PATH)) {
				DisplayLastError();
			} else {

				// Save the link by calling IPersistFile::Save.
				hres = ppf->Save(wsz, TRUE); 
				if ( ! SUCCEEDED(hres)) {
					DisplayLastError();
				}
			}		
			ppf->Release(); 
		} 
		psl->Release(); 
	} 
	return hres; 
}


Cheers
Tom

Philosophy: The art of never getting beyond the concept of life.
Religion: Morality taking credit for the work of luck.

GeneralRe: Getting E_ACCESSDENIED when calling IPersistFile:Save Pin
Nathan Holt at EMOM20-Mar-08 8:43
Nathan Holt at EMOM20-Mar-08 8:43 
GeneralRe: Getting E_ACCESSDENIED when calling IPersistFile:Save Pin
Member 785300318-Apr-11 14:13
Member 785300318-Apr-11 14:13 
Questionwhere is the type library for IDataObject ? Pin
Vlasta_20-Mar-08 1:05
Vlasta_20-Mar-08 1:05 
GeneralRe: where is the type library for IDataObject ? Pin
Nathan Holt at EMOM20-Mar-08 9:42
Nathan Holt at EMOM20-Mar-08 9:42 
GeneralRe: where is the type library for IDataObject ? Pin
Vlasta_20-Mar-08 13:40
Vlasta_20-Mar-08 13:40 
GeneralRe: where is the type library for IDataObject ? Pin
Vi23-Apr-08 20:35
Vi23-Apr-08 20:35 
GeneralError when calling a dll from asp Pin
WinCrs19-Mar-08 23:37
WinCrs19-Mar-08 23:37 
GeneralRe: Error when calling a dll from asp Pin
User 21559720-Mar-08 10:16
User 21559720-Mar-08 10:16 
GeneralServer busy message [modified] Pin
sheetal_0618-Mar-08 18:38
sheetal_0618-Mar-08 18:38 
GeneralRe: Server busy message Pin
User 21559720-Mar-08 10:13
User 21559720-Mar-08 10:13 
QuestionHow to make ActiveX Control Redraw in a work thread? Pin
samfromcn18-Mar-08 16:42
samfromcn18-Mar-08 16:42 
AnswerRe: How to make ActiveX Control Redraw in a work thread? Pin
Lim Bio Liong19-Mar-08 18:44
Lim Bio Liong19-Mar-08 18:44 
GeneralRe: How to make ActiveX Control Redraw in a work thread? Pin
samfromcn20-Mar-08 7:18
samfromcn20-Mar-08 7:18 
GeneralRe: How to make ActiveX Control Redraw in a work thread? Pin
Lim Bio Liong20-Mar-08 17:00
Lim Bio Liong20-Mar-08 17:00 
QuestionIs it good to use ref Parameter with a COM Method in C# Pin
madhankum18-Mar-08 5:07
madhankum18-Mar-08 5:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.