ComDlg32.ocx Error: Object doesn't support this property or method - comdlg32

I'm developing an html editor using ComDlg32.ocx (Commom Dialog Control), using HTML and VBScript. My exact requirement was to prompt Open/Save/Color/Print/Font dialog boxes.Ive written code for prompting Save file dialog box. Also I've added a license file using LPK Tool onto my webpage.
My html-source looks like:
<body>
<!-- lpk file -->
<object classid="clsid:5220cb21-c88d-11cf-b347-00aa00a28331">
<param name="LPKPath" value="License/comdlg.lpk" />
</object>
<!-- Microsoft Common Dialog Control -->
<object classid="CLSID:F9043C85-F6F2-101A-A3C9-08002B2F49FB" codebase="http://activex.microsoft.com/controls/vb6/COMDLG32.CAB" id="objComDlg"></object>
</body>
Now, here comes my error. Whenever I try to call the vbscript for prompting the Save File dialog box, I'm getting an error as:
Object doesn't support this property or method: 'objComDlg.Filter'
If I comment out the objComDlg.Filter then the error move on to objComDlg.DialogTitle and thus it goes on.
And my VBScript look like:
FILE_FORMATS = "Rich Text Format (*.rtf)|*.rtf|Microsoft Word (*.doc)|*.doc|ANSI Text Document (*.txt)|*.txt"
objComDlg.Filter = FILE_FORMATS <--- Error shows here
objComDlg.DialogTitle = "Save As "
objComDlg.Flags = cdlOFNFileMustExist Or cdlOFNHideReadOnly
objComDlg.CancelError = True
objComDlg.ShowSave
Does anyone have an idea why this is happening? Is there any proper documentation for using this particular ActiveX control? My current development is in stand-still due to this error.
BTW, I'm using Windows XP SP3 and IE8 for my development.

It sounds like your problem may be related to some major changes MS made to OCX libraries to fix various security holes in the controls. I notice you are running SP3, this probably included the fixes, which appear to have had knock-on effects on the controls, e.g. some methods have disappeared!
I ran into the same problem - a method was being called in a legacy app on msflxgrd.ocs (Rows method) which did not seem to exist. Took me friggin ages to find the solution. My guess is you either need to roll back the security update, or change your code to not use that missing objComDlg.Filter method.
See this article for more info.
-- EDIT
OK I have some more specific info now, this worked for me (except my problem was with msflxgrd.ocx, but I think it's the same issue).
There is a specific microsoft update (KB960715) which has plugged some holes in ActiveX controls, so the vulnerable methods are still there in the controls but are blocked by killbits. Removing the update has solved my problem, obviously if you can it would be better to change your code, because removing the update makes you vulnerable to exploits it was designed to fix!

I have been experiencing exactly the same problem, but it only occurs on certain machines. I managed to recreate the problem with the following steps:
Using Microsoft Virtual PC 2007, install a clean build of XP Pro.
Without installing anything else, other than the VM Addons, apply all of the MS Updates.
Run the code as described above. I have provided an alternative below too.
It would seem that the problem has occurred through an MS update. Using the KB240797 knowledge base article (http://support.microsoft.com/default.aspx/kb/240797?p=1), I was able to determine that a kill bit had been issued for the Common Dialog ActiveX control, and an alternative class ID provided (8F0F480A-4366-4737-8265-2AD6FDAC8C31), suggesting that the control had been superseded. However, after checking other machines on which the control worked, specifically development machines (XP Pro x64, XP Pro x32 & Vista x32), each with a copy of Visual Studio 2008 installed, there was no kill bit entry nor was there an alternative class ID.
To get the dialog working, I simply renamed the registry key (I could have deleted it as well), meaning that there was no longer a kill bit. Hey presto, it worked!
The registry key is:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet
Explorer\ActiveX
Compatibility{F9043C85-F6F2-101A-A3C9-08002B2F49FB}
I guess that there is a chance that this will be re-applied with a future Microsoft cumulative update, and it may also open up some security vulnerability.
I hope that that helps you. Thanks for your original post as it seems to have set me on the right track.
Kaine
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Common Dialog Test</title>
<script language="vbscript" type="text/vbscript">
Sub AlertErr()
On Error Resume Next
document.objComDlg.Copies = 1
document.objComDlg.FromPage = 1
document.objComDlg.ToPage = 1
document.objComDlg.Min = 1
document.objComDlg.Max = 1
document.objComDlg.Flags = cdlPDHidePrintToFile Or cdlPDNoSelection
document.objComDlg.CancelError = True
printerDialog = document.objComDlg.ShowPrinter
If Err.Number = 0 Then
Call MsgBox("No Error. The print simulation worked as expected.")
ElseIf Err.Number = 32755 Then
Call MsgBox("You clicked the 'Cancel' button.")
Else
Call MsgBox("The following error occurred: " & Err.Description & " (" & Err.Number & ")")
End If
End Sub
</script>
</head>
<body>
<div>
<button id="btnAlertErr" onclick="AlertErr()">Print Me</button>
<object classid="clsid:5220cb21-c88d-11cf-b347-00aa00a28331">
<param name="LPKPath" value="CommonDialog.lpk">
</object>
<object id="objComDlg" codebase="http://activex.microsoft.com/controls/vb6/comdlg32.cab" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" viewastext>
<param name="_ExtentX" value="847" />
<param name="_ExtentY" value="847" />
<param name="_Version" value="393216" />
<param name="_Version" value="393216" />
<param name="CancelError" value="0" />
<param name="Color" value="0" />
<param name="Copies" value="1" />
<param name="DefaultExt" value="" />
<param name="DialogTitle" value="" />
<param name="FileName" value="" />
<param name="Filter" value="" />
<param name="FilterIndex" value="0" />
<param name="Flags" value="0" />
<param name="FontBold" value="0" />
<param name="FontItalic" value="0" />
<param name="FontName" value="" />
<param name="FontSize" value="8" />
<param name="FontStrikeThru" value="0" />
<param name="FontUnderLine" value="0" />
<param name="FromPage" value="0" />
<param name="HelpCommand" value="0" />
<param name="HelpContext" value="0" />
<param name="HelpFile" value="" />
<param name="HelpKey" value="" />
<param name="InitDir" value="" />
<param name="Max" value="0" />
<param name="Min" value="0" />
<param name="MaxFileSize" value="260" />
<param name="PrinterDefault" value="1" />
<param name="ToPage" value="0" />
<param name="Orientation" value="1" />
</object>
</div>
</body>
</html>

Do you create your objComDlg above the VBscript you posted? Something like:
Dim objComDlg As Object : Set objComDlg = CreateObject("MSComDlg.CommonDialog")

Related

Get the silverlight player into fullscreen mode from outside the silverlight code

I have a silverlight mediaElement embeded in my asp.net page as follow:
<object id="SilverlightPlayer" data="data:application/x-silverlight,"
type="application/x-silverlight-2" width="753" height="468" >
<param name="source" value="ClientBin/VideoPlayer.xap"/>
<param name="EnableGPUAcceleration" value="true" />
<param name="OnResize" value="HandleResize" />
<param name="autoUpgrade" value="true" />
<param name="onLoad" value="pluginLoaded" />
<param name="windowless" value="true" />
<param name="background" value="transparent" />
<param name="initParams" id="SLInitParameters" />
</object>
I am implementing all the player controls from the asp.net side and invoking the SL methods using the javascript bridge. Everything works fine except the ability to put the silverlight player in full screen mode. content.IsFullScreen = True;
I have tried calling a method from javascript:
[ScriptableMember]
public void mediaFullScreen()
{
var content = Application.Current.Host.Content;
content.IsFullScreen = !content.IsFullScreen;
}
I put a button in the Silverlight code which works fine. So, I had the javascript call a the function above. I then changed the code invoke the click event on the SL full screen button, however, that does not work either:
ButtonAutomationPeer peer = new ButtonAutomationPeer((Button)this.fullScreenButton);
IInvokeProvider ip = (IInvokeProvider)peer;
ip.Invoke();
I even wired up an event handler in the SL code to process the click event on the tag:
HtmlDocument htmlDoc = HtmlPage.Document;
HtmlElement htmlEle = htmlDoc.GetElementById("buttonFullScreen");
htmlEle.AttachEvent("onclick", new EventHandler(this.OnConvertClicked));
Is there anyway I can get the SL to go into full screen mode from my tag in the asp.net code?
(Using VS2010 and SL4)
Thanks,
Dave
From the full screen support documentation:
A Silverlight-based application can enter full-screen mode only in
response to a user-initiated action.
and:
Limiting the actions that enable full-screen mode ensures that the user is always the initiator of full-screen mode behavior.
This is the case also for other things, eg launching an open file dialog.
If you need to initiate from JavaScript you may have to turn to another approach from the Silverlight full-screen mode, ie maximizing it within the browser.

Suppressing the Tool Information in Adobe

I've been searching for a way to prevent the download of a PDF and I finally found one in HTML5. The code is really simple and is
<embed src="filename.pdf#toolbar=0&navpanes=0&scrollbar=0" width="500" height="375">
The things that suppress the adobe options is #toolbar=0&navpanes=0&scrollbar=0.
My question is, is there a way to do this in non-html5 code? I've tried the following:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
width="99%" height="99%" id="pdf" style="position:absolute; z-index:-1;">
<param name="movie" value="filename.pdf#toolbar=0&navpanes=0&scrollbar=0">
<param name="quality" value="high">
<param name="wmode" value="opaque" />
<param name="Enabled" value="1" />
<param name="toolbar" value="0" />
<param name="navpanes" value="0" />
<param name="scrollbar" value="0" />
<param name="bgcolor" value="##FFFFFF">
<embed nav src="filename.pdf#toolbar=0&navpanes=0&scrollbar=0" quality="high" bgcolor="##FFFFFF" width="99%" height="99%"
name="2003map" align="" type="pdf">
</embed>
</object>
I am not 100% but try adding the values also into the <embed>
<embed nav src="filename.pdf" quality="high" bgcolor="##FFFFFF" width="99%" height="99%"
name="2003map" align="" type="pdf"
toolbar="0" navpanes="0" scrollbar="0"
</embed>
This doubling of info works for wmode so may very well work here too :)
as your users are using a client side engine to render the PDF document there is no way to stop them downloading or saving it. at some point or way the document arrives at the client machine. in case of html it's always easy to have all resources you serve to be saved.
you have to render it on the server if you don't what your pdf as pdf in any case on your client's machine.
you can use an obfuscated flash in combination with Flash Pdf viewer just like scribd and have the pdf's path hidden but this is not 100% secure, because the resource remains accessible, but you can return it as binary from a server side after your viewer swf has identified itself.

dotnetnuke dnnLEFTMENU doesn't show up in custom skin

I'm working on my own dotNetNuke skin, and I'm trying to add a dnnLEFTNAV to my skin. However, I'm having trouble getting it to show up in the skin itself. This is what my invocation in my .html skin looks like:
<object id="dnnLEFTMENU" codetype="dotnetnuke/server" codebase="LEFTMENU">
<param name="Width" value="165px" />
<param name="ShowOnlyCurrent" value="RootItem" />
<param name="MaxLevel" value="2" />
<param name="EnableEmbeddedSkins" value="false" />
<param name="Skin" value="MinimalExtropy" />
</object>
When the skin is uploaded, the .html is converted to .ascx, and the incovation ends up looking like this:
<dnn:LEFTMENU runat="server" id="dnnLEFTMENU" Width="165px" ShowOnlyCurrent="RootItem" MaxLevel="2" EnableEmbeddedSkins="false" Skin="MinimalExtropy" />
There's also a header:
<%# Register TagPrefix="dnn" TagName="LEFTMENU" Src="~/Admin/Skins/LeftMenu.ascx" %>
However, when I look at the completed page, there is absolutely nothing where the LEFTNAV should be.
What makes this even odder is that I essentially pulled this code verbatim out of the Minimal Entropy skin, and a test page with the Minimal Entropy skin has the nav showing up as expected.
Any ideas?
Oh boy is my face red. The page I was using the LEFTMENU on had no child menus...I was expecting it to include same-level items or at least the shell of an empty navigation but apparently not.
PBKAC

Does Google index HTML content supplied by the Object tag

This might be a weird question, but I've been unable to find an answer. Assuming I were to use an Object tag to embed an HTML snippet from an outside source (different server), how does Googles spider view that data? Does it pull in the data source like a browser would or does it only view the alternate content found between the Object tags like an old browser would do?
Example:
<object data="http://www.remotehost.com/data/test.html" type="text/html" width="300" height="200">
alt : test.html
</object>
Does only the "Alt : test.html" get read, or does the source "data/test.html" also get indexed as if it were part of the page?
I basically have an HTML content that customers need to include in their pages without having to do it dynamically using whatever back-end they use to prepare their page (PHP, JSP or whatever). They need the simplest method that doesn't require much back-end work on their part. I'm curious if this method would allow them to have that content included in their search results (their site) and not be indexed as my content from my server (index as content for my domain).
Using Google's Developer Toolbox, and Fetch as Googlebot, I was able to see how the Google spider would interpret the page and it doesn't process the Object data at all. Too bad, I guess I'll have to find another solution.
It seems to me Google had started crawling for things in Object tag since May 2013 and this had caused massive trouble with us.
For example, consider the following Flash embed code:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0"
width="464" height="419" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="http://www.example.com/user-guide/loader.swf" />
<param name="base" value="http://www.example.com/user-guide/" />
<param name="flashvars" value="datasource=data.xml" />
<param name="loop" value="false" />
<param name="menu" value="true" />
<param name="quality" value="best" />
<param name="wmode" value="transparent" />
<param name="bgcolor" value="#ffffff" />
<embed src="http://www.example.com/user-guide/loader.swf" base="http://www.example.com/user-guide/"
flashvars="datasource=data.xml"
loop="false" menu="true" quality="best" wmode="transparent"
bgcolor="#ffffff" width="464" height="419" align="middle"
allowScriptAccess="always" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
</object>
What I found is Google now starts to crawl the http://www.example.com/user-guide/ folder which supposed to be a directory path, result in massive 403 forbidden error!
Google has crawled, recognized and indexed object tags since July-2011. Anything that meets Schema.org standards has the potential to be interpreted and even included in search results where applicable.

ExternalInterface.call("window.location.host.toString")

I wrote a flex application that get the host string from the browser using this code
ExternalInterface.call("window.location.host.toString")
This line of code work prefectally to get the host string in both Firefox and Opera. However, when using IE, the returned string is always 'null'. I need to get such information from the browser. I know that there is a work around by defining a javascript function that get such string and calling that function from the application. However, my application require getting such information from a native source.
I was wondering if anyone had the same problem and managed to solve it, or if someone has any idea why I always get null in IE, but not when using Firefox and Opera
Edit 1:
Here is the HTML code for embedding the generated SWF file. Maybe this is useful to spot a mistake
<object id="myTest1" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" height="330px" width="600px">
<param name="movie" value="http://www.website.com/test.swf" />
<param name="allowScriptAccess" value="always" />
<param name="wmode" value="transparent" />
<embed id="myTest1" pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://www.website.com/test.swf" allowScriptAccess="always" wmode="transparent" height="330px" width="600px" flashvars=""></embed>
</object>
the id, classid, and the allowScriptAccess are set as shown
Any idea?
Edit 2:
for Lior Cohen
The Flex file is the example used in your first link. The sub-directory history contains history.js, history.css, and historyFrame.html. The HTML page that include the generated SWF file is like this
<html>
<head>
<!-- BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css"/>
<script src="history/history.js" language="javascript"></script>
<!-- END Browser History required section -->
</head>
<body>
<object id="file1" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" height="330px" width="600px">
<param name="movie" value="file.swf" />
<param name="allowScriptAccess" value="always" />
<param name="wmode" value="transparent" />
<embed id="file2" pluginspage="http://www.macromedia.com/go/getflashplayer" src="file.swf" allowScriptAccess="always" wmode="transparent" height="330px" width="600px" flashvars=""></embed>
</object>
<body>
</html>
However, this is still not working as expected.
Edit 3:
I have spotted the problem, however, I cannot fix it. The problem has to do with the javascript engine of IE and not the ExternalInterface nor the object and embed HTML tags.
What I am doing in my case is write the object and embed tags into a div created using javascript and this div is appended to the end of the body using the DOM methods. However, such approach make the InternalInterface always return null in IE (but not in Firefox nor in Opera).
var swfDiv = document.createElement('div');
swfDiv.innerHTML = '<object id="test1" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="600" height="330"><param name="movie" value="http://www.website.com/test.swf" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="quality" value="high" /><embed id="test2" name="test2" src="http://www.website.com/test.swf" allowScriptAccess="always" allowFullScreen="false" quality="high" width="600" height="330" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
document.body.appendChild(swfDiv);
I tried to use document.write to append the HTML content, which made it work perfectly in IE, however, document.write wrote over the entire page (removing old content), which is something I don't want.
document.write('<object id="test1" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="600" height="330"><param name="movie" value="http://www.website.com/test.swf" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="quality" value="high" /><embed id="test2" name="test2" src="http://www.website.com/test.swf" allowScriptAccess="always" allowFullScreen="false" quality="high" width="600" height="330" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
Any idea how to fix this?
Thanks
Take a look at the following link. It should provide you with what you're looking for, without using ExternalInterface.call().
http://livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_7.html
As mentioned in the page above, for the BrowserManager class to offer its full functionality, the wrapper must include several supporting files (history.js, amongst others).
More information about how to obtain and use these supporting files can be found in the following link under the "Deploying applications that use deep linking" section.
http://livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_2.html
A quick search reveals you will have to set some extra attributes on the object to make it work in IE. Set id classId and scriptAccess (the last one to 'true' of course) to get this to work. (google for more info)
(Not tested.)
http://www.google.com/search?q=externalinterface+internet+explorer
The solution to the problem that is mentioned in "Edit 3" is basically to create the object tag and its parameter tags using DOM objects, instead of just specifying them as string for the innerHTML attribute. This will make the returned value of the ExternalInterface work in Internet Explorer. Here is an example:
var swfDiv = document.createElement('div');
var obj = document.createElement('object');
obj.setAttribute('id','test1');
obj.setAttribute('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0');
obj.setAttribute('width','600px');
obj.setAttribute('height','330px');
var param = document.createElement('param');
param.setAttribute('name','movie');
param.setAttribute('value','http://www.website.com/test.swf');
obj.appendChild(param);
param = document.createElement('param');
param.setAttribute('name','allowScriptAccess');
param.setAttribute('value','always');
obj.appendChild(param);
param = document.createElement('param');
param.setAttribute('name','wmode');
param.setAttribute('value','transparent');
obj.appendChild(param);
swfDiv.appendChild(obj);
document.body.appendChild(swfDiv);
document.getElementById('test1').setAttribute('classid','clsid:d27cdb6e-ae6d-11cf-96b8-444553540000');
Note 1: This will make it work with Internet Explorer, any other browser should use any of the method mentioned above in "Edit 3" of the question. You can detect the browser and use the proper code accordingly.
Note 2: the last line is required to make it work properly, and it has to be like that and at the end after adding the object to the document. I do not know why, probably it has to do with the weird browser behavior.
#AAA
Note 2: the last line is required to make it work properly, and it has to be like
that and at the end after adding the object to the document. I do not know
why, probably it has to do with the weird browser behavior.
Thank you very much ! I suppose it is a bug in IE. I wonder how you found out.
Using SWFObject (you'll find it at http://code.google.com/p/swfobject/) to place the Flash on the page also solves this problem in Internet Explorer.

Resources