|
I'm about to begin an IE toolbar that I would like to make use of the IPersistStream implemenation instead of the registry. While I can store various values in statics, some of those property changes to one instance of the toolbar should be immediately reflected in the other instances (if any).
What is the best way to do this? Should the toolbar have sinks to its own connection points? If this was the case, wouldn't the points have to be implemented statically? Is this even possible (or, if possible, is just a BAD idea).
Ideas? TIA
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
First off, I'm a real COM neophyte....that said.....
Situation:
I have a win32 dll which exports approx 100 functions. These functions use data structures (some with upwards of 50 data fields) passed in/out of the function calls.
All the structures have intrinsic types for fields (char*, doubles, ints bools) etc. There are no linked lists, pointer to other structures, unions etc in the structures that are passed.
Requirement:
I have to "wrap" this dll into a COM/ActiveX object so that the entire functionality of this dll is "visible" as a COM object. But, I really don't have a real good idea where to start with this. Do I:
1. Convert all structures to MIDL equivalents? (is there a tool for this?)
2. Create an ATL object to contain the dll and simply forward all calls to the DLL?
3. How does one convert large structured data through this kinds of mechanism?
Please advise, and thank you in advance...
Just trying to keep the forces of entropy at bay
|
|
|
|
|
Well this is not really an answer but a question.
Why are you in need of wrapping this dll?
Yes, I have done this. No, I didn't enjoy it.
My preference is to rescope the entire project
and hey just do away with the old dll if possible.
If its not possible then I create a COM object
that calls the other dll.
Basically all calls on the old dll would be new methods on
the COM object.
I think you may be pushing the boundaries on the structure
sizes but I am not entirely sure. If you have no requirements
to use IDispatch then I would create a custom interface
and just pass in the structures or pointers of structures
as the case may be.
You will need to look at each structure on a case by case basis
to see if it is okay. You can pass the char* if you know the
size.
This is a big topic. I feel an article coming on.
Mike "Cop" Pulice
mike@puliceworx.com
|
|
|
|
|
In one of the parameters of this method, we can specify the size of the window(height and width can be specified). Can anyone let me know how I can retrieve/get the size of the window?
|
|
|
|
|
In order to do that, you have to QI for the IWebBrowser2 interface, but I don't think you can get that from IHTMLWindow2 (not saying you can't, just that I don't remember if you can). You could possibly QI window.external , which returns an IDispatch . The host control (in this case, the Internet Explorer client executable) supplies an IDispatch that is used to resolve the window.external reference, but it doesn't necessarily mean that it is an instance of the IWebBrowser2 implemenation. You'll just have to try a couple of these things out.
One you get the IWebBrowser2 interface, the width and height properties are there.
Why this isn't accessible from the window object, I don't know. It allows you get move and resize the window, or even set its location, but you can't get the current width and height! Weird.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi
I've written a COM+ application in C# there are methods that have parameters of the type System.Collections.Hashtable and I am trying to create a unmanaged CPP wrapper for those method. I used #import with TLB file and TLI and TLH files created automatically have in those methods parameters of the following type:
struct _Hashtable*
and I am stuck here!
Does anyone have any idea what to do with that?
Thanks in advance!
Jajco
|
|
|
|
|
Code Sample:-
ATL Class
class CAtl : public IA, Public IB
{
---------
--------
virtual functions -- overridden of IA and IB
}
class MyClass : public CAtl
{
virtual methods again overridden
}
DEFINE_GUID(CLSID_MyClass, {---GUID---})
My Problem:
I have written a class (CAtl) which is deriving some COM interfaces (IA and IB).
I have written one more class (MyClass) which is derived from CAtl class.
I have overridden those virtual function of Interfaces in both of my classes (in CAtl and also in MyClass).
I defined a new GUID for MyClass class.
Now i have to create Object of my class (CAtl) using CocreateInstance. which is not working .....
it is saying that CLSID is undefined..what shud i do to register my class and create its object.
Output file is a .lib
Please help me out
thanx
Now i want to create "Myclass" object using CoCreateInstance and error is comming that GUID is undefined. How should i create its obj?
|
|
|
|
|
One more point to add:
Imp point is that CLSID_MyClass in defined in the registry under HKEY_CLASSES_ROOT\CLSID\{--GUID--}.
Even I created the Lib of MyClass class and I am able use it on other machine after registering it.
|
|
|
|
|
Hi,
I am updating the innerHTML of a page element to show a progress, the progress string inside the DIV element only updates when I move the mouse over the IE window. if it's idle it does not update.
Does anyone know a problem to this solution.
Thanks
Ceri
|
|
|
|
|
Ceri wrote:
Does anyone know a problem to this solution.
Where is the MSHTML Com Object. Is it an app of yours or are you doing something in IE? A code snippet might help.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
It's a C++ MFC app that I am developing in. Basicly the loop snippet looks something like this;
pElem is a pointer to an IHTMLElement
iProg is an integer that contains a progress
bsText is a formated BSTR that contains the string to put in the innerHTML
[code]
do
{
iProg = GetCurrentProgress();
... //string formating to put number into BSTR. e.g. "10%"
pElem->put_innerHTML(bsText);
}while(iProg != 100)
[/code]
The code works except that the display only updates when I move the mouse over the embedded IE control
|
|
|
|
|
Sitting in a tight light probably isn't a good idea. Try calling UpdateWindow() on the View.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
tight light
Err, did you mean tight loop?
Steve S
|
|
|
|
|
Steve S wrote:
Err, did you mean tight loop?
Maybe I was thinking he needs to see the light, or that I need to turn the light out and head for bed, seeing its nearly 11pm here and I started coding at 5am.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi,
Yes i already tried that and it didn't work. If you think that being in a tight loop will be a problem how else could you do something that needed to be updated often. Another thing that i forgot to mention is that this happenes in a different thread than the IE Windows message loop.
Ceri
|
|
|
|
|
Ceri wrote:
Another thing that i forgot to mention is that this happenes in a different thread than the IE Windows message loop.
There are various problems doing GUI stuff from secondary threads with MFC. I would try doing the updates from the main thread. In the secondary thread Post a message to the main thread and add a Message handler and get it to do the work of updating IE. That should fix it.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I will try that.
Another thing that I have noticed though is that it does update the first 5 or 6 times but then after that it doesnt. No matter what the update rate is 1 a second or 10 times a second it only updated 5 - 6 times.
|
|
|
|
|
Done a postmessage with a custom message and it worked fine. Thanks.
I think that is a bit silly mind, I think that the message loop is a little slow. Although it's OK in this case.
Ceri
|
|
|
|
|
Ceri wrote:
Done a postmessage with a custom message and it worked fine. Thanks.
I thought it would.;)
Ceri wrote:
I think that the message loop is a little slow
I haven't noticed any problems doing this in ED (see sig) which is heavilly multithreaded. But I haven't tried updating the HTML control this way. You might want to through in an UpdateWindow(). Or maybe your tight loop is using too much CPU.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Tried the UpdateWindow and I also but a Sleep up to 1000ms and it still only updated 5 times then stoped unless I moved the mouse.
Oh well who cares, it works now.
Thanks for your help
|
|
|
|
|
Hi, I have an existing DCOM server app which is working fine before the applying the patches released by Microsoft. It seems that these patches block the standard ports used for DCOM/RPC connectivity. Is there any way I can set alternative ports that aren't block by these patches? How do I go about doing that? My data security dept is insisting that the patches stay where they are and that I modify my codes to use another set of port numbers. Please help if you can. Thanks!
|
|
|
|
|
Firstly, the patches don't disable DCOM, and they don't block ports. They fix the bugs in the code. However, note that there are incompatibilities between these patches and versions of Windows 2000 prior to Service Pack 3. You should upgrade to Service Pack 3 or 4 to solve these problems.
Otherwise, it sounds like one of the following things has happened: DCOM has been disabled on one or more systems; a firewall has been added between the systems; Windows XP's Internet Connection Firewall, or another Personal Firewall application, has been enabled.
To check the first, run dcomcnfg . On Windows 2000, this produces a property sheet; on Windows XP, it opens the Component Services management console. To get to the appropriate setting on XP, expand the Component Services node in the tree, then Computers, right-click My Computer and choose Properties. Go to the Default Properties tab.
On this tab, there's a check-box labelled 'Enable Distributed COM on this computer'. Ensure it's checked.
Now we'll check the ports. Go to the Default Protocols tab, then choose 'Connection Oriented TCP/IP' in the DCOM Protocols box. Click Properties. Click Add below 'Port Ranges' to add a range of ports for DCOM to support. Ensure that your administrator allows DCOM through any internal firewalls on these ports. OK to finish. DCOM defaults to using any available port (IIRC).
To check for Windows XP Internet Connection Firewall, open the Network Connections control panel. Right-click your main network connection (usually called Local Area Connection) and choose Properties. On the Advanced tab, the 'Protect my computer...' checkbox should be unchecked to disable ICF.
|
|
|
|
|
Hi,
I need to migrate an ocx developed with visual basic to visual c++. The problem is that i need to keep binary compatibility with the old control. ¿ is it possible ?, ¿ how can i do it ? ...
thanks in advance.
|
|
|
|
|
You'll need to write an IDL file containing, at a minimum, the interfaces and interface IDs, plus the class ID.
If you don't intend to extend the interface, I suggest using OLEView (supplied with Visual Studio 6) to read the interface of the old class. Start up OLEView (Microsoft Visual Studio 6.0 > Microsoft Visual Studio 6.0 Tools > OLE View in the start menu) and select File > View TypeLib. Browse to the location of an existing version of the control. In the ITypeLib Viewer window that appears, select File > Save As and save to an IDL file.
If you do want to extend the interface, this is still a good starting point.
An article in January 2000's Microsoft Systems Journal details how VB's 'Binary Compatibility' setting works, and may be of use to you - Visual Basic Design Time Techniques to Prevent Runtime Version Conflicts[^].
|
|
|
|
|
Hi!
I wrote a program which changes the source code of an HTML page in Internet Explorer.
If the page is inculding Frames i'm using the IHTMLFramesCollection2 to get the
source of the frames.
This works except the frame is on an external URL:
Program works:
<FRAME name=menu src=menu.html>
<FRAME name=main src=main.html>
Program fails:
<FRAME name=menu src=http://www.somewhere.com/menu.html> ... fails here
<FRAME name=main src=main.html>
...but in my opinion it should work.
had somebody the same problem and maybe a resultion?
I'm using VC++ 6.0.
Here's some code:
int CpWToolBar::DoWorkOnFrames(IHTMLDocument2 *pDoc, SpWPIN pin)
{
int hr;
IHTMLWindow2* pWindow2 = NULL;
IHTMLWindow2* pFrameWindow2 = NULL;
IHTMLDocument2* pFrameDoc = NULL;
IHTMLFramesCollection2* pFrameColl = NULL;
long cFrames;
hr = pDoc->get_parentWindow(&pWindow2);
assert(SUCCEEDED(hr) && pWindow2);
pWindow2->get_frames(&pFrameColl);
if (SUCCEEDED(hr = pFrameColl->get_length( &cFrames )))
{
for ( int i=0; i < cFrames ; i++ )
{
VARIANT vIndex;
vIndex.vt = VT_UINT;
vIndex.lVal = i;
VARIANT var2 = { 0 };
LPDISPATCH pDisp;
VARIANT frame;
if (SUCCEEDED(hr = pFrameColl->item( &vIndex, &frame ))){
hr = frame.pdispVal->QueryInterface(IID_IHTMLWindow2, (void**)&pFrameWindow2);
hr = pFrameWindow2->get_document(&pFrameDoc);
if (pFrameDoc)
{
changeHTML(pFrameDoc, pin);
DoWorkOnFrames(pFrameDoc, pin);
}
}
}
}
return S_OK;
}
regards Alex
|
|
|
|