|
Hi,
I'm develpoing appication in C# and because of posible decompilation danger, we decided to use COM (created in VS 6 C++) for hiding code about licenses, isntead of obfuscating(which I think is not really helpfull). Is COM a good way how to hide/protect code, are there any ways to crack it (of course there are, but is it easy) ? Is there maybe some COM dll encrypting ?
thanx
|
|
|
|
|
How can wedisplay animated gifs and also able to type text in same window.
What type of window control lets you type text as well as put animated gif in it.
|
|
|
|
|
I have never gotten any answer from this site!!!!!
|
|
|
|
|
I have created an MFC ActiveX Control through the wizard. In the 2nd Step of the wizard I have enabled the checkbox saying “Available in Insert Object Dialog”, so that I can use my control in Microsoft Office Application like MS Word, Excel, PowerPoint etc using Insert Objects.
I am using property sheet to change the text contents of my control. For that I followed the steps mentioned the MSDN Example CIRC.
http://msdn2.microsoft.com/en-us/library/c6hzbzz6(VS.80).aspx
My control features the following characteristics.
• Changing the painting behavior of an ActiveX control
• Adding stock properties
• Adding custom properties
• Responding to mouse events
• Adding custom events
• Using text and fonts
• Implementing ActiveX control property pages
• Using simple data binding for control properties
But at present I am stuck up problems.
1. Using property sheet I can update the text contents in ActiveX test container. But it doesn’t get updated in Word, and other Office Applications. In fact its not even recognizing any of the event fired by the user (like changing the color on mouse click, key press etc) in any of the office application.
2. I am using this control for assigning digital signatures to a document. For that I am using X509 libraries. But these libraries use Common Language Runtime (/CLR) Support. And if I enable CLR from the project settings, the control crashes while loading on the Office application, ultimately crashing the entire document.
|
|
|
|
|
Dear friends,
What is the difference between BSTR and char*. I am writing a COM dll. It has an API which accepts a string (like patient name). Which datatype should be used? BSTR or char*? Please advice me.
Thanks in advance
Shihab
|
|
|
|
|
Loosely speaking, BSTR is a strange beast, it is zero-terminated like a standard C-string, but it is prefixed by its length like a Pascal one (dont' worry about that, there are API like SysAllocString , or even classes, like _bstr_t , that do the job for you).
That stated, BSTR is used for automation, so, if you have to interact with automation clients (for instance, scripting languages) then you have to use BSTR (BTW your server also needs to implement a dual interface ...). On the other hand, if your client is a standard Window application, written in C/C++, you can go also with char * (also Visual Basic code will be able to access you component, in a way similar to the one used to access Win32 API functionalities).
Hope that helps.
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.
|
|
|
|
|
|
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
|
|
|
|