Hi, all
I wanna make dso that implements OLEDBSimpleProvider interface to interact
mshtml.dll. but meet problem in doing it. Could anybody help me?
I do the following tasks:
1. use VS.NET IDE to create interop assembly dll about
simpledata.dll(OLEDBSimpleProvider and its listener stuff). and use it in my
class
2. create dispatch interface for defining msDataSourceObject and
addDataSourceListener which should be invoked by IE.
then create html which to download this asembly and bind its datum to html
tags.
when debug it, I could make breakpoint for constructor, but IE doesn't
invoke msDataSourceObject and addDataSourceListener, of course the result is
make me sorrow. woewoe...... no data binding to html tags.
Could anyone help me? I will really appreicate your help....
Vince Chang
the following is details about my testing code.
-----------------------------------------------------------------------
using System;
using Capital.Web.Client;
using msdatasrc;
using MSDAOSP;
using System.Runtime.InteropServices;
[assembly: ClassInterface(ClassInterfaceType.None)]
namespace ClassLibrary22
{
#region IEDSO Interface
[ComVisible(true)]
[Guid("4F8F38C3-B441-4755-B6E7-0C3F90188869")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatc h)]
public interface IDSO
{
[PreserveSig]
void msDataSourceObject( [MarshalAs(UnmanagedType.BStr)] string
qualifier, [MarshalAs(UnmanagedType.IUnknown)] ref object ppUnk);
void addDataSourceListener(DataSourceListener pEvent);
void removeDataSourceListener(DataSourceListener pEvent);
}
#endregion
public class Class1:IDSO,OLEDBSimpleProvider
{
public DataSourceListener DSListener;
public OLEDBSimpleProviderListener OleDbListener;
public Class1()
{
System.Console.WriteLine("test");
}
#region IDSO Members
public void msDataSourceObject(string qualifier, ref object ppUnk)
{
ppUnk =(OLEDBSimpleProvider) this;
}
public void addDataSourceListener(DataSourceListener pEvent)
{
DSListener = pEvent;
}
public void removeDataSourceListener(DataSourceListener pEvent)
{
DSListener = null;
}
#endregion
private string getRaw(int iRow, int iColumn)
{
return "iRow=" + iRow + ",iColumn=" +iColumn;
}
#region OLEDBSimpleProvider Members
public int getColumnCount()
{
// TODO: Add Class1.getColumnCount implementation
return 1;
}
public int isAsync()
{
// TODO: Add Class1.isAsync implementation
return 0;
}
public void stopTransfer()
{
// TODO: Add Class1.stopTransfer implementation
}
public void addOLEDBSimpleProviderListener(OLEDBSimpleProvider Listener
pospIListener)
{
OleDbListener =pospIListener;
}
public void removeOLEDBSimpleProviderListener(OLEDBSimpleProvi derListener
pospIListener)
{
OleDbListener = null;
}
public int find(int iRowStart, int iColumn, object val, OSPFIND findFlags,
OSPCOMP compType)
{
// TODO: Add Class1.find implementation
return 0;
}
public string getLocale()
{
// TODO: Add Class1.getLocale implementation
return "";
}
public int insertRows(int iRow, int cRows)
{
// TODO: Add Class1.insertRows implementation
return 0;
}
public int deleteRows(int iRow, int cRows)
{
// TODO: Add Class1.deleteRows implementation
return 0;
}
public object getVariant(int iRow, int iColumn, OSPFORMAT format)
{
string test;
if (iRow==0)
{
switch ( iColumn )
{
case 1:
test= "test";
break;
default:
test = "error";
break;
}
}
else
{
test =getRaw(iRow,iColumn);
}
return (object) test;
}
public int getRowCount()
{
// TODO: Add Class1.getRowCount implementation
return 1;
}
public OSPRW getRWStatus(int iRow, int iColumn)
{
// TODO: Add Class1.getRWStatus implementation
return OSPRW.OSPRW_READONLY;
}
public void setVariant(int iRow, int iColumn, OSPFORMAT format, object
Var)
{
// TODO: Add Class1.setVariant implementation
}
public int getEstimatedRows()
{
// TODO: Add Class1.getEstimatedRows implementation
return 0;
}
#endregion
}
}