|
hi,
I've a COM object created in C++ , used in C# . I need to pass a string to that COM method, but always when I send string from C# , only first character occurs on C++ side.
COM Method:
STDMETHODIMP Initialize(LPTSTR a, LPTSTR b);
{
cout << "a: " << a << " b:" << b << endl;
....
}
if I call this method on that COM object (wrapped in C#)
IMyObject.Initialize("one", "two");
only thing i get in console is
a b:t
(instead of "a:one b:two")
how can i get whole size of string ??
|
|
|
|
|
here you pass as array may be it solve ur problem
Sujit
|
|
|
|
|
Try to send StringBuilder instances from C# application..
Cheers,
Suresh
|
|
|
|
|
Have a look at this [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hello,
You need to use BSTR instead of LPTSTR in your server.
Regards
|
|
|
|
|
Hi,
I'm creating a COM object single dll server, which will be used in managed code, in C#. I'm having a little trouble with types . I need to declare method wich will have one input argument and one output argument, both of string type (in C#). Now I work with arguments :
C++
HRESULT Method([in] unsigned char const* source, [out, retval] unsigned char* output);
which are (in C#) converted to :
byte Method(ref byte source);
1. what kind of declaration I need in C++, so it would be transformed to string Method(string source) (in C#);
2. How to convert that kind to char* (in C++).
thanks
|
|
|
|
|
try using BSTR in C++
Cheers,
Suresh
|
|
|
|
|
In my application I got hr=S_FALSE.
at the end of function retun the green color turned error
give the following error and ask about break or continue the application.
on mouse move on green arrow got following ?
The code has called into another function.when that function is finished, this is the next statement that will be executed.
<br />
<br />
HRESULT Encoder :: ListSystemProfileForEnocder(HWND hFromEncodeProFile)<br />
{<br />
<br />
<br />
HRESULT hr;<br />
IWMEncoder* pEncoder;<br />
IWMEncProfileCollection* pProColl;<br />
IWMEncProfile* pPro;<br />
long lCount;<br />
int i;<br />
<br />
hr = CoInitialize(NULL); <BIG>Return S_FALSE </BIG><br />
<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = CoCreateInstance(CLSID_WMEncoder,<br />
NULL,<br />
CLSCTX_INPROC_SERVER,<br />
IID_IWMEncoder,<br />
(void**) &pEncoder);<br />
}<br />
<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pEncoder->get_ProfileCollection(&pProColl);<br />
}<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pProColl->get_Count(&lCount);<br />
}<br />
<br />
for (i=0; i<lCount; i++)<br />
{<br />
CComBSTR bstrName = NULL;<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pProColl->Item(i, &pPro);<br />
}<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pPro->get_Name(&bstrName);<br />
}<br />
<br />
SendMessage(hFromEncodeProFile,CB_ADDSTRING,i,reinterpret_cast<LPARAM>((LPCTSTR)bstrName));<br />
<br />
}<br />
<br />
if ( pProColl )<br />
{<br />
pProColl->Release();<br />
pProColl = NULL;<br />
}<br />
if ( pPro )<br />
{<br />
pPro->Release();<br />
pPro = NULL;<br />
}<br />
if ( pEncoder )<br />
{<br />
pEncoder->Release();<br />
pEncoder = NULL;<br />
}<br />
<br />
return( hr ); <br />
<br />
} <br />
The code has called into another function.when that function is finished, this is the next statement that will be executed. <br />
<br />
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
When ::CoInitialize[Ex](...) returns S_FALSE it means that the COM library has already been initialized for the calling thread.
Don't forget to match each call ::CoInitialize[Ex](...) with a call to ::CoUninitialize(...) , even those that return S_FALSE . You haven't done so in the code you posted.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
is before return (hr);
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
I'm trying to generate .eml files with CDO 2000. But I got problems if the attachment's file name contains multi-lauguage characters. Then the attachment name will become ???????.
I tried two ways:
1. Set the file name directly with raw text.
2. Encoding the header (content-disposition) with RCF1522.
But I still got the same result.
Actually, I can call GetFileName() to retrieve the filename before writing stream to file, and it was fine. But something wrong happened when it generates the file.
Thanks a lot.
|
|
|
|
|
Dear all,
I m new to COM world, having basic knowledge about it.
I have to redesign a simple DLL project to COM DLL Server so that it can incorporate with existing application with least changes.
What kind of approach i have to follow in order to complete this task ...
Waiting for your suggestion ...
Thanks..
"I only fail when i give up "
|
|
|
|
|
Basically you want to write a COM wrapper around a Simple win32 Dll isnt it?
Does this Simple win32 dll contains exported Classes? or simple C functions?
Cheers,
Suresh
|
|
|
|
|
Thanks for your kind reply ...
Yes a COM wrapper around a Simple win32 Dll. This win32 dll contains exported simple functions ...
Is this a fine approach or should i have start a project from start having all those functions of exported Classes in COM Server Dll.
Thanks...
"I only fail when i give up "
|
|
|
|
|
Yeah, the approach is fine, but remember to distribute both the DLL's when you are publishing your application.
Cheers,
Suresh
|
|
|
|
|
Hi,
Want to ask one more thing..
I have loaded the Admin.dll in my COM dll server. Is it possible that i can marshal pointer of my custom class from DLL Server to client for some specific processing or may u plz suggest any other possible approach for this case.
Thanks.
"I only fail when i give up "
|
|
|
|
|
Can anyone please help me or give me some sample code? I need to create an ATL COM service (not a DLL) which has a dummy interface.. say. add 2 numbers.. After creating the service, i want to register it as a windows service. Then i want to create a client which connects to this service and uses the interface.. (adds 2 numbers)
I have searched online and there is not a decent article which explains the process step by step... Any help in this regard will be very useful.
Thanks in advance!!!!
|
|
|
|
|
Hai all,
-> I have a "COM Server Exe" , with connection point.
->And I made my COM Object class Singleton by using
Macro "DECLARE_CLASSFACTORY_SINGLETON"
-> My Com Cleint is a Dialog Based Programme .I started 5 clients by
clicking on same exe.
-> Whenever the client starts , It will set up all the connection points
-> I am able to call a COM Method( for eg: my_ComFun() ) by clicking a
button on my dialog box
-> From inside my_ComFun() I am firing an event to my client .
implementation of my_ComFun()
/**************************************************************/
STDMETHODIMP CMyServer::my_ComFun(int i)
{
Fire_MyEvent(i);
return S_OK;
}
/**************************************************************/
->Whenever I am Firing events from my COM Server(Using function
Fire_MyEvent() ) , All my clients are
getting function calls , since my COM Server is a Singleton class.
* My Requirement is to prevent this broadcasting and direct the function
calls from COM to that specific client which calls the Servers my_ComFun(),
by keeping the COM Server Singleton.
Thanks in Advance.
George
|
|
|
|
|
Hello,
I've written an ActiveX for IE in VS2005 C# .Net 2.0.
It supports RfID and GPS via COM-Port.
On my machine it runs great.
Now I wrote a setup with VS 2005.
I think I'm to set "vsdrpCOMSelfReg" for registering.
But it doesn't work.
It accepts only "vsdrpCOM"
After installation I called it in IE. It dosn't work.
When IE is open and I want to uninstall it by setup - Setup say "no, is in use."
I think, I'm not so far from target?!?
Can anyone help me?
I didn't find an good artikel in the internet.
Thanks a lot.
Additional:
In my IE I see the ActiveX in AddOns, but as File is listed "mscoree.dll"
What's that?
"Herausgeber" / Publisher is emty.
Maybe, it helps you.
Thanks a lot.
|
|
|
|
|
how to create set up file in COM addins project. and how to install in client system. what r the requrements of clients system please urgent
send me important codes in the above projects
|
|
|
|
|
How To Load Google Toolbar For Dialog??
Google Toolbar ClsID:{2318C2B1-4965-11d4-9B18-009027A5CD4F}
Code:
bool CShowToolbarDlg::LoadIEToolbar( CString strCLSID )
{
CLSID clsid;
WCHAR wsz[MAX_PATH];
::MultiByteToWideChar(CP_ACP, 0, strCLSID, -1, wsz, MAX_PATH);
HRESULT hr = CLSIDFromString(wsz, &clsid);
if ( hr != NOERROR )
return false;
::CoInitialize (NULL);
IUnknown* puk;
hr = ::CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**)&puk);
if (FAILED(hr))
return false;
IDeskBand *pdb;
hr = puk->QueryInterface(IID_IDeskBand, (void**)&pdb);
HWND hBand;
if (SUCCEEDED(hr))
{
pdb->GetWindow(&hBand);
if(hBand == 0)
return false;
CWnd *pWnd = CWnd::FromHandle(hBand);
}
m_pReBar = new CReBar();
m_pReBar->Create(this);
CWnd *pWnd = CWnd::FromHandle(hBand);
if(pWnd==NULL) return false;
m_pReBar->AddBar(pWnd,NULL,NULL, RBBS_BREAK);
REBARBANDINFO rbbi;
rbbi.cbSize = sizeof(rbbi);
rbbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_SIZE;
rbbi.cxMinChild = 0;
rbbi.cyMinChild = 10;
rbbi.cx = rbbi.cxIdeal = 250;
UINT nCount = m_pReBar->GetReBarCtrl().GetBandCount();
m_pReBar->GetReBarCtrl().SetBandInfo(nCount-1, &rbbi);
return true;
}
Error:
pdb->GetWindow(&hBand);
if(hBand == 0)
return false;
Why hBand is NULL??
|
|
|
|
|
Hi
I’m creating one windows service in my own purpose
Using msxml4.dll.
The process of service is to fetch the data from exchange server through webdav SEARCH METHOD
When i use this coding in windows form normal button click event , it works fine,
When I convert into windows service, it throws the error
The coding is below
MSXML2.XMLHTTP objXMLHTTP = new MSXML2.XMLHTTP();
writemethod("After Initialize");
System.Xml.XmlDataDocument xmlDOMParams = new System.Xml.XmlDataDocument();
objXMLHTTP.open("SEARCH", strInboxURL,false,strAliasName, strPassword);
objXMLHTTP.setRequestHeader("Content-type", "text/xml");
objXMLHTTP.setRequestHeader("Depth", "1");
string strXML;
strXML = "" +
" = \'DAV:\'>" +
"" +
"SELECT \"urn:schemas:httpmail:fromemail\"," +
------------------
---------etc…
objXMLHTTP.send(strXML); // Error Raised
The Error Raised in when i send the xml query
Any suggestion,please reply
We are using c#
Regards,
Arunkumar S
|
|
|
|
|
|
Did you try with any other client(VC++)?
|
|
|
|
|
Ya i tried using VC++ it is working but not with VB(I used IDispatch implimentation in Server application)
VINOD
|
|
|
|