|
One way:
CComBSTR myStr = L"iwantto-splitthis";
LPCWSTR pBegin = myStr;
LPCWSTR pEnd = pBegin + myStr.Length();
LPCWSTR pBreak = std::find(pBegin, pEnd, L"-");
if (pBreak!=pEnd)
{
CComBSTR FirstBit(pBreak-pBegin, pBegin);
CComBSTR EndBit(pEnd-pBreak-1, pBreak+1);
}</code>
This code assumes you've included <algorithm>
This is probably not the easiest or the best way but it should work (but I haven't tried it!).
Steve
|
|
|
|
|
Hi..
May any one tell me what is the best way to start learning COM programming?
"I am too late but i will never give up"
|
|
|
|
|
TheEagle wrote: May any one tell me what is the best way to start learning COM programming?
Programming.
Best,
Jun
|
|
|
|
|
May you tell me what is the best way to start learning COM Programming?
"I am too late but i will never give up"
|
|
|
|
|
Hi,
I managed to get myself started with one of the article in this forum that shows some very easy examples for beginers.
One think about COM is do you want the learn to do the full coding by hand. If that's the case, you may want to read up Essential COM which is highly recommended in this forum. It will show you some of the things that happen in the developement of the COM technology.
If you need to get something up fast, you may want to work with the ATL. There are plenty of articles on using ATL in this forum.
|
|
|
|
|
I have found them as you told me..thank you very much.
"I am too late but i will never give up"
|
|
|
|
|
Hi all,
I'm trying to put together a baseline example of integrating an ActiveX control with IE. I've built an MFC ActiveX control from the wizard and modified the OnDraw to draw a black ellipse rather than white.
My HTML looks like this:
<object id="activex"
CLASSID="CLSID:68D632F8-1644-44EA-9C71-725171D59E8E"
CODEBASE="http:AX2.ocx#version=1,0,0,1" height="300" width="300"/>
And the class ID is coming from the idl file:
[ uuid(68D632F8-1644-44EA-9C71-725171D59E8E), version(1.0),
helpfile("AX2.hlp"),
helpstring("AX2 ActiveX Control module"),
control ]
library AX2Lib
Does this look reasonably correct? Are there any references on ActiveX for IE that you'd recommend?
Marc
Pensieve
Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
|
|
|
|
|
<br />
CODEBASE="http:AX2.ocx#version=1,0,0,1"<br />
That http: looks rather odd there.
From the snippet it appears that you might be using the wrong classid. You need to make sure your .rgs file has the proper registration info in it as well.
Any reason you're using MFC and not ATL? Do you need the bloat?
Todd Smith
|
|
|
|
|
Todd Smith wrote: Any reason you're using MFC and not ATL? Do you need the bloat?
No, it was just a "start here and see what happens" attempt. You're the second person to recommend ATL, so, I'll investigate that next.
Marc
Pensieve
Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
|
|
|
|
|
ATL is in my opinion a lot smarter for doing ActiveX stuff. Will you be creating windowed or window-less controls? If you are going to create windowed ActiveX controls, I really do recommend that you add some WTL to reduce the Win32-ish coding.
If you are going to create window-less controls, the ATL wizard will put you on the right track.
BTW, to reduce compilation times, you may want to drop the "attributed" stuff. If you use the attribute-stuff (looks like .NET-attributes), the compiler will recompile the "hidden" IDL file everytime you recompile. If it's a small project, it will double the compilation times.
--
100% natural. No superstitious additives.
|
|
|
|
|
Marc Clifton wrote: CODEBASE="http:AX2.ocx#version
When I deployed an activex over the web, which I've really only done once, I made a .cab file with the .ocx, other support files and an .inf that contained all the installation info (default registry settings, etc).
The coolest part was that all I had to do was change the FileVersion # in both the .inf and html, then recreate the .cab and the .ocx would be automatically updated the next time people visited the site.
This is the html:
<OBJECT ID="MyOcxID"
CLASSID="CLSID:68D632F8-1644-44EA-9C71-725171D59E8E"
CODEBASE="MyCabFile.CAB#version=1,0,0,1">
</OBJECT>
Also, this might help:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaxctrl/html/msdn_deplactx.asp[^]
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
EricDV wrote: The coolest part was that all I had to do was change the FileVersion # in both the .inf and html, then recreate the .cab and the .ocx would be automatically updated the next time people visited the site.
Thanks for the pointers! I'll look into it.
Marc
Pensieve
Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
|
|
|
|
|
As far as technology is concerned:
if performance is what u r looking for, ofcourse ATL,WTL is the choice.
if development time and developers are the concern then VB6 is better, or even you can go for .Net controls with interop.
Regarding the code:
If you are using the html on a local computer, then u dont need to specify CODEBASE attribute. ie you can open the html by typing c:\axdemo\ax.htm in the explorer address bar without that CODEBASE attribute.
But if you need to acess it over http then you have to specify the CODEBASE atribute. either this can be a direct http based url to the ocx or it can be a .cab file to reduce download time.
download Activex Ccontrol Pad[^] from micorsoft for generating the html. They will do everything.
cheers ...Milton kb
|
|
|
|
|
Hi all,
i am about to write a BHO for an e-learing application. What I need is a non-blocking Timer for the Refresh of the browser. How could i use a timer to refresh every 5min or so without blocking the Browser Window...?
Still haven't got Scott Roberts famous book about IE Programming.
Thanks for your help
|
|
|
|
|
How to use executable(exe) and service exe with the client?
Is it same as using Dll with client?
Any sample links please?
Thanks
Row
-- modified at 8:02 Tuesday 20th June, 2006
|
|
|
|
|
I have a win32 library with no interfaces , just only exported functions.
e.g. One of those is .. bool getInfo (char *string, int counter);
I created a ATL exe , inserted a simple object.No I want to link the above library to my ATL project.
So in Project->settings->link, I gave the lib name and directory of the lib file.
Now I want to use this function getInfo in my atl program.
SO I added one method in my interface say CallLibFunction
And in that method I want to call getInfo..
Are these steps ok?
Row
|
|
|
|
|
Row wrote: Are these steps ok?
Yes,
These are the correct steps to add the library into project.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi All
I wonder about the reason that after create and use some com pointer ( Smart pointer ) why we must call delete of the current pointer ?
I know that the reason is to save memory - but if we does not delete the pointer the application will be crash and not have only leak of memory.
So some one can tell me why the application will crash in case we did not delete the pointer ??
Thanks for any help.
-- modified at 23:37 Monday 19th June, 2006
|
|
|
|
|
You don't use delete on a COM smart pointer, you call its Release() method if you need to manually release the interface. Although, you would usually let the destructor do that for you (that is, after all, the main reason for using the smart pointer in the first place).
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
VB > soccer
|
|
|
|
|
I'm trying to create a .dll using ATL, which I want use in C#.
Can anybody please guide me to create a simple method / function which takes string in input parameters and returns the same(string)..
I tried a lot but always faced problem of returing string back to calling function in C#.
I did the same with C++ class library successfully but when it comes to ATL its not the same.
As I'm using other SDK API's in creation of .dll and I can't go with Class Library its having problem with "CLR and MTd". Which can't go together. Finally I decided to stick to ATL.
Now please guide me to create the methods which I can use in C# to get the string value.
Arun
|
|
|
|
|
IDL defenition will be:
[id(1), helpstring("your atl method signature")] HRESULT YourATLMethod( [out,retval] BSTR* ReturnString);
and the C++ implimentation signature will be:
STDMETHODIMP CYourClass::YourATLMethod(BSTR* ReturnString)<br />
{<br />
_bstr_t bstrReturnstring = _T("some string here");<br />
*ReturnString = bstrReturnstring ;<br />
return S_OK;<br />
}
cheers..milton kb.
|
|
|
|
|
I want help on following.
I want to store properties for .doc,.xls,.ppt,.txt files. I used IStorage and IStream interfaces to store properties in the said files. It works well with .xls and .txt (on NTFS file system) files but not with .doc and .ppt files. I can write to files, and I can retrive the stored properties again successfully. But if I modify .doc or .ppt files using their editors (MsWord and MsPowerPoint respectively), properties only I had written appeared vanished, i.e. while next read from program fails for these properties (Properties written from Interface provided by Windows retain very well).
I tried IPropertySetStorage+IPropertyStorage also, but result is same.
I tried to write SummaryInformation,DocumentSummaryInformation storages.
I tried to write my own storages also. Userdefined storage retains this but these properties can be seen and modified from Windows user interface of properties for these files so I don't want to use it.
I am using C/C++ and WIN32 APIs.
Can any one help me on this plz.
First deserve then desire. Let be deserved first.
|
|
|
|
|
how could we use DTs in my vb.net code it always give me the following error
"13 query interface for customDTS.customtask dll"
plz reply me ?
|
|
|
|
|
[Was asked in the VC++ board earlier today, but got no replies...]
OK... I am working with an IDispatch -based interface that needs to be completely automation capable (i.e. uses the Typelib Marshaller - no custom marshalling).
Now, AFAICT:
o I can pass structures over an IDispatch -based interface as the structures consist solely of automation-capable types
o I can pass arrays of automation-capable types over IDispatch -based interfaces using SAFEARRAY (possibly wrapped within a VARIANT )
(For now, ignore the fact that some clients, like VBScript , may be unable to handle these kinds of parameters.)
However, I cannot seem to find information telling me that both are possible at the same time. IOW, I want to pass an array of structures across an IDispatch -based interface. The only information I can find regarding passing arrays of structures indicates that I will have to serialize the data to a byte stream and then send the raw bytes over the wire wrapped in a SAFEARRAY of VT_I1 types.
While I am sure I can make that work, and can provide clients with information on how to decode the structures, this feels kinda 16-bit-ish to me, and not just a little quick-n-dirty.
So, does anyone know if it is possible to pass arrays of structures over IDispatch-based interfaces, or do I have to do the byte-stream route? If so, please point me to the relevant documentation.
Adva[Thanks]nce! (Cheesy, I know... )
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I think its not possible without custom marshalling. You have to send these as byte arrays i.e., SafeArray of UI1 (VT_ARRAY|VT_UI1). I ran into some problem a little while earlier and I couldnt find any other way to do this.
I will be happy to take my words back if someone can point to anyother possible solution.
"Watching non-programmers trying to run software companies is like watching someone who doesn't know how to surf trying to surf."
|
|
|
|