Click here to Skip to main content
15,911,141 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: ODBC timeout Pin
Eytukan23-Feb-09 21:47
Eytukan23-Feb-09 21:47 
QuestionHow do I redirect output of my console using PsExec? Pin
SherTeks23-Feb-09 21:20
SherTeks23-Feb-09 21:20 
AnswerRe: How do I redirect output of my console using PsExec? Pin
Garth J Lancaster23-Feb-09 21:52
professionalGarth J Lancaster23-Feb-09 21:52 
AnswerRe: How do I redirect output of my console using PsExec? Pin
David Crow24-Feb-09 3:24
David Crow24-Feb-09 3:24 
GeneralRe: How do I redirect output of my console using PsExec? Pin
SherTeks24-Feb-09 17:31
SherTeks24-Feb-09 17:31 
QuestionUsing MSXML Parser in the VC++ 2005 Express Edition Pin
Ajit Jadhav23-Feb-09 21:18
Ajit Jadhav23-Feb-09 21:18 
AnswerRe: Using MSXML Parser in the VC++ 2005 Express Edition Pin
Eytukan23-Feb-09 21:29
Eytukan23-Feb-09 21:29 
AnswerRe: Using MSXML Parser in the VC++ 2005 Express Edition Pin
Stuart Dootson23-Feb-09 22:55
professionalStuart Dootson23-Feb-09 22:55 
To use #import with an Express edition, you need to remove any mention of ATL (as the express editions don't ship with ATL). That means no smart pointers, no wrappers for VARIANT or BSTR. You can tell #import not to use ATL with attributes (see the second example below).

So, it can be done, but it means going from code like this:

#include <tchar.h>

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // some CString constructors will be explicit

#include <atlbase.h>
#include <atlstr.h>

#include <iostream>

#import <progid:Msxml2.DOMDocument.6.0> rename_namespace("TestNS")

int _tmain(int argc, _TCHAR* argv[])
{
   CoInitializeEx(0, COINIT_MULTITHREADED);
   TestNS::IXMLDOMDocument3Ptr pDoc(__uuidof(TestNS::FreeThreadedDOMDocument60));

   pDoc->load("CHange-History.xml");
   pDoc->setProperty("SelectionLanguage", "XPath");
   TestNS::IXMLDOMNodeListPtr selected = pDoc->documentElement->selectNodes("//configuration");
   long nodeCount;
   selected->get_length(&nodeCount);
   std::cout << nodeCount << " configuration nodes\n";
   CoUninitialize();
	return 0;
}


to code like this (it runs and gives the same answer as the code above, but I'm not sure that I manage resources correctly....

#include <tchar.h>
#include <iostream>

#import <progid:Msxml2.DOMDocument.6.0> rename_namespace("TestNS") raw_interfaces_only no_implementation no_smart_pointers raw_native_types

int _tmain(int argc, _TCHAR* argv[])
{
   CoInitializeEx(0, COINIT_MULTITHREADED);
   TestNS::IXMLDOMDocument3* pDoc;
   HRESULT hr;
   
   if (SUCCEEDED(hr = ::CoCreateInstance(__uuidof(TestNS::FreeThreadedDOMDocument60), 0, CLSCTX_ALL, __uuidof(TestNS::IXMLDOMDocument3), (void**)&pDoc)))
   {
      BSTR file = ::SysAllocString(L"CHange-History.xml");
      VARIANT vFile;
      V_VT(&vFile) = VT_BSTR;
      V_BSTR(&vFile) = file;
      VARIANT_BOOL loadedOK;
      if (SUCCEEDED(hr = pDoc->load(vFile, &loadedOK) && loadedOK == VARIANT_TRUE))
      {
         BSTR propName = ::SysAllocString(L"SelectionLanguage");
         BSTR selectionLanguage = ::SysAllocString(L"XPath");
         VARIANT vSelLang;
         V_VT(&vSelLang) = VT_BSTR;
         V_BSTR(&vSelLang) = selectionLanguage;
         TestNS::IXMLDOMElement* docElement;
         BSTR xpath = ::SysAllocString(L"//configuration");
         TestNS::IXMLDOMNodeList* selected;
         if (SUCCEEDED(hr = pDoc->setProperty(propName, vSelLang)))
         {
            if (SUCCEEDED(hr = pDoc->get_documentElement(&docElement)))
            {
               if (SUCCEEDED(hr = docElement->selectNodes(xpath, &selected)))
               {
                  long nodeCount;
                  if (SUCCEEDED(selected->get_length(&nodeCount)))
                  {
                     std::cout << nodeCount << " configuration nodes\n";
                  }
                  selected->Release();
               }
               docElement->Release();
            }
         }
         ::SysFreeString(xpath);
         ::SysFreeString(propName);
         ::SysFreeString(selectionLanguage);
      }
      ::SysFreeString(file);
      pDoc->Release();
   }
   CoUninitialize();
   return 0;
}


Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Using MSXML Parser in the VC++ 2005 Express Edition Pin
Ajit Jadhav24-Feb-09 6:19
Ajit Jadhav24-Feb-09 6:19 
GeneralRe: Using MSXML Parser in the VC++ 2005 Express Edition Pin
Stuart Dootson24-Feb-09 6:28
professionalStuart Dootson24-Feb-09 6:28 
Questionhow can i see the fucntions available in the dll file. Pin
hariakuthota23-Feb-09 21:14
hariakuthota23-Feb-09 21:14 
AnswerRe: how can i see the fucntions available in the dll file. Pin
KarstenK23-Feb-09 21:28
mveKarstenK23-Feb-09 21:28 
AnswerRe: how can i see the fucntions available in the dll file. Pin
Archy_Yu23-Feb-09 21:42
Archy_Yu23-Feb-09 21:42 
GeneralRe: how can i see the fucntions available in the dll file. Pin
Chandrasekharan P23-Feb-09 21:52
Chandrasekharan P23-Feb-09 21:52 
Questionmultithreading and read only STL container Pin
manustone23-Feb-09 20:57
manustone23-Feb-09 20:57 
AnswerRe: multithreading and read only STL container Pin
KarstenK23-Feb-09 21:30
mveKarstenK23-Feb-09 21:30 
GeneralRe: multithreading and read only STL container Pin
manustone23-Feb-09 22:21
manustone23-Feb-09 22:21 
AnswerRe: multithreading and read only STL container Pin
Eytukan23-Feb-09 21:33
Eytukan23-Feb-09 21:33 
GeneralRe: multithreading and read only STL container Pin
manustone23-Feb-09 22:21
manustone23-Feb-09 22:21 
QuestionSet Monitor Contrast.............? Pin
shaina223123-Feb-09 20:51
shaina223123-Feb-09 20:51 
AnswerRe: Set Monitor Contrast.............? Pin
Nishad S23-Feb-09 21:40
Nishad S23-Feb-09 21:40 
GeneralRe: Set Monitor Contrast.............? Pin
shaina223124-Feb-09 16:20
shaina223124-Feb-09 16:20 
QuestionHow can add Picture control Programmatically Pin
hemlat23-Feb-09 20:20
hemlat23-Feb-09 20:20 
AnswerRe: How can add Picture control Programmatically Pin
Chandrasekharan P23-Feb-09 20:43
Chandrasekharan P23-Feb-09 20:43 
GeneralRe: How can add Picture control Programmatically [modified] Pin
hemlat23-Feb-09 20:55
hemlat23-Feb-09 20:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.