Is it possible to convert a .EXE into an ActiveX object? - activex

Convert might be the wrong word, but to save a user having to install something I wondered if a small EXE can be embedded in a web-page (IE only) using ActiveX so it is run when a button is pressed. Obviously a big security hole but is it feasible?

Urgh, just thinking about it makes me die a little inside.
But yes, package up the exe and the activex in a cab file and use the activex to launch the exe.
Info on packaging up ActiveX cab files is here: http://msdn.microsoft.com/en-us/library/aa751974(v=vs.85).aspx
A bit more information on Inf files (specifically the DestDir bit): http://msdn.microsoft.com/en-us/library/aa741215(v=vs.85).aspx
This would allow you to put the exe in a known location (Windows or System) so that you could execute it from the activex control providing permissions were set correctly

Related

Which tool can I use for viewing WRX files?

I'm working with Progress-4GL, release 11.6, appBuilder and procedure editor.
While working with OCX components, a WRX-file gets automatically created by the appBuilder. I would like to see the content of that WRX-file.
Currently, I've found this website, which also mentions that Progress IDE should contain such a viewer, but even after checking all Pro*tools, I didn't find any tool.
Does anybody know which tool of the Progress-4GL appBuilder/procedure editor toolchain allows viewing WRX-files?
Thanks in advance
According to Progress Knowledgebase, WRX files contain only design and runtime license keys (if required by the ActiveX Controls) along with any custom property settings that were made to any ActiveX Control in the windows. WRX files do not contain any ABL source or .r code.
If it indeed is an OCX you want to look into you can use the Com Object Viewer.
It can be found a couple of different ways.
Quick Access Search in Developer Studio:
Via Pro*Tools under the Tools menu in the AppBuilder
Once started you can use it to open OCXes and Automation Objects to look at the internal API's of those.
You need to locate the file it's stored in. This could be either by knowledge of it's location or other way. If you add an OCX to a ABL Windows/Dialog program you will see the location of the control there:
Then you can open it in the Com Object Viewer to see methods, events and such and also get some short coding help.

How to write Delphi ActiveX control which can be used in MS Word/Excel/Powerpoint?

[ToDo] (1) As indicated from NGLN's helpful answer, using simpler keywords such as "Delphi ActiveX control" to search. (2) Consuming the ActiveX control in Word/Excel/Powerpoint is yet another step. [/ToDo]
[Useful links]
Writing ActiveX Controls in Master Delphi 7
create non visual activex control with delphi
Error Could not load unit [unit] symbol information for [TClassName]
=======
Or what books and courses to learn if I want to write in Delphi a well-behaved ActiveX control which can be used in Microsoft Word/Excel/Powerpoint ?
Very sorry if this should be a bad question without programming details. However, when I search in the internet materials, almost all I get is about "how to manipulate/embed/host Word/Excel/Powerpoint in Delphi application". Is it because there are other languages/toolkits best suited for creating ActiveX controls which can be used in Microsoft Word/Excel/Powerpoint ?
The reason why I am trying:
What I do now : (1) A Delphi application is used to produce a image file. (2) This image file is pasted in a Excel report. (3) When different representation of the image is needed, one repeat (1) and (2). That is to say, one need to switch between applications.
My goal is to have : (1) A Delphi ActiveX is embeded/hosted in a Excel report. When different representation of the image is needed, one can thus manipulate through the Delphi ActiveX within the Excel report, and do not need to go elsewhere or switch between applications.
You can create an ActiveX control by following these steps:
Design your control as installable component, inherit from TWinControl or below
Publish properties you want to use, once as ActiveX control
Add it to a registerable package
Install that package into the Delphi IDE
Close all
Choose File > New > Other... > ActiveX > ActiveX Library
Choose File > New > Other... > ActiveX > ActiveX Control
Choose your component from the VCL Class Name combo box
Set the threading model you want to support. Apartment is the default and probably preferrable.
Build the project
Register the OLE Control Extension (.ocx) that Delphi created with regsvr32.exe
That is how I added a Delphi DXF control to an Access database:
Note that you will need a 64-bit ocx for a 64-bit MS Office installation (regardless of the Windows version).
For reference: the chapter in the documentation dealing with creating COM objects starts here.

Delphi XE3 App with ActiveX / COM objects

I'm a bit confused on something, being quite a while since I've used external controls. Basically, I'm writing a small test app with Delphi XE3 which uses an ActiveX control. A TLB file is generated as usual. I have tested on two machines (an Acer notebook and a Dell Latitude 10). When I test on my desktop Windows machine I get an error traceable to the OCX file. I was under the impression that the TLB.pas file was all that was needed to instantiate the control. Do I also need to install and register the OCX file ? Does COM component need to be distributed with its .DLL file ? TIA for your anticipated help.
Brian Corll
The type library only describes how to call the library. The .pas file generated from the type library also only describes how to call the library. That's all compile time. At run time when you actually call the library, you need the library to be registered and present.
So yes, you'll need to distribute and register the library.

Need to know if a exe file contains at least an icon

I need to know if a exe file contains at least one icon. A fast way, if that's possible.
I tried with PrivateExtractIcons and it works, but only for 32 bit exe files.
It's not working for 64 bit exe files.
I need this to work with any exe file in any Windows >= XP (x86 and x64).
I'm using Delphi 2009.
Call LoadLibraryEx passing LOAD_LIBRARY_AS_DATAFILE or LOAD_LIBRARY_AS_IMAGE_RESOURCE.
Call EnumResourceTypes to check if the module has any icon resources.
Note that this is not exhaustive since some applications (e.g. modern Office) store their image assets in custom form and not icon resources.

How do I embed a binary within a Delphi executable and extract at runtime?

I'd like to embed an executable inside of my Delphi binary and extract it at runtime. The purpose of this is to ensure that a helper utility is always available on the system, without having to distribute multiple files.
With Delphi 2007 I have used JvDataEmbedded, but I am building a console application and I want to know if anyone knows of another way to do it without having to add a hidden form for JvDataEmbedded.
I am using Delphi 2010.
Build a RC file that embeds this program as a resource, and then at runtime you can extract it with a TResourceStream. (See the accepted answer to this question of mine for the general principle.) You can chain the TResourceStream to a TFileStream to write it out to a temp file, then run it.
Cool Trick, Mason!
To add... It occurred to me that this could run into trouble with UAC/permissions if the "mothership" dumps teh "scout ship" diretly into the same directory as it's running from. If you're on Vista/Windows7, regular programs are prevented from writing to the "\program files" directory, when run without elevated permissions. So in that case, the file will likely be placed into a shadow directory. It gets better: you may have different results if you launch the "mothership" program from an installer, as setup programs have special access, and they may temporarily give that access to programs that they launch (which makes it somewhat hazardous to always say YES to "do you want to run the program now?" at the end of installation).
Use a TDataModule to hold the TJvDataEmbedded instead of a TForm.

Resources