|
Hi
In my code I am parsing XML using MSXML .But I am not able to get Node values using MSXML .How to read the node values?
IXMLDOMNode* nodeVal;
CString csXMLValue;
BSTR bsSelectedNodeItemName;
hResult = pChildNodeList->get_item( nIdx, &nodeVal );
hResult = nodeVal->get_nodeName(&bsSelectedNodeItemName);
if ( 0 == _tcscmp( OLE2T( bsSelectedNodeItemName ), L"User" ) )
{
nodeVal->get_nodeValue(&vtNodeValue);
}
but vtNodeValue is NULL .My XML node structure is
<User >2700</User>
<User>3700</User>
I want to read the node values ie,2700 and 3700
thanks in advance
|
|
|
|
|
What you (and common sense) call 'node value' of User is actually just its child, another (text) node.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
click here ->[^]
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Hello Friends
I am working on a MFC based application. and one class is exported like this
class AFX_EXT_CLASS sample : public CObject
{
}
In this way they are exporting to some other classes.But when I tried to change or add some more variables in its header file and then run,It Crashes.
And Its header file is not in ints solution,Its in some other Interfaces.
I have two Questions Now:
1)How Can I add more variables to Header file?
2)How can I use this class variables of this one dll into another dll.I am aware abt linking lib and dll.But main Question is how do i will use this into any other solution?
Thanks In Advance.
Any Help will be Appreciated.
Regards
Yogesh
|
|
|
|
|
You will have to recompile all modules depending on your exported class if you change it. Other than that, adding a member to the class is no problem.
|
|
|
|
|
#include "stdio.h"
#include "conio.h"
#include "windows.h"
#include "Wininet.h"
#include "Ras.h"
#include "raserror.h"
#pragma comment(lib, "rasapi32.lib")
int main()
{
LPRASCONN lpRasConn;
DWORD dwCb=0;
DWORD dwRet;
DWORD dwConnections = 0;
HRASCONN hRasConn;
lpRasConn = (LPRASCONN) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwCb);
lpRasConn[0].dwSize=sizeof(RASCONN) ;
dwRet = RasEnumConnections(lpRasConn, &dwCb, &dwConnections);
if(dwRet==ERROR_SUCCESS)
for(int i=0 ; i < dwConnections ; i++)
{
hRasConn= lpRasConn[i].hrasconn;
BOOL b=RasHangUp(hRasConn);
}
_getch();
}
i don't know where was it wrong?
sorry if my english is not well
|
|
|
|
|
The for loop is wrong.
It looks incomplete.
|
|
|
|
|
can you help me indicate that error...i don't know plz
|
|
|
|
|
It looks OK now.
I guess something is wrong with me today.
|
|
|
|
|
thanhl0v3 wrote: i don't know where was it wrong?
Neither do we. Why don't you bother telling is what is happening vs. what is supposed to happen.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi,
thanhl0v3 wrote: dwCb=0;
// ...
lpRasConn = (LPRASCONN) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwCb);
You allocate a block of zero size, so it's unlikely useful
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
I'm using the Visual Studio 2010 under XP Prof, compiling a MFC application.
I've created a dll, which works without problems, so far so good.
But now I liked to move some code from my main application to that dll, this code uses the CMFCPropertyGridProperty class.
After that, I tried to compile my dll, but the compiler throws a C2504 error (unknown basic class). Compiling the same piece of code within my main application everything works fine.
At least I tried to use some other classes like CMFCButton in my dll, but the compiler throws the same error, on the other hand I use classes like CBitmap or CString in my dll, without any errors.
Has anyone an idea, how to use "CMFC..."-classes with in a DLL, please let me know.
Thanks a lot!
Ralph
|
|
|
|
|
Hi Ralph,
your DLL project uses MFC? And do you include afxpropertygridctrl.h?
Regards,
Christoph
|
|
|
|
|
Hallo Christoph,
thank you very much for your reply!
I use MFC for both, application and dll, which also both include stdafx.h. Normally this should be enough, that Visual Studio automatically includes all necessary afx-header files, I guess.
And I also tried to include additional the "afxpropertygridctrl.h" for itself, but it didn't solve the problem and the compiler throws additional errors (as far as I remember), so I thought there has to be a simple solution, like setting any additional options or so.
Regrads
Ralph
|
|
|
|
|
Hi Ralph,
seems that CMFCPropertyGridProperty is derived from CObject so it is very strange that the compiler complains about the base class being unknown. Since I do not know VS 2010 very well I can only assume that you still have to add additional MFC headers by hand to your stdafx.h. What kind of errors do you get when you add the afxpropertygridctrl.h manually?
Furthermore it would be a good idea to compare both project's compiler and general settings.
Regards,
Christoph
|
|
|
|
|
Hi Christoph,
I've just compiled the dll project with an additional "#include "afxpropertygridctrl.h" " and now the compiler throws only the following error:
error C2512: 'CMFCPropertyGridProperty': No default constructor is available for the specified class
because my test code looked like these (for testing purpose of knowing the class):
CMFCPropertyGridProperty m;
After changing the line to:
CMFCPropertyGridProperty m(_T("Group") ) ;
it works!!
Sometime you only need someone who poses the easy questions twice to point out the own problems.
Thanks a lot for your help!!!
Regards Ralph
|
|
|
|
|
Hi Ralph,
thanks for your feedback. Great that it works now using the correct constructor.
Best regards,
Christoph
|
|
|
|
|
hello guys.... I have a project, when I build it it gives an error
ICommDlgBrowser2: base class undefined
in shobjidl.h I dont know how this file got included and how this error is coming.
Here is some of the code around that error
EXTERN_C const IID IID_ICommDlgBrowser3;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("c8ad25a1-3294-41ee-8165-71174bd01c57")
ICommDlgBrowser3 : public ICommDlgBrowser2
{
public:
virtual HRESULT STDMETHODCALLTYPE OnColumnClicked(
__RPC__in_opt IShellView *ppshv,
int iColumn) = 0;
virtual HRESULT STDMETHODCALLTYPE GetCurrentFilter(
__RPC__out_ecount_full_string(cchFileSpec) LPWSTR pszFileSpec,
int cchFileSpec) = 0;
virtual HRESULT STDMETHODCALLTYPE OnPreViewCreated(
__RPC__in_opt IShellView *ppshv) = 0;
};
#else /* C style interface */
|
|
|
|
|
Check if your project (and your system) meets the requirements on the ICommDlgBrowser2 Interface at MSDN.
From such page:
Note Windows Vista and later. Prior to Windows Vista this interface was declared in Shlobj.h.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I want to use the class CList for my project, but I get the following compiler error as soon as I do #include <afxtempl.h>
Compiling...
snaplogger_main.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
CSnapLogger.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
CDeviceFileParser.cpp
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxv_w32.h(18) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
CCommsManager.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
|
|
|
|
|
piul wrote: Compiling...
snaplogger_main.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
Not a real error, but only an information.
[...]
piul wrote: CDeviceFileParser.cpp
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxv_w32.h(18) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
Do you include Windows.h anywhere explicitly?
How does the stdafx.h of your project look like? Where do you include afxtempl.h?
Regards,
Christoph
|
|
|
|
|
I do not see any stdafx.h in my project. And no, I do not include Windows.h explicitly.
afxtempl.h is included in CDeviceFileParser.h
Any idea of why windows.h is being included? And why should this be a problem??
|
|
|
|
|
What kind of application did you create? Is it a MFC application? Seems so since you intend to use afxtempl.h. Can you please check the the project settings?
Regards,
Christoph
|
|
|
|
|
I am not very sure if it is a MFC application, I did not create it myself.
Project properties says:
Use of MFC : Use Standard Windows Libraries
|
|
|
|
|
Maybe it would be the easiest way to create an empty MFC project and add the files of the Win32 project to that?
Or simply try to change the "Use of MFC" to "Use MFC in a Static library" and rebuild. Don't know if this will work.
Regards,
Christoph
|
|
|
|