|
Need help with passing a BYTE array in COM.
I think i have done it right but i only get the first byte passed.
Here is the idl:
interface ICOMtestObject : IUnknown
{
[id(1), helpstring("method GetData")] HRESULT GetData([out]ULONG *sz,[out,size_is(,*sz)]BYTE **data);
};
Here is the implementation in the COM server:
STDMETHODIMP CCOMtestObject::GetData(ULONG *sz, BYTE **data)
{
// TODO: Add your implementation code here
*data = (BYTE*)CoTaskMemAlloc( 5 * sizeof( BYTE));
(*data)[0]='T';
(*data)[1]='e';
(*data)[2]='s';
(*data)[3]='t';
(*data)[4]='\0';
*sz=5;
return S_OK;
}
Here is the implementation in the client:
HRESULT hr = m_objPtr.CoCreateInstance(L"Comtest.COMtestObject.1");
ULONG sz;BYTE *data;
hr = m_objPtr->GetData(&sz,&data);
The data array includes only the first byte.
Here are some sample code
http://forums.devx.com/attachment.php?attachmentid=1036
|
|
|
|
|
As i can see, you want to pass a string, right ? Why don't use a "COM-String" ?
[id(1), helpstring("method GetData")] HRESULT GetData([out, retval]BSTR* data);
If you want to pass a "real" array, why don't you use a "COM-Array" ?
[id(1), helpstring("method GetData")] HRESULT GetData([out, retval]SAFEARRAY* data);
|
|
|
|
|
Hello Johan,
Since your interface is non-Automation-compatible, did you build the corresponding Proxy/Stub DLL ?
I downloaded your source codes and did not notice any projects for a Proxy/Stub DLL.
This is necessary especially since your COM server is an EXE. I'm surprised that your client code can even successfully call GetData().
Best Regards,
Bio.
|
|
|
|
|
My mistake i forgot to compile the proxy-stub.
Thanks
|
|
|
|
|
Is there any difference of running web services in VS 2003 and 2005......
in VS 2003 i added my webservice through "add reference".
so iam getting Service class not found message...
Pllllz help me.......
Rgds
Suresh
|
|
|
|
|
Dear all,
Help! I want to do DCOM (ServicedComponent), but when I install the application proxy, it failed.
Can anyone help? I'm desperate now!
Thanks!
David Chan
|
|
|
|
|
How do I change the UUID of an existing ActiveX component? I have made a little changes to the component to add a few more functionalities. I now want to assign a new UUID to this control. How do I do this?
Regards,
Aljechin Alexander
|
|
|
|
|
I don't know of any way to do that through the IDE etc, but I think you can change it by hand:
First, create a backup of the entire project.
1- Create a new similar ActiveX component. Add a similar New ATL Object to it. Do not compile it.
2- Open both the new and old .IDL files and change every occurence of the old similar IDL 's GUID 's with the new ones.
3- Open both the .RGS files, and change all similar GUID 's with the new ones.
There may be easier ways. This is just one of them.
this is this.
|
|
|
|
|
hello all,
I am trying to write a C++ code for importing(taking) mails from MSOUTLOOK
using MAPI functions.I use the fuction PR_BODY_W for gewtting the HTML
mail body but it doesn't works so i use GETHTMLBODY() instead.Thus i
got the HTML mails correctly.
But the problem is that i used PR_HASATTACH,
PR_ATTACH_FILENAME_W,PR_ATTACH_TAG for getting attachments.But i am not
getting attachments correctly.some pictures (mails in msoutlook) are
taken here as attachments(in msoutlook it is not shown as attachments)
and is displaying one after another in my application. please give me
suggestion for getting the mails correctly or please help me by giving
a sample code(using MAPI) for getting(importing) mails from msoutlook.
regards,
Alex
|
|
|
|
|
What does the below line mean?
CCheckPoint():m_cRef(0), m_pConnection(NULL){}
where
CCheckPoint is a class,
m_cRef is ULONG,
m_pConnection is IConnectionPoint*
Can anyone help me in understanding what the bove code means?
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
That code seems to be the constructor. It initializes m_cRef to 0 and m_pConnection to NULL.
|
|
|
|
|
I think it is initializing the variables:
It should be equal to:
CCheckPoint::CCheckPoint()<br />
{<br />
m_cRef = 0;<br />
m_pConnection = NULL;<br />
}
this is this.
|
|
|
|
|
|
hi
what iam tring to do is iam trying to create tool that closely resembles the working of DbgView .
The way the DbgView tool works is:
You can launch the tool on the system.
OutputDebugString() is a Win32 API. If you use that API in your program, the output will then be shown on DbgView.
SO using this functionality i want to use OutputDebugString() in my client applications and i want the output(string in OutputDebugString()) to be shown in servers GUI.
CAn u suggest me how to proceed.
Thanks in Advance
abhi
|
|
|
|
|
Hi!
we have the following situation:
an old MFC-app (built with VC++6.0) loads a regular MFC Dll (built with
VC++.NET), which loads several MFC extension Dlls (built with
VC++.NET).
one of the extension Dlls creates a frame-window,
another one uses a CHtmlView within a docking pane.
we dont use the document/view architecture.
we dont have sources for the old MFC-app, just a Dll-interface.
when I shutdown the app, it takes more than 1 minute till the CHtmlView
object gets destroyed. during this time our app is frozen.
I figured out, that it is the call m_pObject->SetClientSite(NULL)
within the COleControLSite dtor, which is lasting that long.
when we load the extension-Dlls from within an new MFC-app (built with
VC++.NET), everything works fine.
any help on how to solve this would be greatly appreciated,
thanx in advance!
regards,
Hans
|
|
|
|
|
HI all
I have an application which uses a Filetransfer module (.tli file is involved while i debug) .
And a function raw_SendFile fails with return value of 0x80004005 (E_FAIL) when it tries to send a file.
To give more info : This function is called N times to send N files , and it properly sends say 10 files . And exacltly when it sends the 11th file named ramdisk\rd.gz it fails . And everytime this is reproducible and exacltly at this file , this function fails .
And my search in MSDN about E_FAIL says "Unspecified error" . What is this unspecified error ?
How can I solve it ?
Can anyone please help me ????
redindian
|
|
|
|
|
More information is needed - There is literally 1000s of reasons a COM object could return E_FAIL .
Steve
|
|
|
|
|
Hi Steve
Well I would like to add more points to you .
The files are taken from a delivery folder in a server, say A .
The application that tries to send these files are in system , say B.
And the destination is also a server ,say C, in a remote location , to which B connects via modem direct .
So when B tries to send the files from A to C this error occurs .
Folder in A <--- Files fetched by B ---> System B <-----Sending to C----> server C
And one interesting thing is that C is a linux call server which is called a PABX in telecom .
Could you please help me with your analysis ?
My doubt is - Why should the sending of a particular file result in error ? Why not other files ?
Thanks in advance
redindian
|
|
|
|
|
What is need is some code from around the failed call. What COm object is beging called? What method on what interface?
Steve
|
|
|
|
|
Steve
I am pastig the relevant lines from related files ...
from file filetransfer.tlh
***************************
// x:\pm5\db_serve\release\FileTransfer.tlh
// C++ source equivalent of Win32 type library ..\dlls\FileTransfer\FileTransfer.tlb
// compiler-generated file created 03/08/06 at 12:55:05 - DO NOT EDIT!
#pragma once
#pragma pack(push, 8)
#include <comdef.h>
struct __declspec(uuid("afb6da80-53ad-11d3-9771-00600835af91"))
/* dual interface */ IFileTransfer;
_COM_SMARTPTR_TYPEDEF(IFileTransfer, __uuidof(IFileTransfer));
struct __declspec(uuid("afb6da80-53ad-11d3-9771-00600835af91"))
IFileTransfer : IDispatch
{
// Raw methods provided by interface
virtual HRESULT __stdcall raw_ReceiveFile (
BSTR bstrFileName,
BSTR bstrRemoteDirName ) = 0;
};
from file filetranfer.tli
**************************
// Wrapper implementations for Win32 type library ..\dlls\FileTransfer\FileTransfer.tlb
// compiler-generated file created 12/21/05 at 13:41:49 - DO NOT EDIT!
#pragma once
// dispinterface _IFileTransferEvents wrapper method implementations
inline HRESULT IFileTransfer::SendFile ( _bstr_t bstrFileName, _bstr_t bstrRemoteDirName ) {
HRESULT _hr = raw_SendFile(bstrFileName, bstrRemoteDirName);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _hr;
}
redindian
|
|
|
|
|
Sorry steve
missed the line
replace #include
with
#include <comdef.h>
redindian
|
|
|
|
|
seems to be some problem in pasting here ...
it is condef.h file
redindian
|
|
|
|
|
Hello,
I'm a fairly new to COM and web services, but am capable in C#. I've written test applications to consume some web services I've set up, but now I am to the meat of what I am writing...
I need to create a c# COM assembly (.dll) that a win32 program can use to access web services. The problem is, when I start a C# DLL project, it complains "[C# Error] Class.cs(9): The type or namespace name 'Services' does not exist in the class or namespace 'System.Web' (are you missing an assembly reference?)" when I try to add "using System.Web.Services;" as I did in the Win32 APP.
Is there a different resource to use for COM?
I'm sure I'm just missing something stupid, but I can't for the life of me figure it out...
|
|
|
|
|
i have captured video from webcam and displayed in mfc.
i like to display the same in internet explore.
how to do it?
thanks in advance!!!!!!!!!
JAYARAJ
|
|
|
|
|
If you have an avi-file you can simply put it in an html file via the object-tag like:
<object id="xyvideo" width="320" height="240" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Media Player" type="application/x-oleobject">
<param name="width" value="320" />
<param name="height" value="240" />
<param name="FileName" value="xyvideo.avi" />
<param name="ShowControls" value="TRUE" />
<param name="AutoStart" value="FALSE" />
Regards,
Juergen
|
|
|
|