ActiveX not working on client machine - activex

I'm trying to run activex control for a simple hello world message box.
First i created the class library and i have now the dll , then i created the HTML page and called the activeX control :
<!DOCTYPE>
<html>
<head>
<title>DemoActiveX</title>
</head>
<body>
<OBJECT id="DemoActiveX" classid="clsid:400DCE17-4B26-4E59-9A88-AF39E2BE4A55">
</OBJECT>
<script type="text/javascript">
try {
var obj = document.DemoActiveX;
if (obj) {
alert(obj.SayHello());
} else {
alert("Object is not created!");
}
} catch (ex) {
alert("Some error happens, error message is: " + ex.Description);
}
</script>
</body>
</html>
when i tried it in my machine i used to register the dll using regasm /codebase "dll path" and it worked fine.
The problem when i tried to run in another machine, i followed the coming steps :
1) I created setup project and added the dll file.
2) I created .inf file and tried two contents which are :
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Add.Code]
ActiveX.dll=ActiveX.dll
[ActiveX.dll]
file-win32-x86=thiscab
clsid=400DCE17-4B26-4E59-9A88-AF39E2BE4A55
FileVersion=1,0,0,0
RegisterServer=yes
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Setup Hooks]
install=install
[install]
run=msiexec.exe /package """%EXTRACT_DIR%\DemoActiveXSetup.msi""" /qn
3) I created .CAB file which contains the .inf and setup.exe files
4) Changed the object in HTML page to be :
<OBJECT id="DemoActiveX" classid="clsid:400DCE17-4B26-4E59-9A88-AF39E2BE4A55"
codebase="ActiveXCAB.CAB" ></OBJECT>
when i tried to open the page on the other machine a request windows opened which request to open CAB ,when i press yes nothing happened !!!!!
why it doesn't open the setup.exe or msi file ??
BTW when i installed manually the setup file the activeX worked !

I solved the problem :)
The problem was :
1) I used to put msi file only or setup.exe in CAB file but i must put both msi and setup.exe and refer to setup.exe in inf file
2) inf file format was wrong , the correc one is :
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Add.Code]
setup.exe=setup.exe
[setup.exe]
file-win32-x86=thiscab
clsid={415D09B9-3C9F-43F4-BB5C-C056263EF270}
FileVersion=1,0,0,0
[Setup Hooks]
RunSetup=RunSetup
[RunSetup]
run="%EXTRACT_DIR%\setup.exe"
Good Luck :)

Related

Problem in printing a webpage containing SVG images in Chromium

I have a html file with the following content:
<html>
<body>
<object data="https://upload.wikimedia.org/wikipedia/commons/0/09/America_Online_logo.svg" type="image/svg+xml"></object>
</body>
</html>
As you can check, you can open it with chrome and print it.
But if I use Chromium.Print method, it print empty pages.
Note that this is only a sample. All SVG images had the same problem.
I use Delphi 10.3.2 and CEF4Delphi.
Can any one guide me?
This is very likely caused by the CEF issue #3297 and the workaround described in that report works.
Add this code line before the GlobalCEFApp.StartMainProcess call :
GlobalCEFApp.DisableSiteIsolationTrials := True;
I tested this workaround with the latest CEF4Delphi version which uses CEF 100.0.14 and the MiniBrowser demo. Your sample HTML is printed correctly with TChromiumCore.Print and TChromiumCore.PrintToPdf.

Application Cache Error event: Failed to parse manifest in C# MVC

I have build App in C# MVC and I'm using HTML5 Application cache manifest for run application even if internet unavailable. my code is as below.
Controller (Home):
public ActionResult Manifest()
{
Response.ContentType = "text/cache-manifest";
return View();
}
View (Manifest.cshtml)
CACHE MANIFEST
NETWORK:
*
CACHE:
~/Scripts/stylesheets/bootstrap.min.css
FALLBACK:
#{
Layout = null;
}
Layout.cshtml
<html manifest="/Home/Manifest">
But i am getting Error : Application Cache Error event: Failed to parse manifest
does i need to include view.cshtml files path in Cache in Manifest file?
I have tried some solution posted earlier in stackoverflow but not found any solution.
I have resolved this issue in visual studio for MVC application. follow below steps:
I have created .appcache file in notepad and copy manifest file content into it. (you don't need to create .Manifest file OR Manifest.cshtml view. just create .appcache file in notepad.)
give reference as <html manifest="~/example.appcache"> in view and issue will be resolved

Why copy & paste dart2js' output to console doesn't work?

compile the following code with dart2js -o test.js test.dart
open test.js, copy its content
open browser, go to stackoverflow.com
open dev tools, go to console tab
paste test.js's content into console, hit Enter
I expect it to click the "Ask Question" button, but it doesn't, why?
(The reason I want to do this is, I need some js, but I don't want to touch js.)
// test.dart
import 'dart:html';
void main() {
document.querySelector('#nav-askquestion').click();
}
I didn't dig very deep but I had the impression the generated code registers itself for a script loaded event and then executes "main" as event handler. I don't know JavaScript and browser behavior good enough to understand how this can work.
I got it working by running this code in the dev console
(function runTest() {
var s = document.createElement("script");
s.type = "text/javascript";
s.src = "test.js";
document.body.appendChild(s);}
)();
where the test.js (generated output from dart2js) file is in the same directory as the index.html.
The code adds the script tag referencing the dart2js output dynamically and the code in test.js is executed.

Uploadify not uploading file, but indicates success

I have found some posts with the same problem I have, however, no solutions presented. I am not 100% sure what to make of this, but hope you can help.
I am attempting to use Uploadify to upload files, but the following happens:
Browse for file successful (hence my 'script' and 'uploaded' attributes are correct)
Progress bar says "100%" and completes.
onComplete fires saying upload successful (according to the path alerted, 'folder' attribute is correct.)
If I die my script before any output, the #3 step does not happen - hence it reaches the 'script' specified. After output, the script doesn't die.
FILE IS NOT FOUND IN FILESYSTEM
Not sure how this is possible - as far as I can tell, everything is correct.
Here is my code:
<script type="text/javascript">
$(document).ready(function() {
$("#addimage").validationEngine();
$('#imagefile').uploadify({
'uploader': "/js/uploadify/uploadify.swf",
'fileExt': "*.jpg;*.jpeg;*.png;*.gif",
'buttonText': "Browse...",
'script': "/js/uploadify/uploadify.php",
'cancelImg': "/js/uploadify/cancel.png",
'folder': "/uploads",
'fileDesc': 'Only *.jpg, *.jpeg, *.png, *.gif are allowed',
'auto': true,
'onComplete': function(event, ID, fileObj, response, data) {
$('#name').val('Please edit this text to add a description...');
alert('Uploaded ' + fileObj.name + ' to ' + fileObj.filePath + '.');
}
});
});
</script>
<input type="file" id="imagefile" name="imagefile" />
<?php
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//', '/', $targetPath) . 'image_' . date('YmdHis') . '_' . $_FILES['Filedata']['name'];
move_uploaded_file($tempFile,$targetFile);
echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);
}
?>
The PHP script's only change is the name of the targetFile which I have changed, to ensure some sort of unique filename (although not foolproof) but otherwise the script is the same as released (with comments removed here for brevity purposes).
Can anybody tell my why Uploadify indicates that the file upload was successful, but no file exists in the uploads directory? I am using Windows, PHP5.3, and the uploads folder is writable (I can upload files there without Uploadify, but not with it)
Thanks in advance!
Kobus
I had similar problems on a Linux machine. It turned out that the PHP configuration on my server was the cuplrit. PHP was running in SAFE MODE. As I had uploaded the Uploadify scripts via FTP, so script files were stored in the file system with my FTP user details. Since PHP's temp folder was owned by the server root, I had a UID mismatch, i.e. the temporary upload file was attributed to root while the upload script that tried to move it was owned by the FTP user. That fragged it.
To resolve this I changed the ownership of the uploadify php script to root and from there on it worked.

firefox addon installation issue

After worked on many small addon i want to put those add on on my server so that people can download it and use it so that i can get the feedback from the people ..but when i am downloading it from my server(it is a xpi file) getting following error..
Firefox could not install the file at
http://abhimanyu.homeunix.com/Work/abhiman_2k5#yahoo.com.xpi
because: Install script not found
-204
but when i m putting these files manually in the path it works fine..After fiddling many hours couldn't figure it out whats the problem ...please help me.
I assume that you are letting the users download your add-on through some install button.
Unfortunately, its not as simple as pointing the browser to the xpi file on the server's file system. Below, I have pasted the script that installs Omture when the user presses on the "Download Omture" button on the add-on's website which you could also find using firebug.
function installExt()
{
var url="omture_current.xpi";
InstallTrigger.install({
"Omture": { URL: url,
toString : function() { return this.URL; } } });
return false;
}

Resources