|
LCI wrote:
createProcessingInstruction("xml", "version=""1.0""", &pIXMLDOMProcessing);
Your quote-escaping is wrong, use \" not ""
createProcessingInstruction("xml", "version=<font color=blue>\"</font>1.0<font color=blue>\"</font>", &pIXMLDOMProcessing);
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Thanks for that... my error there..
But that still does not stop the compiler from saying that that function does not accept 3 arguments... Somehow, that function is has a different declaration and maybe it has something to do with the namespace. Do you know anything about that?
|
|
|
|
|
The example is using an older version. The prototype is:
IXMLDOMProcessingInstructionPtr createProcessingInstruction
(
_bstr_t target,
_bstr_t data
);
|
|
|
|
|
Hmm.
That seems to have done it. Where can i find documentation on the version that i am using because i have similiar issues with other functions, like appendChild and createElement
I call :
hr = pIXMLDOMDocument->appendChild(pIXMLDOMProcessing,&pNode);
and the compiler complains about appendChild does not take 2 args
and
hr=pIXMLDOMDocument->createElement(BSTR(L"Form"), &pIXMLDOMElement);
and the compiler complains about createElement does not take 2 args
Thanks for any input.
|
|
|
|
|
If you compile your code using an import statement, a file called msxml4.tlh will be generated from the typelib in the debug or release folder. You can see the prototypes in that file.
You can also open the msxml4.dll file in the Visual Studio Object Browser, which makes browsing the defs and prototypes a bit easier.
Cheers,
Tom Archer - Archer Consulting Group
"So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe
|
|
|
|
|
The following image shows what I'm talking about re: the object browser. Here you can see the prototype for the createElement method:
Cheers,
Tom Archer - Archer Consulting Group
"So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe
|
|
|
|
|
Tom thanks, i appreciate very much your responses. I am able to view the function declarations from the msxml4.tli file. My object browser does not seem to show the MSXML2. Maybe it is a setting thing, i dunno.
Now i am adjusting to this new parameter set and a little confused. Maybe you can answer this for me. Why are the .tli declarations so different from the MSXML 4.0 documentation example from microsoft that i was initially using. Is it like a patch to the MSXML 4.0 because in my declaration i do import msxml4.dll and use the namespace MSXML2, but yet my tli file declarations are different from the microsoft example.
Just a little confused..
Thanks again
|
|
|
|
|
LCI wrote:
My object browser does not seem to show the MSXML2
By default, you will only see the libraries in your project. You have to do the following:
- Open the Object Browser
- Click the Customize button at the top of the object browser
- When the Selected Objects dialog box appears, click the Add button
- Select the COM tab
- Select from the list the Microsoft XML 4.0 library and click the Select button
- Click the OK button to dismiss the dialog box
The library should now be viewable in the object browser.
Regarding the documentation, that I can't answer. I've just become accustomed to using the actual header file (or the object browser) to get the "real" prototype.
Cheers,
Tom Archer - Archer Consulting Group
"So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe
|
|
|
|
|
That is very cool...
Thanks for showing me that.
I am now able to continue development but have another question. Just attempting a simple task of trying to write
ThisForm
to an XML file. I wrote the code below, but am stuck at the appendChild line and the line after. Do i really need an IXMLDOMNodePtr?? How would i do it without?
MSXML2::IXMLDOMDocumentPtr pIXMLDOMDocument;
MSXML2::IXMLDOMProcessingInstruction *pIXMLDOMProcessing =NULL;
MSXML2::IXMLDOMNodePtr pNode;
MSXML2::IXMLDOMNode *pNode1 = NULL;
MSXML2::IXMLDOMElementPtr pIXMLDOMElement;
//Put some checks to create directory if not there
_variant_t varString = "C:\\XML\\myXML.xml";
// Initialize pIXMLDOMDocument (create a DOMDocument).
hr = CoInitialize(NULL);
hr = pIXMLDOMDocument.CreateInstance("Msxml2.DOMDocument.4.0");
// Load document.
if (pIXMLDOMDocument->load(varString)!= VARIANT_TRUE)
{
// trace(ERROR,"Error loading XML file");
}
//Populate the xml document
//Create elements
pIXMLDOMElement = pIXMLDOMDocument->createElement(BSTR(L"Form"));
hr = pNode->put_text (BSTR(L"ThisForm"));
if (SUCCEEDED(hr))
{
// Create a processing instruction element.
pIXMLDOMProcessing = pIXMLDOMDocument->createProcessingInstruction(BSTR (L"xml"), BSTR(L"version=\"1.0\""));
pNode = pIXMLDOMDocument->appendChild(pNode1);
pIXMLDOMDocument->putref_documentElement(pIXMLDOMElement);
}
//Save DOM to a file
hr = pIXMLDOMDocument->save(varString);
|
|
|
|
|
It looks like you have several problems here. What exactly are you trying to do?
Cheers,
Tom Archer - Archer Consulting Group
"So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe
|
|
|
|
|
Trying to create an XML file and write some basic tags in there.
Some tags will have attributes. So i am basically at this point trying to generate an XML file.
Trying to reproduce something like this through C++
-
<autosend>Yes
<responsekey printresponse="No" twowayxml="Yes">xvpqr7
<formname>RQ
|
|
|
|
|
Does the file exist currently? IOW, is this code supposed to create it from scratch or modify it?
Cheers,
Tom Archer - Archer Consulting Group
"So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe
|
|
|
|
|
File does not currently exist. I have to create it from Scratch. But it is supposed to look similiar to what is in the previous thread.
|
|
|
|
|
That process intruction is
?xml version="1.0" encoding="UTF-8" ?
I took off the brackets so that it should show up
|
|
|
|
|
Honestly, there's all sorts of issues here
* incorrect error checking
* use of incorrect types
* calling load when the file doesn't exist
* appending a node before you've created one
* appending a data node before the processing noe
* ...
I started to correct them all, but I think I found some code you can copy & paste that will get you started. Have a gander at http://www.codecomments.com/archive308-2004-5-195084.html[^] as this person is creating a simple document with a declaration node also. I ran the code and it works so this should get you started.
By the way, he's using the "older" style of manually using pointers and releasing them and so - as opposed to smart pointers. However, I'd just leave his code as is until you get a better feel for using the MSXML and then change it later.
At least that's the way I've always coded - get it to work first and then make it pretty.
Cheers,
Tom Archer - Archer Consulting Group
"So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe
|
|
|
|
|
Am i understanding this correctly?
We use a Node to represent the very first first tag in the document. After that we use elements for all subsequent tags. Is this correct?
If so, i understand how to add set attributes for elements but i do not see how to set attrabutes for Nodes. I am trying to set some attributes for my very first node in the document.
By the way, Tom that example really helped.
Thanks
|
|
|
|
|
I'm trying to get a simple example working that contains multiple string tables in a single resource file. In VC 7.1 (and maybe earlier), you can select "Insert Copy" on an existing dialog in the resource editor and specify a different language.
If I look in the .rc file, both English and French (in this case) sections exist. When I build my application, I would expect my French dialog to come up when I change my Windows' Regional settings to French (France). But it doesn't. Has anyone gotten this to work?
Thanks for any help!
|
|
|
|
|
Are you using MFC?
Because 23 out of 24 calls to find a resource only use FindResource instead of FindResourceEx .
The FindResource function determines the location of a resource with the specified type and name in the specified module. To specify a language, use the FindResourceEx function.
I am 'guessing' that the FindResource function returns the first resource it finds matching the module, name, and type, regardles if it matches the user's current language settings or not. For exmaple, look into the MFC source code at AfxFindResourceHandle .
Your best bet might be to write a wrapper for FindResource, and get it linked ahead of ALL the other libraries your app uses, or else hijack it. It can obtain the user's current language (see AfxGetPropSheetFont in MFC source as a decent example) and then you might have better luck.
Review these article (by title) on CP for some ideas:
APIHijack - A Library for easy DLL function hooking.
DLL Injection and function interception tutorial
HookImportFunctionByName v1.0
|
|
|
|
|
Hello,
I have an activeX control. I'm using class wizard to create the interface. How do I specify a parameter as an OUT parameter?
Thanks!
-Ian
|
|
|
|
|
Nevermind, I figured it out!
|
|
|
|
|
ok,im trying to work with António Feijão,Remote Library
ContextRemoteExecute, to execute code into an remote process(on windows 2000 SP4).I would post the code but its rather long winded,but basically here is what im doing
1-open remote process
2-allocate memory with VirtualAllocateEx
3-write my code to allocated spot
4-suspend thread
5-get threads context registers
6-change the threads Eip to my allocated mem (0x00C7001C)
7-resume thread,and it crashes.
here is the disassembly of the remote process(location returned by VirtualAllocateEx and where my injected code lies)
00C6FFFF ?? ???
00C70000 55 push ebp
00C70001 8B EC mov ebp,esp
00C70003 83 EC 40 sub esp,40h
00C70006 53 push ebx
00C70007 56 push esi
00C70008 57 push edi
00C70009 B8 B8 0B 00 00 mov eax,0BB8h
00C7000E 50 push eax
00C7000F FF 15 A0 88 4F 00 call dword ptr ds:[4F88A0h]
00C70015 5F pop edi
00C70016 5E pop esi
00C70017 5B pop ebx
00C70018 8B E5 mov esp,ebp
00C7001A 5D pop ebp
00C7001B C3 ret
00C7001C E8 00 00 C7 00 call 018E0021 //here is the problem
00C70021 EB FE jmp 00C70021
00C70023 00 00 add byte ptr [eax],al
00C70025 00 00 add byte ptr [eax],al
now i dont understand why "E8 00 00 C7 00" is calling 018E0021 ?? shouldnt it "call 00C70000" like its suppose to?
|
|
|
|
|
I read on the web that you can add a COleDateTimeSpan to
a COleDateTime. How can I do this?
I want to put together a function that adds days to a current
date. Im really having a hard time with this. The algorithm
works for awhile, and then I start getting -1/-1/-1 for the
dates.
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
Something like:
COleDateTime today = COleDateTime::GetCurrentTime();
COleDateTimeSpan oneDay(1, 0, 0, 0);
COleDateTime tomorrow = today + oneDay;
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Is there any easy way to add a month, a half-year or a year to
the current date using COleDateTimeSpan?
|
|
|
|
|
DanYELL wrote:
Is there any easy way to add a month...to
the current date using COleDateTimeSpan?
Sure there is. Given that you know what month it is, just add the number of days in the current month and you'll get the same date in the next month. For example, today is June 14th. June has 30 days. Add 30 days to June 14th and we get July 14th. Make sense?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|