|
hello friends i m converting vc .net 2003 project into vc 2005 (vc7).
i open my proj in vc2005 and then compile . i m getting following error in header file atlmisc.h file.
c:\program files\microsoft visual studio 8\vc\include\atlmisc.h(1159) : error C2440: 'return' : cannot convert from 'const wchar_t *' to 'TCHAR *'
can someone help me......
Harish
|
|
|
|
|
I suspect you are using WTL's version of CString. Dump the atlmisc.h, and include atlstr.h instead, to use ATL's version of CString. It might also do you some good if you upgraded WTL too.
--
Mr. Bender's Wardrobe by ROBOTANY 500
|
|
|
|
|
I want to load the menu in my application from an xml on same computer.
Can any one tell me about use of xml. I am new to that sector and hardly any help is available. I found one article on code project about dynamically loading of menu
from website. but ie win32 application ,and moreover as the webaddresses have changed
it is not working. Can any one tell answer ,or referances ,orname of relevant good books.
|| ART OF LIVING ||
|
|
|
|
|
You should ask in the XML Forum[^], not in here.
However, to save your first post being a copy of this, here's a few things to get you started.
In your stdafx.h file (or whatever you're using as a precompiled header) put
#import <msxml.dll> rename_namespace("MSXML") raw_interfaces_only named_guids
That will give you declarations for the various MS XML interfaces and such.
Secondly, you need to instantiate a document. Here's where it's a little tricky, since you have to know what version of MSXML you want to use.
CComPtr<MSXML::IXMLDOMDocument> spDoc;
HRESULT hr;
CLSID clsid;
if (SUCCEEDED(::CLSIDFromProgID(L"MSXML2.DOMDocument.3.0", &clsid)))
{
hr = ::CoCreateInstance(clsid, NULL, CLSCTX_ALL, MSXML::IID_IXMLDOMDocument, reinterpret_cast<void**>(&spDoc));
if (SUCCEEDED(hr))
{
// Yay, we have a document object!
}
}
Once you have one of those, you can load it
VARIANT_BOOL bLoaded = VARIANT_FALSE;
hr = spDoc->load( _variant_t(sourcefile), &bLoaded);
if (SUCCEEDED(hr) && bLoaded)
{
// Your document is loaded, use MSXML methods to interrogate the DOM document
// and extract your data...
}
MSDN has lots of information on IXMLDOMDocument and the other related interfaces, so dig around in there, or ask questions in the XML forum.
Steve S
Developer for hire
|
|
|
|
|
I design a ocx control based MFC ActiveX Wizzard,and It work and display well
and display in the test container of VC and other develop environment such as
VB.But it can‘t show rightly when I insert it to the word document.
About my ocx : A project based MFC ActiveX Wizzard , I placed a CSlider
control in the bottom of my control which was created dynamically. When drag the
slider I change bitmap from my resouces which displayed in the remainder part of
the control.
God save me! 3Q the expert provided clue or answers to the question.
Thanks!
|
|
|
|
|
I test it again ,and I found that The ocx control can not display in design mode
of word but do in normal mode. It's the practical case.
Could anybody help me to make the ocx control display the UI in design mode of
word also ! Thanks.
|
|
|
|
|
Please help me.I have problum that when i change the asp pages are shown on top left cornor.i want the asp pages are shows same on different resulotion.
ayaz ullah
|
|
|
|
|
Hello !
you might have specified the length/width of the objects(like tables) in pixles. To look you page same on different resolution, specify the object scales in percentage (%).
-Malli...!
|
|
|
|
|
Following things I done so that I stop getting errors.
1) Copied WTL folder at various places
2) Copied WTL files in VC98, and many combinations.
3) I installed WTL wizard
4) Tools --> options I included, directories ,libraries etc
It gives errors in bunch for CString ,IXMLDOMDocument and upto 103 same.
if any one know how to link WTL.
Compiling...
MainTool.cpp
d:\shiv\w32\atlcom\natureofmind\xmldom.h(64) : error C2039: 'CString' : is not a member of 'WTL'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(64) : error C2146: syntax error : missing ';' before identifier 'GetXML'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(64) : error C2501: 'CString' : missing storage-class or type specifiers
d:\shiv\w32\atlcom\natureofmind\xmldom.h(88) : error C2065: 'IXMLDOMDocument' : undeclared identifier
d:\shiv\w32\atlcom\natureofmind\xmldom.h(88) : error C2955: 'CComPtr' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\atl\include\atlbase.h(563) : see declaration of 'CComPtr'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(88) : fatal error C1903: unable to recover from previous error(s); stopping compilation
NatureOfMind.cpp
d:\shiv\w32\atlcom\natureofmind\xmldom.h(49) : error C2143: syntax error : missing ',' before '&'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(49) : error C2059: syntax error : '&'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(61) : error C2143: syntax error : missing ',' before '&'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(61) : error C2059: syntax error : '&'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(64) : error C2039: 'CString' : is not a member of 'WTL'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(64) : error C2146: syntax error : missing ';' before identifier 'GetXML'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(64) : error C2501: 'CString' : missing storage-class or type specifiers
d:\shiv\w32\atlcom\natureofmind\xmldom.h(88) : error C2065: 'IXMLDOMDocument' : undeclared identifier
d:\shiv\w32\atlcom\natureofmind\xmldom.h(88) : error C2955: 'CComPtr' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\atl\include\atlbase.h(563) : see declaration of 'CComPtr'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(88) : fatal error C1903: unable to recover from previous error(s); stopping compilation
ReflectionWnd.cpp
d:\shiv\w32\atlcom\natureofmind\xmldom.h(49) : error C2143: syntax error : missing ',' before '&'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(49) : error C2059: syntax error : '&'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(61) : error C2143: syntax error : missing ',' before '&'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(61) : error C2059: syntax error : '&'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(64) : error C2039: 'CString' : is not a member of 'WTL'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(64) : error C2146: syntax error : missing ';' before identifier 'GetXML'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(64) : error C2501: 'CString' : missing storage-class or type specifiers
d:\shiv\w32\atlcom\natureofmind\xmldom.h(88) : error C2065: 'IXMLDOMDocument' : undeclared identifier
d:\shiv\w32\atlcom\natureofmind\xmldom.h(88) : error C2955: 'CComPtr' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\atl\include\atlbase.h(563) : see declaration of 'CComPtr'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(88) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Supl.cpp
d:\shiv\w32\atlcom\natureofmind\xmldom.h(49) : error C2143: syntax error : missing ',' before '&'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(49) : error C2059: syntax error : '&'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(61) : error C2143: syntax error : missing ',' before '&'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(61) : error C2059: syntax error : '&'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(64) : error C2039: 'CString' : is not a member of 'WTL'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(64) : error C2146: syntax error : missing ';' before identifier 'GetXML'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(64) : error C2501: 'CString' : missing storage-class or type specifiers
d:\shiv\w32\atlcom\natureofmind\xmldom.h(88) : error C2065: 'IXMLDOMDocument' : undeclared identifier
d:\shiv\w32\atlcom\natureofmind\xmldom.h(88) : error C2955: 'CComPtr' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\atl\include\atlbase.h(563) : see declaration of 'CComPtr'
d:\shiv\w32\atlcom\natureofmind\xmldom.h(88) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Surrender.cpp
d:\shiv\w32\atlcom\natureofmind\xmldom.h(49) : error C2143: syntax error : missing ',' before '&'
|| ART OF LIVING ||
|
|
|
|
|
What version of Visual Studio are you using?
Have you tried building a new test application?
You know you're obsessed with computer graphics when you're outside and you look up at the trees and think, "Wow! That's spectacular resolution!"
Only kings, presidents, editors, and people with tapeworms have the right to use the editorial "we."
|
|
|
|
|
Are you including atlmisc.h? That's where CString is defined. You typically include this in stdafx.h.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
I am using VC++ 6.0 and have included atlmisc.h
|| ART OF LIVING ||
|
|
|
|
|
This problem is yet not solved ?
|| ART OF LIVING ||
|
|
|
|
|
Patience is a virtue; do you think we have nothing better to do than answer questions all day?
Before you include any WTL headers, try
#define _WTL_USE_CSTRING
This tells WTL to define and use it's own CString implementation, instead of relying on the MFC one. If you have VC7 or later (which you apparently don't), CString doesn't really need the rest of MFC.
Steve S
Developer for hire
|
|
|
|
|
Dear Friend
Did you noticed problem is not with only CString. It is giving problem with
d:\mrutyunjaya\xmlload\xmldom.h(82) : error C2065: 'IXMLDOMDocument' : undeclared identifier
d:\mrutyunjaya\xmlload\xmldom.h(82) : error C2955: 'CComPtr' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\atl\include\atlbase.h(563) : see declaration of 'CComPtr'.
Thanks for CString suggestion I will try that.
We have came in world only for doing human service , that is only joy on this earth which dont have tail of sorrow.
|
|
|
|
|
Well, the file producing the errors isn't a standard one, but my guess is that you're not including an MS supplied file, like msxml.h or something, since that would define IXMLDOMDocument. In any case, this latter issue is nothing to do with WTL.
Steve S
Developer for hire
|
|
|
|
|
#include <msxml2.h> ?
--
Made From Meat By-Products
|
|
|
|
|
I have a recurive loop where each element has to get its parent and retrieve the property
CComPTR<ihtmlelement> spElem=....
.........
........
.......
IHTMLElement* spParentElem=NULL;
while (1)
{
CComBSTR bsTagName;
spElem->get_tagName(&bsTagName);
std::string thisods=ODSTag;
ODSTag=OLE2A(bsTagName);
if(thisods.size() > 0)
{
ODSTag+= ".";
ODSTag+=thisods.c_str();
}
hr = spElem->get_parentElement(&spParentElem);===>memory leaks here
if (FAILED(hr) || !spParentElem)
break;
spElem.Detach()->Release();
spElem=NULL;
spElem = spParentElem;
}
I am getting massive memory leaks in the line above.What am i doing wrong here?Any help or advise would be appreciated.Thanks in advance.
|
|
|
|
|
Firstly if you use the "sp" prefix, which generally stands for "Smart Pointer", the variable in question should actually be a smart pointer. i.e.
CComPtr<IHTMLElement> spParentElem;
Don't write misleading code.
Make your code like this:
CComPtr<IHTMLElement> spParentElem;
while (1)
{
CComBSTR bsTagName;
spElem->get_tagName(&bsTagName);
std::string thisods=ODSTag;
ODSTag=OLE2A(bsTagName);
if(thisods.size() > 0)
{
ODSTag+= ".";
ODSTag+=thisods.c_str();
}
spParentElem.Release();
hr = spElem->get_parentElement(&spParentElem);===>memory leaks here
if (FAILED(hr) || !spParentElem)
{
break;
}
spElem.Detach()->Release();
spElem=NULL;
spElem = spParentElem;
}
The addition is shown in bold.
I'm going to finish with a bitch. We can't see any "<"s or ">"s or what's between them: this is important in C++ code. Also there is no formatting. Please make an effort to make things easier for the people who are taking time to help you. At the very least you could tick the "Ignore HTML tags in this message (good for code snippets)" check box.
Steve
PS: I can see iteration here but no recursion.
|
|
|
|
|
Very well written answer indeed i like your style
You know you're obsessed with computer graphics when you're outside and you look up at the trees and think, "Wow! That's spectacular resolution!"
Only kings, presidents, editors, and people with tapeworms have the right to use the editorial "we."
|
|
|
|
|
|
I have an SDI application. This SDI application has a Splitter control, which has Pane controls and the pane controls themselves have other child controls. So, there is a hierarchy of controls. Now, If I have the handle of any child control, I want to get the Handle of the SDI application window. Is there any way to achieve this?
GetParent() may work, but I would certainly not know how many GetParent()s I am supposed to call. For Example, if I have the HWND of the PaneControl, I would have to call GetParent() twice. One for the Splitter control and the other for the application Window. Similarly, if I have the handle of the Splitter control, I would have to call GetParent() only once. This is the why I think GetParent() is not such a good idea. Any other options?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|
|
I think AfxGetMainWnd will do.
--
======
Arman
|
|
|
|
|
Is there an AfxGetMainWnd in ATL/WTL?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|
|
Is there an AfxGetMainWnd in ATL/WTL?
Ah sorry, not sure. I though of MFC forum, sorry again.
--
======
Arman
|
|
|
|