Jump to content

Search the Community

Showing results for tags 'cocreateinstance'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • uniGUI Public
    • Announcements
    • General
    • Feature Requests
    • Installation
    • Deployment
    • Other Platforms
  • Licensing
    • Licensing
    • Ordering uniGUI
  • Bug Reports
    • Active Reports
    • Closed Reports
    • Old Bug Reports
  • uniGUI Development
    • General Development
    • uniGUI Releases & Roadmaps
    • Utilities
  • Mobile Platform
    • uniGUI Mobile
    • Mobile Browsers
  • Users Area
    • Sample Projects
    • Components and Code Samples
    • Third Party Components
  • Non-English
    • Non-English
  • Miscellaneous
    • Hosting
    • Server Security
    • Jobs

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. I have some code that LOCKS UP the DLL when running is ISAPI mode. Here's my code.... Function CreateShortCut_Lnk(RealFile,Parms,ShortCutName,LpszDescStr:AnsiString):Boolean; Var psl:IShellLink; ppf:IPersistFile; HRes:HRESULT; wsz:PWideChar; {Max_Path} LpszParms,LpszPathObj,LpszPathLink,LpszDesc:Array[0..Max_Path] {$IFDEF VER120} Of Char; {$ELSE} Of WideChar; {$ENDIF} Begin TranslateForVista(ShortCutName); StrPCopy(LpszPathObj,RealFile); StrPCopy(LpszPathLink,ShortCutName); StrPCopy(LpszDesc,LpszDescStr); StrPCopy(LpszParms,Parms); { CoInitialize(Nil); } GetMem(Wsz,Max_Path*SizeOf(WideChar)); Hres:=CoCreateInstance(CLSID_ShellLink, Nil, CLSCTX_INPROC_SERVER, {$IFDEF VER120} IID_IShellLinkA, {$ELSE} IID_IShellLinkW, {$ENDIF} psl); If (SUCCEEDED(Hres)) Then Begin psl.SetPath(lpszPathObj); - Seems to lock up on this line psl.SetDescription(lpszDesc); psl.SetArguments(lpszParms); Hres:=psl.QueryInterface(IPersistFile,ppf); if (SUCCEEDED(Hres)) Then Begin MultiByteToWideChar(CP_ACP, 0, PAnsiChar(AnsiString(lpszPathLink)), -1, wsz, MAX_PATH); Hres:=ppf.Save(wsz, TRUE); End; End; FreeMem(Wsz,Max_Path*SizeOf(WideChar)); { CoUnInitialize; } Result:=SUCCEEDED(Hres); End; This basically allows me to create a shortcut file easily. I call it like this.... CreateShortCut_Lnk('TestShortCut.txt','',ExtractFilePath(ApplicationDLLName)+'TestShortCut.lnk','You can delete this file'); This allows me to create a test shortcut file that points to "TestShortCut.TXT". When done during the initialization phase of a normal VCL program, it fixes a bug that VISTA has with memory leaks. Anyway, during the DLL ASAPI mode, when it hits the RED line, it basically messes up the uniGUI system. It make it lock up and stop servicing the other apps in the application pool. If I run the uniGUI in EXE mode, then it works fine. It's just in DLL mode that it hangs. What's wierd is that when I take out the call to CreateShortCut_Lnk in my INITIALIZATION code of my unit, and INSTEAD put the code on a buttonClick event, IT WORKS FINE and creates the shortcut and doesn't lock up I think this is some sort of COM stuff, so maybe that's the deal. HINT: If I DO NOT put it in the initialization section of my unit, and simply call it from a button click, then it WORKS. Very wierd. Yet ANOTHER difference between the EXE mode and the DLL mode Any ideas why the lock up? Davie
×
×
  • Create New...