|
do u really think that merely assigning/swapping the pointers would do? I think you should look into the marshalling issues.. The memory that you are returning to client needs to be marshalled and allocated...
HTH
|
|
|
|
|
Hi all,
I need to send an array of char via serial line and I have a method to do that. However the string I should send is a CComBSTR. How can I convert it into a "old C style" array of chars?
Thank you in advance.
|
|
|
|
|
|
With Win2003 we have the ability to set up partions for COM to run on. Hence set up different properties for the same COM object under each partition.
I want to know if there is any way for us to do similar stuff in win2k.
Thanks!!
|
|
|
|
|
I want to create a wrapper control to MSFlexGrid Control. I want my Wrapper FelxGrid Control editable. I have done this following example in msdn. Now what i want is to have all the events and properties of MSFlexGrid control inhereted in my Wrapper ActiveX Control.
Mean my wrapper control should be editable and also handle all other events which MSFlexGrid control can handle.
|
|
|
|
|
|
Thanks S.Rod for your suggestions. But the problem is i want to know how can i inherit all the properties, events and methods of activex control in my wrapper activex control. Someone told me to learn containment and aggregation but i couldnt find the solution that way as well.
|
|
|
|
|
Aggregation can be done for instance by using the ATL CComAggregateCreator helper.
|
|
|
|
|
What if you dont have XP or Office 2002? SOL?
|
|
|
|
|
The "Office Web Components" package has nothing to do with the XP, Office 2002 or the Challenger space shuttle. I know it is so since I am running OWC at home with only Office97 installed. RTFM!
|
|
|
|
|
Hi
My company has asked me to develop a COM object that would be able to use within ASP scripts using VBScript. The object spec briefly is to allow a search of PDF, word and various other well known document files for keywords passed to the object.
My two questions are:
1) Having never done any COM before I need to know whether I should develop this in a Win2000 Server enviornment using C++ or VB (C++ I guess would be better) or if doing it in an XP Prof. Environment using Managed C++ or C# would be the better option. My worries are backward compatibility. The COM object is to be used in ASP scripts only, not ASP.NET so I am assuming to use C++, but I was wanting to avoid the DLL Hell issues I've heard so much about by using the ASP.NET method of the BIN directory for DLL's for development purposes only and then moving the developed DLL across to the Win2000 server...
2) Where can I get documentation that would allow me to know how to get the object to search through these various file types. I am specifically interested in the PDF file format.
Any help in this regard would really be great, many thanks.
John Cogan
|
|
|
|
|
Hello,
I have a C++ dll that exports a single function. This function is called by a VB client.
The function takes around 40 mins to complete and returns a bunch of safearrays. In the mean time, I want to display a dialog via the VB client, where the user has the option to cancel the function execution.
What is the best way to implement this ? Iam a novice, and would appreciate you pointing me to the right resources. Thank you.
|
|
|
|
|
vikca wrote:
What is the best way to implement this ?
Do not use VB
On a serious note, you don't have any choice on the VB side, because it's a monothreaded client.
The best way would be implementing this as something like BeginJob/GetJobStatus/CancelJob/EndJob on the C++ side and do the actual job on a separate thread.
Unfortunately, multithreading under COM is not easy for a novice, sorry. You'll need to deal with things like marshalling and synchronization objects, which are actually easy to use, but quite scary until you get used to them.
It's not the fall that kills you: it's the sudden stop - Down by Law, Jim Jamursch (1986)
|
|
|
|
|
Please can you point me to an appropriate resource/reading for the same ?
Thank you very much.
|
|
|
|
|
Do not use VB
On a serious note, you don't have any choice on the VB side, because it's a monothreaded client.
It does not mean that the VB cannot use the multithreaded server (or DLL).
If the DLL has the multithreaded (or asynchronous) BeginJob/GetJobStatus/CancelJob/EndJob functions, then VB can use them.
With best wishes,
Vita
|
|
|
|
|
This may not be obvious to you, but if the DLL exports only one function, what function in the DLL do you plan on calling to cause the 40 minute operation to be stopped? What you are proposing is practical and a very good UI design, but if the coder of the DLL has not provided you with any interface to cancel or halt the operation, you wont be able to accomplish what you hope too.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
This may not be obvious to you, but if the DLL exports only one function, what function in the DLL do you plan on calling to cause the 40 minute operation to be stopped?
IMHO, there is a decision with usage of any Windows synchronization objects (e.g. Event) and mandatory Message Pump.
With best wishes,
Vita
|
|
|
|
|
last string question of the day, I swear!
void Create(BSTR strCaption, BSTR strMessage, BSTR strNoPrompt, int nIcon)
{
m_strNoPrompt = SysAllocString( strNoPrompt );
m_strNoPrompt is a CComBSTR. Is SysAllocString mandatory?
---------------
Tired of Spam? Introducing InboxShield® for Microsoft® Outlook®
http://www.edovia.com
|
|
|
|
|
No, and that will leak actually. Just do a plain assignment, which will use the operator= that takes an LPCOLESTR .
m_strNoPrompt = strNoPrompt;
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
So
Func( BSTR strSomeString )
{
BSTR str = SysAllocString(strSomeString);
}
would be ok then? SysAllocString is only used to copy a BSTR to another BSTR?
Thanks for your help!
---------------
Tired of Spam? Introducing InboxShield® for Microsoft® Outlook®
http://www.edovia.com
|
|
|
|
|
LukeV wrote:
would be ok then?
Nope.
SysAllocString takes a wide string and allocates a new string in BSTR format. You have to manually free the bstr using SysFreeString .
You can let a CComBSTR object assume ownership of a bstr string. See CComBSTR::Attach for more information. When the CComBSTR assumes ownership of the bstr string, it means that it will free it when the CComBSTR object itself is deallocated (done in CComBSTR::~CComBSTR ).
--
Shine, enlighten me - shine
Shine, awaken me - shine
Shine for all your suffering - shine
|
|
|
|
|
Which one to use? It seems that COLE2T might get unstable in some part of my code, while OLE2T seems better... what's the difference and when to use 'em?
Thanks again!
---------------
Tired of Spam? Introducing InboxShield® for Microsoft® Outlook®
http://www.edovia.com
|
|
|
|
|
Ole2T is from good old ATL3 which is working with VC6.
It also needs the USES_CONVERSION macro.
It's stack-based (using _alloca()) and therefore it can not be used with large strings or in loops.
COLE2T is from ATL7, and only works with VC7.
Don't need the conversion macro
When using small data it allocates data on the stack for performance, but with larger data it allocates on the heap.
Is safe to use in loop, because it's basically a class, so allocated resources is free'ed when it goes out of scope.
Hope that helps a bit.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
So basically, I'm better off using the Cx2x macros for every situation? I don't have an example but I think I recollect these macros to bring problems or perhaps something I did (like not removing USING_CONVERSION) would make it fail...
---------------
Tired of Spam? Introducing InboxShield® for Microsoft® Outlook®
http://www.edovia.com
|
|
|
|
|
I use the Cxxx for all my conversions now, and I have not had any problems with them...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|