|
I have a atl control, having two properties. I want to use the html tag "param" to set new value. How? Thanks.
|
|
|
|
|
Hi,
I have a problem with a C++ COM server which is a service.
I define my own data structure with a bstrName and an integer for example.
And I try to get a list of the structure with a VB Client.
Here is the code of my COM object :
<br />
class ATL_NO_VTABLE CGWCServerLorCom : <br />
public CComObjectRootEx<CComSingleThreadModel>,<br />
public CComCoClass<CGWCServerLorCom, &CLSID_GWCServerLorCom>,<br />
public IGWCServerLorCom<br />
{<br />
public:<br />
CGWCServerLorCom();<br />
~CGWCServerLorCom();<br />
<br />
DECLARE_REGISTRY_RESOURCEID(IDR_GWCSERVERLORCOM)<br />
<br />
DECLARE_PROTECT_FINAL_CONSTRUCT()<br />
<br />
BEGIN_COM_MAP(CGWCServerLorCom)<br />
COM_INTERFACE_ENTRY(IGWCServerLorCom)<br />
END_COM_MAP()<br />
<br />
DECLARE_CLASSFACTORY_SINGLETON(CGWCServerLorCom)<br />
<br />
public:<br />
STDMETHOD(GetTagSpy)(long lgTagSpy, long *plgTagSpyReal, GWC_TAG_SPY_INFOS *pTagSpyInfos);<br />
lgTagSpy = size of the list given
plgTagSpyReal = real size of the list
pTagSpyInfos = list of structures
The structure is defined like this :
<br />
typedef struct ST_GWC_TAG_SPY_INFOS<br />
{<br />
BSTR bstrTagName;<br />
BSTR bstrTagValue;<br />
LONG lgTagValue;<br />
} GWC_TAG_SPY_INFOS;<br />
Actually I have 2 problems nowdays.
in VB I defined a table m_tabTagSpy() as GWC_TAG_SPY_INFOS
Let say I want 10 Tags : redim m_tabTagSpy(10)
I call m_pIServerLorCom.GetTagSpy 10, lgRealSize, m_tabTagSpy(0)
In return I only have the first value filled, when I check in debug, the C++ fill the all structure whithout exception, but returning the hand to the VB and every datas are lost !!!
Moreover if I ask the values one by one, I have big memory leaks but I don't know where.
If anyone could help I would be very grateful.
Matt.
|
|
|
|
|
Since you're working with VB, you're best off with an Automation-compatible interface. I would recommend using a SAFEARRAY of your structure.
Your problem is stemming from the Automation marshaller not knowing that you actually want an array; it therefore does not marshal the data appropriately across the process boundary.
See this article[^] for information on how to use arrays of user-defined types in COM objects.
|
|
|
|
|
Hello everyone,
I’m starting on a new project. My major task is to create vb.net application using the existing com component which is created with MFC (I think it is kind of com component created and based on the c code).
I searched a lot of materials from internet and found all the examples are kind of vb.net call the com component created with vb6 (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callcomcomp.asp) and c application call the com component created with c code (http://www.codeproject.com/com/comintro.asp).
Could you tell me is that possible to create vb.net application calling the com component created with MFC (Kind of C code). Do you have an example on how to do it?
Thank you very much for your any information in advance
Jane
|
|
|
|
|
I have created a COM+ component in VB.NET. This is a class library using factoring compiled into a dll file (MHC_ES.dll). This file references a C++ dll called "vb.dll". This is on a Windows Server 2003 using a Windows XP (eventually Windows 2000 to be used) client.
The problem is, when I have the service started on the server, the COM+ solution attached to the correct process, run the client, and get to one of the COM+ functions, it does not step into the breakpointed code on the server (COM+ solution open). I also get an error saying "Unable to load DLL (vb.dll)" - not the COM+ dll component, but the C++ dll it refers to.
The following code and methods are used to create the component service:
<assembly: applicationname("vbdll_es")="">
<assembly: descriptionattribute("vbdll_remoting="" component")="">
<assembly: applicationactivation(activationoption.library)="">
<assembly: assemblykeyfile("vbdll_es.snk")="">
<transaction(transactionoption.required), _
justintimeactivation(true),="" _
objectpooling(enabled:="True," minpoolsize:="2," maxpoolsize:="10)," _
constructionenabledattribute(default:="Server=192.168.0.46;Integrated Security=SSPI" )=""> _
Public Class vbdll_remoting
Inherits ServicedComponent
Public Shared attrs() As Object = {New System.Runtime.Remoting.Activation.UrlAttribute("tcp://192.168.0.46:50000/vbdll_remoting.rem")}
Public Shared instance As vbdll_remoting = Nothing
Public Shared Function get_instance() As vbdll_remoting
Dim intInput As Integer
If (instance Is Nothing) Then
Try
instance = New vbdll_remoting
Return instance
Catch ex As Exception
MsgBox(ex.Message & vbCrLf & vbCrLf & "'vbdll_remoting.get_instance' failed.")
End Try
End If
End Function
<autocompleteattribute(true)> _
Public Sub remote_check()
'See if App is up and running.
End Sub
End Class
' And a module here referring to vb.dll (C++ compiled dll)
' functions.
Imports System.Runtime.InteropServices
Module vbdll_ext
' /*** DLL test functions***/
<dllimport("vb.dll")> _
Public Sub vb_set(ByVal str_Renamed As String)
End Sub
' Other references to vb.dll (C++ compiled dll)
End Module
I use the following methods:
1. gacutil -i MHC_ES.dll
2. regsvcs.exe MHC_ES.dll
3. open Component Services
4. find corresponding COM+ component
5. open properties
6. Activation tab, change to Server Application
7. press "Apply"
8. check "Run application as NT Service"
9. go to Advanced tab
10. check Debugging "Launch in debugger"
11. OK and close properties
12. export as .MSI and install on client
13. refer to MHC_ES class on client
14. Start the component service on server
15. Open COM+ VB.NET solution on server
16. Go to Debug on menu and attach to appropriate process which appears as DllHost.exe
17. Run app on Client (Windows XP on network to Windows Server 2003)
18. Step to point at which it calls COM+ function
The breakpoint set in the COM+ VB.NET solution does not catch, and the "Unable to load DLL (vb.dll)" comes up.
I've been trying lots of things, but cannot get it to step into the COM+ code on the server side. I have run the client app on the Windows 2003 server itself. It will step into the COM+ code, but as soon as it hits the vb.dll function, it hangs. This vb.dll is a legacy dll that has been working fine.
In fact, using .NET remoting in stead of COM+, the stepping into the server side code was working fine! Including into the vb.dll C++ generated code. There were just other mysterious problems (crashing) running over night, so I wanted to give COM+ a try.
Any help appreciated! (Hope I didn't give anyone a headache ...)
Bryan
|
|
|
|
|
Been working on this - main problem now is "Unable to load DLL (vb.dll)". The COM+ object seems to work properly because I can see it running on the Client and Server, and I do a database call from Client to Server and the Client retrieves the appropriate data from the Server.
But when a call is made to the unmanaged C++ "vb.dll", it says "Unable to load DLL (vb.dll)".
So how do I enable the COM+ object to find or load the unmanaged DLL? I have put the vb.dll in the Windows/system32 folder - I have put it in the corresponding project folder.
Code is simply:
' /*** DLL test functions***/
<dllimport("vb.dll")> _
Public Sub vb_set(ByVal str_Renamed As String)
End Sub
Changing "vb.dll" to include path "C:/folder/vb.dll" will just cause error to read "Unable to read DLL ("C:/folder/vb.dll").
Help!
|
|
|
|
|
Could somebody tell me that in a Java application,how to call methods in a COM component?
William
|
|
|
|
|
Java provides JNI - java native interface. this is the only way to communicate between Java - Win32 paltfoprms. But JNI needs win32 components as pure win32 dlls and it doesnt understand COM components. So write a win32 dll wrpper over the com component and use it.
cheers..Milton KB
|
|
|
|
|
Thank you so much for your help. But I really need a simple way to call a method in a COM object from a Java application.
William
|
|
|
|
|
|
|
All,
I am currently using the Typelib wrappers for MSXML that was generated from the MFC Typelib Class wizard. I think I am using the objects incorrectly, and this is generating unhandled exception errors.
I use wizard MFC Class from Typelib to generate wrapper classes for the MSXML5 control (CXMLDOMDocument, CXMLDOMElement, CXMLDOMNode, and CXMLNodeList). The exception occurs when I pass a CXMLDOMNode reference to a function that I want it to work on by stepping down farther in the node tree. For example:
If(m_XMLDOMroot.hasChildNodes())
{
int rootchildcount = RootNodeList.get_length();
for(int i = 0; i < rootchildcount; ++i)
{
CXMLDOMElement childnode = RootNodeList.get_item(i); <- This code sometimes user breaks
SetChildNode(childnode);
}
}
PS - I did not know it this group would also apply to this message.
Robert
|
|
|
|
|
Hi,
Could anyone tell me how to detect the play of a video file (any video file like AVI, WMV, MPEG etc...)?
If any application (like RealPlayer or Windows Media Player) plays the video file, my application should recieve a notification.
Thanks in advance,
Pavan
Regards,
Pavan
|
|
|
|
|
Hi, I am trying to write a program to access messages from outlook express. I have downloaded 4 programs with source code which all work but will not compile on Bloodshed C++ Visual c++(4) nor visual studio 2005.
Is is possible to load mapi32.dll on any of these three compilers? I have writen programs to access the parrallel port / and usb ports no problem but can't find anything simple to start using mapi. MFC will not work either.
Alternatively what should I buy to make sure it will be possible to access outlook? (I have spent nearly 50 hours so far trying all combinations and no joy)
Is there an equivalent to this for mapi32.dll:
HMODULE myDll;
myDll = LoadLibrary("K8055D.DLL");
myOpenDevice = (tOpenDevice)GetProcAddress(myDll,"OpenDevice");
tWriteAllDigital myWriteAllDigital;
myWriteAllDigital = (tWriteAllDigital)GetProcAddress(myDll,"WriteAllDigital");
int j = myOpenDevice(0);
myWriteAllDigital(255-data);
if (data == 0) FreeLibrary(myDll);
Many thanks
|
|
|
|
|
Is there any downloadable book on internet to learn COM in C++ from the fundamental steps?
|
|
|
|
|
Inside COM by Dale Rogerson is a good book for beginners but I dont know u will get it as ebook
never say die
|
|
|
|
|
I have read the article "Building an Office2K COM addin with VC++/ATL"
Although I followed the steps one by one as it has been specified in the article and the registry entry for the dll was entered correctly by the code
HKCU
{
Software
{
Microsoft
{
Office
{
Outlook
{
Addins
{
'OutlookAddin.Addin'
{
val FriendlyName = s 'ADOutlook2K Addin'
val Description = s 'ATLCOM Outlook Addin'
val LoadBehavior = d '00000008'
val CommandLineSafe = d '00000000'
}
}
}
}
}
}
}
no addin is appeared in "Tools->Options, under Other tab,
Advanced Options->COM Addins "
would you help me with the matter, please
|
|
|
|
|
have u created the entries in HKEY_CLASSES_ROOT with the friendly anem and clsid?
hello
|
|
|
|
|
have u created the entries in HKEY_CLASSES_ROOT with the friendly name and clsid?
-- modified at 0:06 Wednesday 9th August, 2006
Sudeesh
|
|
|
|
|
What's the relation of ComBStr, _bstr_t, BStr??
|
|
|
|
|
|
|
|
|
In short: CComBSTR is a thin wrapper around the BSTR API, while _bstr_t is a rather thick one. By thick I mean that it wraps associated HRESULTs into exceptions.
_bstr_t is more suitable for applications, in which it's almost always possible to throw exceptions across calls. In certain scenarios however, such as in COM components, it's not advisable to do that because of threading/apartment issues (it's downright dangerous!). In such scenarios, CComBSTR is far better suitable, as it does not throw exceptions.
--
Mr. Bender's Wardrobe by ROBOTANY 500
|
|
|
|