473,498 Members | 1,972 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<IOleContainer> spContainer;
m_spClientSite->GetContainer(&spContainer);
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spDoc(spContainer);
if (spDoc)
spDoc->put_bgColor(CComBSTR(_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 2560
"angel" <da*******@yahoo.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<IOleContainer> spContainer;
m_spClientSite->GetContainer(&spContainer);
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spDoc(spContainer);
if (spDoc)
spDoc->put_bgColor(CComBSTR(_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("InternetExplorer.Application")
ie.Visible = True
ie.Navigate('about: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.google .com...
"angel" <da*******@yahoo.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<IOleContainer> spContainer;
m_spClientSite->GetContainer(&spContainer);
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spDoc(spContainer);
if (spDoc)
spDoc->put_bgColor(CComBSTR(_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("InternetExplorer.Application")
ie.Visible = True
ie.Navigate('about: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<IOleContainer> spContainer;
m_spClientSite->GetContainer(&spContainer);
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spDoc(spContainer);
if (spDoc)
spDoc->put_bgColor(CComBSTR(_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.id1.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(document);
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
6511
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...
7
12469
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? ...
9
4866
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
2551
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
5224
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> ...
47
3418
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...
2
3734
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...
2
1987
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...
5
6075
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...
0
7125
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,...
0
7004
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...
0
7167
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7208
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...
1
6890
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...
0
5464
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,...
1
4915
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...
0
4593
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3095
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.