473,624 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How python ActiveX to access DHTML document?

Hi

I want to write an ActiveX by using python. And I know how do, but I don't
know how python to access DHTML Document.If using cpp, it can be done by
following source.
/****/
CComPtr<IOleCon tainer> spContainer;
m_spClientSite->GetContainer(& spContainer);
CComQIPtr<IHTML Document2, &IID_IHTMLDocum ent2> spDoc(spContain er);
if (spDoc)
spDoc->put_bgColor(CC omBSTR(_T("pink ")));
/****/
Who can tell me how to do the same in python? Thanx

ps. I use win32com package.

Thanx again
angel
Jul 18 '05 #1
4 2575
"angel" <da*******@yaho o.com> wrote in message news:<c7******* ****@news.f.de. plusline.net>.. .
Hi

I want to write an ActiveX by using python. And I know how do, but I don't
know how python to access DHTML Document.If using cpp, it can be done by
following source.
/****/
CComPtr<IOleCon tainer> spContainer;
m_spClientSite->GetContainer(& spContainer);
CComQIPtr<IHTML Document2, &IID_IHTMLDocum ent2> spDoc(spContain er);
if (spDoc)
spDoc->put_bgColor(CC omBSTR(_T("pink ")));
/****/
Who can tell me how to do the same in python? Thanx

ps. I use win32com package.

Thanx again
angel


Assuming you want to have HTML Document within IE following should
work from the command line.
from win32com.client import Dispatch
ie = Dispatch("Inter netExplorer.App lication")
ie.Visible = True
ie.Navigate('ab out:blank')
doc = ie.Document
doc.bgColor = "pink"


I would also recommend running Tools->COM Makepy utility from Pythowin
on Microsoft Internet Controls (for Internet Explorer)
and Microsoft HTML Object Library (for DHTML Document)

waldek
Jul 18 '05 #2
Thanx, but you mistook my meanings.
(1)I wrote ActiveX.
(2)The ActiveX will be embed in a html page.
(3)The ActiveX want to know the container html document's IDispatch pointer.

Your solution can only create a new document, and then control it.

Thanx again
angel
"Waldemar Osuch" <os****@ecn.ab. ca>
??????:c5****** *************** *****@posting.g oogle.com...
"angel" <da*******@yaho o.com> wrote in message

news:<c7******* ****@news.f.de. plusline.net>.. .
Hi

I want to write an ActiveX by using python. And I know how do, but I don't
know how python to access DHTML Document.If using cpp, it can be done by
following source.
/****/
CComPtr<IOleCon tainer> spContainer;
m_spClientSite->GetContainer(& spContainer);
CComQIPtr<IHTML Document2, &IID_IHTMLDocum ent2> spDoc(spContain er);
if (spDoc)
spDoc->put_bgColor(CC omBSTR(_T("pink ")));
/****/
Who can tell me how to do the same in python? Thanx

ps. I use win32com package.

Thanx again
angel


Assuming you want to have HTML Document within IE following should
work from the command line.
from win32com.client import Dispatch
ie = Dispatch("Inter netExplorer.App lication")
ie.Visible = True
ie.Navigate('ab out:blank')
doc = ie.Document
doc.bgColor = "pink"


I would also recommend running Tools->COM Makepy utility from Pythowin
on Microsoft Internet Controls (for Internet Explorer)
and Microsoft HTML Object Library (for DHTML Document)

waldek

Jul 18 '05 #3
angel wrote:
Hi

I want to write an ActiveX by using python. And I know how do, but I don't
know how python to access DHTML Document.If using cpp, it can be done by
following source.
/****/
CComPtr<IOleCon tainer> spContainer;
m_spClientSite->GetContainer(& spContainer);
CComQIPtr<IHTML Document2, &IID_IHTMLDocum ent2> spDoc(spContain er);
if (spDoc)
spDoc->put_bgColor(CC omBSTR(_T("pink ")));
/****/
Who can tell me how to do the same in python? Thanx


IOleContainer isn't supported by win32com. Let me know if you are
interested in helping add it (it is very hard to add new interface
support correctly without a usecase)

In the meantime, try and find an IDispatch based way of doing it.

Mark.
Jul 18 '05 #4
Hi everyone

Thank you for your reply.
The use case is:
1) I wrote a com server(progid is PythonCom.Test) in Python. It works well.
2) The com server expose some method func1 func2 ...
3) In a html I wrote a jscript
var com = new ActiveXObject(" PythonCom.Test" );
com.func1(); // it's ok
com.func2(); //it's ok too.
4)Now I want my com server can access the html document directly.
I hope my com server can call
document.all.id 1.innerText ="Hello world!"

I know the key is to get the html document's IDispatch. but how to do? I
have tried let a jscript call:
com.func3(docum ent);
but the page report error.

Thanx again.
angel

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6530
by: Filip Wtterwulghe | last post by:
Hello, We have a number of VB6 ActiveX applicationmodule(s) that are loaded into a IE6 WebBrowserControl . This WebControl is imbededded into Application X . Now We want to send a message from Application X to all the ActiveX applicationmodules that are in IEWebbrowser . Contains Contains Application X ------------> IE WebControl -------------> Vb6 ActiveX A Contains
7
12492
by: Rune Strand | last post by:
What would it take to create a Firefox extension that enables Python as a script language in the browser - just like Javascript? Is it at all possible? Are the hundred good reasons not to bother? I once made an application that used MozPython. It was fun and very fast compared to the Mod_Python I eventually replaced it with. I had to, because of all the mess updating Mozilla caused. ActiveState has a project too . But none of these can...
9
4871
by: marc | last post by:
I think, it's very simple to do, but i don't know how ?! i've got a html page which contains : <div id="myDiv"> <hr /> <hr /> <hr /> <hr /> </div>
12
2573
by: A.M. | last post by:
Hi at all, how can I do to insert into a HTML page a file .txt stored in the same directory of the server where is the html file that must display the text file.txt? Thank you very much P.Pietro
6
5241
by: Jon Davis | last post by:
I recently learned how to do an <OBJECT> alternative to <IFRAME> in current browsers using: <object id="extendedhtml" type="text/html" data="otherpage.html" width="250" height="400"></object> My question is how do I access the document DOM of this object in Javascript? For example, "alert(extendedhtml.innerHTML);" doesn't work and produces an unknown error. I'd like to both read and write to the document's body element's innerHTML...
47
3465
by: Kenneth McDonald | last post by:
Is there any emerging consensus on the "best" UI for toolkit. Tk never quite made it but from what I can see, both qt and wxWin are both doing fairly well in general. I'm already aware of the licensing issues surrounding qt (fwiw, I think their license fee for commercial use is eminently reasonable), so aside from that, I was wondering if there was any feedback readers could provide on the following: 1) Which plays best with Python?...
2
3752
by: Tony Meier | last post by:
I am using the WebBrowser control (Explorer.Shell.2) from within a VBA application, embedded on an MS Access form to display the contents of a local folder. By default on Windows 2000/XP the control displays the "Common Tasks" section on the left-hand side of the display - I assume it just shows/hides this based upon the Windows user's settings. Is there any way to change this to "Classic View", ie to remove the left-side "Common Tasks"...
2
1996
by: Shawn | last post by:
Hi. I've never created an ActiveX control before, so I know little about what it is capable of and what its limitations are. My problem is this: I have to create a way to send multiple documents from the web server to a printer on the user's network. The way it works today the user has to manually download each document and send it to his printer, but now they want me to create an automated process. Will I be able to download documents...
5
6087
by: mikez | last post by:
Hi, We recently built a very basic file management system for a client in Access 2003 (to use with incoming tif scans). In it we used Microsoft's Document Imaging activex viewer (from Office 2003). The viewer seems to be a bit 'buggy', in that sometimes if you preview a tif image using the activex on a form, then goto another form, and then come back to preview the same image again on the first form, the preview no longer shows up...
0
8240
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8625
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7168
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.