|
using the following, the XML is saved as a single line in the file, and when loaded in either notepad
or VC6, it shows on one line :
MSXML2::IXMLDOMDocument2Ptr pXMLDoc;
pXMLDoc->save( path );
Is there a way to have some line-feed/carriage return so that the text XML is "well formatted" or at least better formatted so that it can be viewed in notepad ?
Thanks.
M.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
The only thing like that I know of is the preserveWhiteSpace property of the DOMDocument object. But I don't think that has any effect if you create a new file from scratch, only if you load and modify an existing file.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Hello folks,
I trying to instatiate a activex control, print template from Internet Explorer. The argv[1] parameter it's a path string to a HTML file(like these: c:\MyTemplate.htm). But it seems the type of vTemplatePath don't match and an exception is launched:
Error on line 474 atlbase.h
Expression: p!=0
I'm sorry to post this question here, but I'm a noob in C++. I'm a web programer(PHP, javascript, action script II), and I need very much of this.
Someone can help me to solve this?
Thanks a lot!
//Microsoft reference
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie55/html/beyondprintpreview.asp
//code
int main(int argc, char * argv[])
{
int i;
IOleCommandTarget* pCmdTarg;
CComPtr pWB;
CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (void**)&pWB);
pWB->QueryInterface(IID_IOleCommandTarget, (void**)&pCmdTarg);
VARIANT vTemplatePath;
V_VT(&vTemplatePath) = VT_BSTR;
CComVariant vPTPath = argv[1];
pCmdTarg->Exec(&CGID_MSHTML, IDM_PRINTPREVIEW, NULL, &vPTPath, NULL);
return 0;
}
|
|
|
|
|
What was the particular string being passed? Formatting, spaces, backslashes can all affect it.
Elaine
The tigress is here
-- modified at 4:43 Wednesday 8th March, 2006
|
|
|
|
|
The string is: "c:\MyTemplate.htm".
|
|
|
|
|
Hi,
I've got a problm with the datagrid. I've changed the datasource of my datagrid to a dataview in order to control this new row that is created when switching between readonly true to false. I am controlling the readonly toggle via a button on the same form. This works fine if I don't touch the datagrid prior to switching the readonly status. However once I have selected a cell in the datagrid and then change the status, it seems like the entire datagrid freezes and I can't do anything.
Any suggestions?
Thanks
David
Think, try, think, think, try, think, think, think, try, ASK, think, try, advance on step and start over...
|
|
|
|
|
I need some help in writing an OPC server. The ideea is that i don't really need to write an OPC server but rather something wich acts as an OPC server. There is an application (that's already running) which is an opc client and i need to add some new data to it. My ideea is to write my own OPC server(simulation ) wich connects to a database at one end and provides the access to the data that the existing application needs at the other end.
I know that what i need is not really an opc server and i have already read the few articles that were posted here (which were of great help in getting closer to my solution) but i really need a few advices on were to go to from here.
Thanks.
|
|
|
|
|
hi eusto
i am also working on the OPC server/client application though without database.
you can download the OPC client and server code from (the one from Metadynamics is good one)
http://www.opcconnect.com/source.php[^]
But in the client side code provided he used ATL object which i am not able to figure it out...if u find it ...plz help
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
Well..for the server part there is only LightOpc which...well..only provides russian language support and i spent the last day trying to figure things out. I'll get back to you on the client side problem when i get around to it
|
|
|
|
|
eusto wrote: Well..for the server part there is only LightOpc
No...you can donwload the sample code for both server and client (either in VC++ or VB) from Metadynamics website ..check the link posted above for the toolkits.
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
Okay so I created a dialog box with a List Control in it. I am trying to
get the index of the current item selected in order to retrieve the text and
use it in a map. I found examples here but for some reason I am not getting
an index number back. All I get is 0.
Heres the code:
<br />
std::map<std::string, int>mpCalibrations;<br />
<br />
********<br />
<br />
for(i=0;i<=74;i++){<br />
LvItem.iItem=i;<br />
LvItem.iSubItem=1;<br />
sprintf(Temp,"%d",mpCalibrations[calibrate_list[i]]);<br />
LvItem.pszText=Temp;<br />
SendMessage(hList,LVM_SETITEM,0,(LPARAM)&LvItem); <br />
<br />
<br />
case WM_NOTIFY:{<br />
switch(LOWORD(wParam)){<br />
case IDC_LIST2:{<br />
int iSlected=0;<br />
int lResult=0;<br />
if(((LPNMHDR)lParam)->code == NM_CLICK){<br />
iSlected=SendMessage(hList,LVM_GETNEXTITEM,-1,LVNI_FOCUSED);<br />
Please help..
TY
-- modified at 13:47 Tuesday 7th March, 2006
|
|
|
|
|
How about:
int nItem = SendMessage(hList, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
assert(nItem >= 0);
LVITEM lvi = {0};
char szTemp[128];
lvi.mask = LVIF_TEXT;
lvi.pszText = szTemp;
lvi.cchTextMax = sizeof(szTemp);
SendMessage(hList, LVM_GETITEMTEXT, nItem, (LPARAM) &lvi);
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Well, I still got a 0 back for nItem. I cannot see what the problem is.
Any other ideas???
|
|
|
|
|
At the time this code is executed, is there a selected item in the control?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
In debug mode(.NET), the value remains 0. Furthermore, I initialized the
value to 5 and it is being SET to 0. The final app, will allow you to select
an item and via the map, display the corresponding value in an EditBox for
modifying. I added this code to confirm that I'm getting 0 no matter what
I select.
The map is filled w/ random numbers for now.
<br />
if(((LPNMHDR)lParam)->code == NM_CLICK){<br />
int nItem = SendMessage(hList, <br />
LVM_GETNEXTITEM, <br />
-1, <br />
LVNI_SELECTED);<br />
SendMessage(hList, <br />
LVM_GETITEMTEXT, <br />
nItem, <br />
(LPARAM) &lvi);:confused:<br />
itoa(nItem,buffer,4);<br />
SetWindowText(hwndEdit,buffer);<br />
}
|
|
|
|
|
When you click a button to execute this code snippet, the list control will lose focus, and perhaps deselect any items that had been selected. Does the control have the LVS_SHOWSELALWAYS style?
What does this return:
int nCount = SendMessage(hList, LVM_GETSELECTEDCOUNT, 0, 0); Remember that items in the control are 0-based.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Getting back 0 from LVM_GETNEXTITEM is a valid return, not an error return; -1 is an error return (or "not items found"). Getting back 0 indicates that the first (zero-ith) item in the control is selected.
Calling SendMessage again with the same parameters will return zero again because you are still specifying -1 for the "start" of the search.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
A bit more code:
<br />
case WM_INITDIALOG:{<br />
HWND hList=GetDlgItem(hwnd,IDC_LIST2);<br />
SendMessage(hList,<br />
LVM_SETEXTENDEDLISTVIEWSTYLE,<br />
0,<br />
LVS_EX_FULLROWSELECT | LVS_SHOWSELALWAYS); <br />
Well David, I tried this snippet and a big fat 0. I initialized it to 500.
<br />
nCount = SendMessage(hList, LVM_GETSELECTEDCOUNT, 0, 0);<br />
itoa(nCount,buffer,10);<br />
SetWindowText(hwndEdit,buffer);<br />
James, my understanding is the above "SendMessage" will return the index
of the item selected. I'm selecting in the middle of my 75 item list.
Shouldn't it return a value the same as "GETCURSEL" does for a listbox???
This was so easy with a regular ListBox.(ughhhh)
I'm probably gonna be beating my head against the wall once the solution is
discovered. Something simple I'm sure...
|
|
|
|
|
What are they? Any good tutorial about it?
Regards [[]]
hint_54
|
|
|
|
|
|
I am super stuck and very frustrated. I have a simple date time control.
If I put in a date from 1970 on, everything works fine. If I put in a
date that is less than or includes 1969, the program crashes at the bottom
on the ASSERT line which is the last line of this code:
CTime::CTime(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec,
int nDST)
{
struct tm atm;
atm.tm_sec = nSec;
atm.tm_min = nMin;
atm.tm_hour = nHour;
ASSERT(nDay >= 1 && nDay <= 31);
atm.tm_mday = nDay;
ASSERT(nMonth >= 1 && nMonth <= 12);
atm.tm_mon = nMonth - 1; // tm_mon is 0 based
ASSERT(nYear >= 1900);
atm.tm_year = nYear - 1900; // tm_year is 1900 based
atm.tm_isdst = nDST;
m_time = mktime(&atm);
ASSERT(m_time != -1); // indicates an illegal input time
}
Looking at the call stack, the input is:
CTime::CTime(int 1960, int 6, int 3, int 0, int 0, int 0, int -1)
I tried changing the nDST to 0 or 1 and that doesnt stop the error from
coming.
Any ideas? Any chance I can email someone a small sample project that
keeps displaying this error?
Please, any response any one can give me will be greatly appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
DanYELL wrote: If I put in a
date that is less than or includes 1969, the program crashes at the bottom
on the ASSERT...
A crash is vastly different than an assertion. You canot use a value any earlier than midnight, January 1970.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Its an assertion error in the timecore.cpp file (line 40). I did
alittle more research on the web and found:
// If timeptr references a date before midnight,
// January 1, 1970, or if the calendar time cannot be
// represented, mktime returns –1 cast to type time_t.
I cant believe I cant use a value earlier than 1970. Isnt there a
work around somehow? Im trying to prompt for the persons date of
birth which in this case is in the 1960's. Is there any way to use
a date before 1970?
Please, any response any one can give me will be greatly appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
Use COleDateTime instead of CTime .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Wow! It worked. I dont know what I was thinking of using
CTime.
Thank you very much for you responses.
|
|
|
|
|