1

I am trying to solve the doc to pdf conversion as described here.

Since there is no a Delphi component (with source code) that creates pdf from doc, I was wondering how it is possible to "register the COM at runtime".

I AM NOT USING AN INSTALLER, I just deploy the exe. So the idea was to simply put the ActiveX dll in the resources and register it at program startup (or the first time I need to use it). Anyway for sure this will give problems in Vista or 7... Can anyone suggest how this can be accomplished?

Keep in mind that I want to keep deployemnt super easy = replace an exe.

COMMENT: Of course If there was a Delphi component for doing this I would have no problem since that functionality would already be there in the exe.

Community
  • 1
  • 1
UnDiUdin
  • 14,924
  • 39
  • 151
  • 249
  • Does this MS article help at all? http://support.microsoft.com/kb/146219 – Scott W Jul 26 '10 at 16:07
  • 1
    What's the problem with an installer? There are several good reason to hinder a user without the proper privileges to register a COM server. You can also require your app to be run with elevated privileges - just don't cry then "Windows is not secure!!!" –  Jul 26 '10 at 19:10
  • do you just need to take a document and have a pdf created from it? have you looked at pdfcreator? it works like a printer but it's results are a pdf document that is saved. – Leslie Jul 26 '10 at 19:47
  • @ldsandon The problem with an installer is that now I just deploy an exe I don't want to be forced to write an isntaller just because I need to add 1 feature. – UnDiUdin Jul 29 '10 at 08:01
  • @leslie That is also an idea, I thought about that in the past. I could give the pdf export for doc files to my users by allowing them to configure a pdf printer (so they can use any printer). Then from the application I will print. – UnDiUdin Jul 29 '10 at 08:02
  • Running exes from directory which do not have proper privileges is always a security risk (for example I can change the exe and wait for a privileged user to run it too). Single exe deployment is nice, but risky. An installer should take care to put files in proper folders with proper privileges when run with proper privileges as well. DOS days should be really over. –  Jul 29 '10 at 18:24

4 Answers4

2

Vista and later support Non-admin ActiveX control (or per user ActiveX control): http://msdn.microsoft.com/en-us/library/dd433049(VS.85).aspx

2

You can also use Registration Free Com by specifying the dependancy in the exe's manifest. Some links:

Generate manifest files for registration-free COM http://msdn.microsoft.com/en-us/magazine/cc188708.aspx

Community
  • 1
  • 1
Remko
  • 7,214
  • 2
  • 32
  • 52
1

Usually EXE OLE servers ships with standard command line switch /RegServer - try to start exe with this one

Dewfy
  • 23,277
  • 13
  • 73
  • 121
  • May you explain this better? I am not an expert in this anyway once I used OLE Object to connect with MS Outlook, but in that case Outlook was already there, already installed, I didn't have to install anything. – UnDiUdin Jul 26 '10 at 15:46
  • Just try to start you EXE from cmd with explicit key: OleServer.exe /RegServer – Dewfy Jul 26 '10 at 16:58
1

Will you consider a commercial component? If so, the BoxedApp SDK will let you do exactly what you are describing in your question (and more) , without having to worry about UAC or anything else. It works great with Delphi and .NET.

It comes with a Delphi sample on how to run a flash movie by bundling the Flash OCX and registering it at runtime.

Yi Jiang
  • 49,435
  • 16
  • 136
  • 136
G-Man
  • 7,232
  • 18
  • 72
  • 100