|
The VC6 documentation for vector contains this note:
In this implementation, if a translator does not support member template functions, the template:
template<class InIt>
vector(InIt first, InIt last, const A& al = A());
is replaced by:
vector(const_iterator first, const_iterator last,
const A& al = A());
Does this apply to Platform Builder (it does to the STL provided with VC6)?
[edit]A possible workaround. Use the default vector constructor and initialise with std::copy[/edit]
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Stuart Dootson wrote:
Does this apply to Platform Builder (it does to the STL provided with VC6)?
Yes, it does apply to PB also. I read that note, but didn't understand its implications. Is that the reason why my try fails?
Crappy stuff from the dark ages...
Stuart Dootson wrote:
A possible workaround. Use the default vector constructor and initialise with std::copy
Yes, I had already tried that and it works perfectly on the emulator, byt seems to segfault in std::copy on a device. I must have done something wrong in the implementation of my iterator.
Meanwhile, I've resorted to brute force
for(; it != end; ++it)
filenames.push_back(*it); which is ugly but functional.
--
The Blog: Bits and Pieces
|
|
|
|
|
Yep, that's why your try fails - the only constructor provided which takes iterators for vector is takes the vectors const_iterator type. It's not templated.
The std::copy issue can be fixed using a std::back_insert_iterator . You can get one of these using the std::back_inserter function. You would then do something like:
std::copy(sourceBegin, sourceEnd, std::back_inserter(filenames);
HTH!!!
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Stuart Dootson wrote:
The std::copy issue can be fixed using a std::back_insert_iterator
Sorry for being unclear in my last post - I did try std::copy with std::back_inserter and it worked fine on the emulator, but something breaks on the device, so I have to debug that later. Meanwhile I go for the brute force method do have at least something.
Thanks anyway, Stuart
--
The Blog: Bits and Pieces
|
|
|
|
|
I am a beginer of learning programming by ATL ,I have writen a interface as below:
HRESULT GetBSTR1([out,retval]BSTR* bstrInfo)
{
CComBSTR b(L"hello,you have called GetBSTR1");
*bstrInfo=b.Copy();
return S_OK;
}
HRESULT GetBSTR2([out]BSTR* bstrInfo)
{
CComBSTR b(L"hello,you have called GetBSTR2");
*bstrInfo=b.Copy();
return S_OK;
}
and VB Client Codes as below:
Private Sub Command1_Click()
Dim a As New ATLTESTLib.TestOne
Dim str1, str2 As String
str1 = a.GetBSTR1
MsgBox (str1)
a.GetBSTR2(str2)
MsgBox (str2)
End Sub
problem is str1 is OK,but str2 is empty,why?
|
|
|
|
|
CALL a.GetBSTR2(str2)
or
a.GetBSTR2 str2
With best wishes,
Vita
|
|
|
|
|
thanks a lot. a.GetBSTR2(str2) is error but a.GetBSTR2 str2 Is OK,why? could you tell me the reason?
|
|
|
|
|
I also have a problem about BSTR Parameter,codes as below:
HRESULT GetBSTR3([out]BSTR* bufName1,[out,retval]BSTR* bufName2)
{
USES_CONVERSION;
CComBSTR b(L"hello,you have called GetBSTR3");
*bufName1=b.Copy();
TCHAR buf[]=TEXT("it is return value");
*bufName2=T2BSTR(buf);
}
VB Client as below:
Private Sub Command1_Click()
Dim a As New ATLTESTLib.TestOne
Dim str1, str2 As String
str2 = a.GetBSTR3(str1)
MsgBox (str1)
MsgBox (str2)
End Sub
running these codes, runtime error
if I write codes as below:
str2 = a.GetBSTR3 str1
compile error
how can I do it?
|
|
|
|
|
Listen Borther
Instead of using this
yingkou wrote:
str2 = a.GetBSTR3 str1
use this
str2 = a.GetBSTR3(str1)
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
str2 = a.GetBSTR3(str1)
if I use this method, str1 and str2 are both empty.
could you tell me the difference between a.GetBSTR2 str1 and a.GetBSTR2(str1)
|
|
|
|
|
Q: a.GetBSTR2(str2) is error but a.GetBSTR2 str2 Is OK,why? could you tell me the reason?
A: This is a VB syntax requirement. Look at "Call Statement" in MSDN.
Q: runtime error
Dim str1, str2 As String
str2 = a.GetBSTR3(str1)
A: Variable "str1" is a Variant type here, because VB treats the Dim statement as:
Dim str1 As Variant, str2 As String
You should specify the type for each variable.
With best wishes,
Vita
|
|
|
|
|
I do it just like what you have said
Dim str1 as String
Dim str2 As String
str2 = a.GetBSTR3(str1)
but str1 and str2 are both empty
|
|
|
|
|
what is MFC, WTL, ATL, CTL?? could nayone tell me. If i were to write a windows application using c++.NET what would i use
|
|
|
|
|
You can use any thing.it depends upon project
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
MFC, ATL, WTL are unmanaged code... if you want to write managed code I recommend that you use C#. If you really need to, you can use C++ / CLI.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
MFC = Microsoft Foundation Classes. It's a class library with functionality ranging from GUI to linked lists. Probably the most popular toolkit to write Windows applications in. At least it used to be.
ATL = Active Template Library. A class library aimed to ease developing COM applications. Since COM implies ActiveX controls, it's got some limited GUI functionality in it as well. With limited I mean that there are no CListCtrl or CEdit classes.
WTL = Windows Template Library. Is a complement to ATL. Since ATL's GUI support is quite rudamentary - it's enough to cover ActiveX control development, WTL was created to make the development of ordinary Windows apps. WTL builds on the same design principles as ATL, thus WTL code fits like a glove in ATL projects. As it's name implies, it makes heavy use of C++ templates. In my opinion a better mini MFC (MFC has a lot more functionality than ATL/WTL, hence "mini MFC").
CTL = I have no idea. Did you mean STL? STL = Standard Template Library. A standard class and function library, defined in the C++ standard. Contains containers, algorithms, I/O manipulation routines and memory management. Not only is it an excellent library to use, it's also excellently extensible due to its use of templates. Boost[^] is the proof of that.
Since you don't seem to have any idea about these toolkits, I suggest you start at the bottom first, and then work your way up. I'd like to think that STL is a strong foundation of any C++ application, and is thus located at the bottom. Learn it, and you won't have to reinvent the wheel more than twice or thrice. After that it all kind of depends on what you want to do. ATL is good if you are into COM stuff. But then you'd have to learn COM first. You don't need to know the COM stuff in ATL if you are going to use it in conjunction with WTL though. The windowing code is well separated from the COM stuff.
Whether you should choose WTL over MFC, or vice versa, is mostly a matter of taste. I prefer WTL over MFC because it's not as bloated as MFC, and of its (in my opinion) much better design. MFC may do much more for you than WTL alone, but that's easily cured with STL and Boost (see link above).
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
I blog too now[^]
|
|
|
|
|
I am reading Michael Dunn's WTL for MFC Programmers,he said"Also unlike CWnd when a CWindow object goes out of scope, the associated window is not destroyed...",So I don't understand Why the associated window is not destroyed,PLS show me . Thanks
|
|
|
|
|
|
|
hi
i have embeded an ActiveX control in a web page, when the page is accessed the control downloads and registers successfully on client's machine but it is not shown on the web page, instead a cross icon comes at its place
what might be wrong
plz help me its urgent
regards.
Muhammad Azam
|
|
|
|
|
I have a active-x ATL control. Inside my control I want to use InvalidateRect(), but I can not because it is not a window. Even I do I get Assert letting me know that it failed, because it is not a Window or no handle for the Window. What I am looking that how can I get the handle of the container. In my case it is a dialog Box.
Looking help I found this example. (
ATL Library Reference
CComControl::CreateControlWindow
)
RECT rc = {10,10,210,110};
HWND hwndParent, hwndControl;
// get HWND of control's parent window from IOleInPlaceSite interface
m_spInPlaceSite->GetWindow(&hwndParent);
hwndControl = CreateControlWindow(hwndParent, rc);
Here I am lost. How we can use IOleInPlaceSite to get the Window Handle.
Or if you have any other idea.
Your help will be very much appreciated.
Best regards,
Agha Khan
Agha Khan
|
|
|
|
|
If you're dealing with window less controls, take a look at the IOleInPlaceSiteWindowless interface. Query m_spInPlaceSite for IOleInPlaceSiteWindowless , and use the InvalidateRect() function. Not that I've ever written any window less controls, but from what I can tell, this seems to be the correct way to invalidate rectangles.
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
I blog too now[^]
|
|
|
|
|
Dear Jörgen Sigvardsson:
Well I am NOT writing Windowless control. Perhaps you have noticed that regardless it is Window control or not IOleInPlaceSiteWindowless is implemented. Bottom line is it does not work. I will let you know as soon as creak it.
Thank you for your prompt reply.
Agha Khan
Agha Khan
|
|
|
|
|
BilloKhan wrote:
Well I am NOT writing Windowless control
I don't get it. Didn't you say that the control had no window?
BilloKhan wrote:
Perhaps you have noticed that regardless it is Window control or not IOleInPlaceSiteWindowless is implemented.
Yep. That's because the code can handle both windowed and windowless controls, and it can even configure itself at runtime. IIRC, there's a member variable called m_bWindowless or similar that controls that behavior.
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
I blog too now[^]
|
|
|
|
|
Hello everybody,
I am creating a dll that contains some
Methods and these methods have some styles like:
#define dw_style 1401
After importing my dll and calling that method I want to
Use this dw_style name instead of 1401.
In another word I want a global #define.
////////////For example/////////////////////////////
//In the Dll file
#define dw_style 1401
..
methods
..
////////////////////////////////////////////////////
//////////In the mfc app and after importing the dll
method(dw_style)
..
..
Best Regards
Thanks.
|
|
|
|