run exe file which is installed on the client machine from the web browser
I have a small exe file written in VB.NET which connects to database, gets the last row and send the information to the printer. It is just a small part of a program but it uses special font and also calculates the widths for the printer.
I've developed the same program with PHP. Now almost every functionality of it is same wirh the windows based program. But the printing results of the web browser can't be same as I get with the exe file. So I want to just send a 开发者_Go百科paramater to the exe file and run it. (with a javascript call or else) Exe file is on the client machine and I will know where it is the located.
Can you suggest me a way to do that. I read that this is possible using dll or ocx.
I'm not familiar developing browser plugins. Is there a tutorial or book for that? Thanks in advance.
If my machine suddenly asked me if it was ok for a website to download and run an exe, I'd have closed the window before the dialog had finished rendering.
The simplest thing to do here would be to fix the formatting of the php's output. Just because you can potentially execute an exe file on the client is a million miles away from meaning you should. Unless you know and have complete control over the users and the systems that those users are working on, any exe related system is going to be brittle at best and even if you do have that control, it's a bodge.
There are pdf libraries written for php that would permit you better control over your outputs, including fonts. There's a write up of one such library over at Sitepoint.
Alternatively, you could probably turn your .NET app into a web app/service that your php could communicate with.
Developing a browser plugin to do what you wan't isn't terribly difficult; I have to agree with JHolyhead that it'd be better to avoid doing this if you can, because there are some siginificant security considerations.
You'd need to know some C++ and you could use the FireBreath framework to write a plugin that would work on all platforms. Launching a process can be done using CreateProcessEx, and the main challenge you'll run into is that the process will be launched in low integrity mode in IE when you're on vista/win7 w/ UAC enabled (due to protected mode). The easiest fix for this is to just add the site to your list of trusted sites, but there are some ways to make it posible to launch the process is medium integrity (normal non-elevated) mode.
If you know C++ and have some experience with windows development, this would be very easy; if you don't, it might be a bit trickier. If there are other options (that dont' require you to install a browser plugin) you'd probably be better off following them. However, a basic FireBreath plugin can be thrown together in about 20 minutes (there are video tutorials).
精彩评论