You didn't escape the < and > so some important code is missing.
You didn't bother to point out explicitly which code is in the client and which is in the server.
Surrounding code in <pre> and </pre> tags is generally considered polite, not to mention the fact that it makes the code more readable (uses a fixed width font).
You also didn't bother to ensure the code was properly indented.
In short, if you want help, put some effort in asking for it (at least as much as I do in replying!).
Now onto the code....
K ARUN KUMAR wrote:
This doesn't make use of size. Ever heard of buffer overruns?
What's with the (LPCTSTR)"he"? Get rid of the cast. If the string is of the wrong type casting just turns what would have been a compiler error into a runtime error and solves nothing.
Windows Registry Editor Version 5.00
2nd Registry Entry:
Windows Registry Editor Version 5.00
The problem is your interface is marked as an automation interface but it uses types that are not automation compatible. As I said, I'm sure the MIDL compiler would have warned you about this, and you should always investigate compiler warnings. The are a number of ways to fix this:
Don't use an automation compatible interface. Remove the dual and all the [id] attributes, and derive from IUnknown instead of IDispatch. You will not need the IDispatchImp base class in you server implementation either.
Add another interface to the object (which isn't dual and derives from IUnknown, as described above) to contain the non-automation compatible methods.
Manually make the changes I described after RegisterTypeLib[^] makes the "wrong" ones. This is a hack though: why use an automation-compatible interface that automation clients will not be able to call?
I've a windows class library and would like to create ActiveXControl for that. I regstered the dll using RegAsm.exe and created the below html in local IIS(wwwroot) and accessed. But its not showing the design.
Please let me know if I missed any steps in creation of ActiveXControl. Thanks in advance.
Please note that you MUST load this HTML document from your local IIS, or from a TRUSTED SITE <hr>
<font face=arial size=1>
<OBJECT id="myControl1" name="myControl1" classid="0AE91E82-5EE3-4d27-B7ED-CE2C0B059BB7" width="500" height="200">
classid is the GUID of the class.
In one of the class, I declared the GUID as below.
I am getting address of COM function by loading type library (TLB) and iterating over types using ITypeLib and ITypeInfo.
After calling AddressOfMember function of ITypeInfo I am facing following exception:
System.Runtime.InteropServices.COMException (0x800288BD): Wrong module kind for the operation. (Exception from HRESULT: 0x800288BD (TYPE_E_BADMODULEKIND)) at System.Runtime.InteropServices.ComTypes.ITypeInfo.AddressOfMember(Int32 memid, INVOKEKIND invKind, IntPtr& ppv).
Any idea how to get rid of this excpetion?
for (int curFunc = 0; curFunc <iTotalfunc ; iTotalFuncs;curFunc++)
oTypeInfo.GetFuncDesc(curFunc, out ppFuncDesc);
funcDesc = new System.Runtime.InteropServices.ComTypes.FUNCDESC();
funcDesc = (System.Runtime.InteropServices.ComTypes.FUNCDESC)Marshal.PtrToStructure(ppFuncDesc,typeof(System.Runtime.InteropServices.ComTypes.FUNCDESC));
oTypeInfo.GetNames(funcDesc.memid, m_strFuncNames, 1, out cNames);
oTypeInfo.AddressOfMember(funcDesc.memid, //Here where exception occured System.Runtime.InteropServices.ComTypes.INVOKEKIND.INVOKE_FUNC, out addrssOfMember);
}//end of if
}//end of switch
}//end of try
}//end of for
In the below mentioned code. i want to use MSCOMM32.OCX file API to my C++ code.
i am facing an issue when i am getting HResult from the cocreateInstance.
Kindly let me know what should i do to access MSCOMM32.OCX API.