Click here to Skip to main content
15,915,164 members
Home / Discussions / COM
   

COM

 
GeneralForward declaration of interfaces Pin
Rowan Seymour9-Sep-03 2:30
Rowan Seymour9-Sep-03 2:30 
GeneralRe: Forward declaration of interfaces Pin
valikac9-Sep-03 5:53
valikac9-Sep-03 5:53 
GeneralRe: Forward declaration of interfaces Pin
Rowan Seymour10-Sep-03 6:11
Rowan Seymour10-Sep-03 6:11 
GeneralRe: Forward declaration of interfaces Pin
Brian Shifrin11-Sep-03 1:35
Brian Shifrin11-Sep-03 1:35 
GeneralRe: Forward declaration of interfaces Pin
Rowan Seymour11-Sep-03 3:34
Rowan Seymour11-Sep-03 3:34 
GeneralRe: Forward declaration of interfaces Pin
arun140529-Oct-03 2:18
arun140529-Oct-03 2:18 
GeneralRe: Forward declaration of interfaces Pin
Rowan Seymour29-Oct-03 2:58
Rowan Seymour29-Oct-03 2:58 
GeneralIE Automation Pin
nikhilkhedkar8-Sep-03 21:08
nikhilkhedkar8-Sep-03 21:08 
I am working on developing a test application in java. I use java for UI only. I use JNI to communicate with a VC MFC DLL. I launch an IE browser instance in one JNI method (init()), which works fine.

OleInitialize(NULL);
CLSID clsid;
CLSIDFromProgID(OLESTR("InternetExplorer.Application"), &clsid);
HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IWebBrowser2, (void**)&m_spBrowser);

I store the browser pointer (IWebBrowser2 *) as a C++ class instance variable. BTW, I start a
thread on the native side (_beginthread) which in turn calls the method that launches the browser.
Previously I was facing the problem of marshalling, the IWebBrowser2 pointer was getting correupted, when used in different methods (even the simple properties of IWebBrowser2 (like IWebBrowser2::fullname) were not accessible). So now I have added the code of marshalling after the browser is launched. In almost all the other methods, I first unmarshall the interface and then marshall it back at the end of it. This solved my earlier mentioned problem.

void CIECanvas::MarshallInterface()
{
HRESULT hr;
if(SUCCEEDED(hr = ::CreateStreamOnHGlobal(NULL, TRUE, &pstm)))
{
LARGE_INTEGER bZero = {0, 0};
pstm->Seek(bZero, STREAM_SEEK_SET, NULL);

if(SUCCEEDED(::CoMarshalInterface(pstm, IID_IWebBrowser2, m_spBrowser, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL)))
{
pstm->Seek(bZero, STREAM_SEEK_SET, NULL);
}
}
}

void CIECanvas::UnmarshallInterface()
{
LARGE_INTEGER bZero = {0, 0};
pstm->Seek(bZero, STREAM_SEEK_SET, NULL);
HRESULT hr = ::CoUnmarshalInterface(pstm, IID_IWebBrowser2, (void**)&m_spBrowser);
if(FAILED(hr))
{
showMessageBox("CIECanvas::UnmarshallInterface()", "%s %ld", "FAILED. ERROR CODE = ", GetLastError());
}
}

Then for recording I use AfxConnectionAdvise(), which is working fine.

The problem I am facing is in Replaying the events.
1)The VM crashes with a hotspot error, when on the first page some link click event is present, which loads a new page. One observation here is the VM crashes after onBeforeNavigate2 or TitleChange events are fired.
2)I also tried Yahoo's registration page (having a lot of dropdowns and checkboxes), it works fine for the first few events, but then the VM crashes.

My questions are
1)Does IE handle the events like page loading (tiltle change etc.) and click on some link in different threads? How are the events handled (any useful info on this)?
2)How should I fix the problem?
3)Is it related to marshalling of IE COM pointers?

Please replay ASAP,
Nikhil

GeneralRe: IE Automation Pin
nikhilkhedkar9-Sep-03 2:18
nikhilkhedkar9-Sep-03 2:18 
GeneralStack messed up upon function returned Pin
DionChen8-Sep-03 8:04
DionChen8-Sep-03 8:04 
QuestionHow to pass VBA Collection to COM DLL from .NET C#? Pin
ajkumar4-Sep-03 15:21
ajkumar4-Sep-03 15:21 
Generalpassing a pointer into C++ from VB Pin
rajdawg3-Sep-03 16:31
rajdawg3-Sep-03 16:31 
GeneralRe: passing a pointer into C++ from VB Pin
Lim Bio Liong18-Sep-03 7:51
Lim Bio Liong18-Sep-03 7:51 
GeneralThreading issue Pin
kkfromus2-Sep-03 11:16
kkfromus2-Sep-03 11:16 
GeneralRe: Threading issue Pin
valikac3-Sep-03 6:22
valikac3-Sep-03 6:22 
GeneralRe: Threading issue Pin
kkfromus3-Sep-03 11:35
kkfromus3-Sep-03 11:35 
GeneralRe: Threading issue Pin
valikac4-Sep-03 9:07
valikac4-Sep-03 9:07 
GeneralRe: Threading issue Pin
Anonymous12-Sep-03 12:16
Anonymous12-Sep-03 12:16 
GeneralRe: Threading issue Pin
kkfromus12-Sep-03 14:40
kkfromus12-Sep-03 14:40 
GeneralThread Id of client app Pin
In-At1-Sep-03 18:30
In-At1-Sep-03 18:30 
GeneralRe: Thread Id of client app Pin
igor19603-Sep-03 10:33
igor19603-Sep-03 10:33 
Generalwhy CoCreateInstance( ... IID_IShellLink, ..) failed Pin
nofeel1-Sep-03 16:41
nofeel1-Sep-03 16:41 
GeneralRe: why CoCreateInstance( ... IID_IShellLink, ..) failed Pin
PengFeidu7-Sep-03 20:08
PengFeidu7-Sep-03 20:08 
GeneralRe: why CoCreateInstance( ... IID_IShellLink, ..) failed Pin
Lim Bio Liong18-Sep-03 8:06
Lim Bio Liong18-Sep-03 8:06 
GeneralRe: why CoCreateInstance( ... IID_IShellLink, ..) failed Pin
Lim Bio Liong19-Sep-03 0:53
Lim Bio Liong19-Sep-03 0:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.