|
The DOM works well for small files, SAX for larger ones.
Jason Henderson start page articles "If you are going through hell, keep going." - Sir Winston Churchill
|
|
|
|
|
One more thing to consider with the DOM versus SAX,
The DOM creates persistant data for your XML. It will read the data in and create an internal structure that you can refer back to whenever you need to read from a certain node.
The SAX on the other hand is a one pass mechanism, where you will use the APIs to read and write the data. The data is not persistant in the SAX API so once it has been read, it is forgotten and you are responsible for persiting the data in your app.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
The downside with SAX is that you almost inevitably end up writing FSA style stuff to deal with the incoming data, and there's no support for navigating the document as in DOM.
While writing a state machine isn't exactly rocket science, if you have never done it before there are many things to watch out for.
Steve S
[This signature space available for rent]
|
|
|
|
|
How to send a message from a parent window to child window...can i use post message for this...but i don't know how to select the the parameter UINT for the post message..can i use WM_USER..what is its format if i want to send a
string value?
|
|
|
|
|
You can send a message to any window as long as you have the handle to the window and there is a message handler to catch the message in the receiving window.
Anonymous wrote:
but i don't know how to select the the parameter UINT for the post message..can i use WM_USER..what is its format if i want to send a
string value?
I assume you want to send a custom message...
Use WM_USER to create the message id. Then you can send 0 or whatever as the uiParam and send a pointer to the string (LPCSTR works) as the lParam. You will have to cast it back to a string in the message handler.
Jason Henderson start page articles "If you are going through hell, keep going." - Sir Winston Churchill
|
|
|
|
|
There's a catch with sending strings, though. If you use PostMessage, there's no guarantee that your message will be processed at a particular time (like, before PostMessage returns).
So code like
{
char x[128];
SetupMyString(x);
PostMessage(otherWindow, WM_USER, 0, (LPARAM)x);
}
may well die a horrible death. If you need to do this, you either need a longer lived string, or alternatively, you could allocate, and have the receiver deallocate, but that relies on you having the source for the receiver to modify it in this way.
Steve S
[This signature space available for rent]
|
|
|
|
|
Hi all,
How can i get the name of server to which my PC is connected through software?.
With regards
Shibu
|
|
|
|
|
LookUpAccountName
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
|
I want to put a version of my app on my website that will allow someone to install and use the app on their machine for a limited time for evaluation purposes. Has anyone had any dealings with this and if so, how would I go about doing that?
|
|
|
|
|
Personally, I hid a file amongst the system directory, and used it in conjuction with a registry entry to fail after a month, and to fail if anyone tried to play with the registry or reset their system clock.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Christian Graus wrote:
fail if anyone tried to play with the registry or reset their system clock.
I know that it is possible to use RegNotifyChangeKeyValue() to monitor changes in a particular registry key. But even this does not work if they key is deleted. Am I right?
But how can I find out if someone has reset the system clock? Is there a similar function for this? Or would I have to write my own? If so, could you please give me any hints as to how to go about it?
Thanks very much.
Regards,
Rohit Sinha
|
|
|
|
|
By hiding the information elsewhere on the computer, so that if your program is run and the clock has gone back more than an hour since the last time, they changed it. You would also store the registry information there - the registry would be a smokescreen for your real, hidden system.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
it's very difficult to do this 100%... but, as a first try:
1. when your program starts, look in the registry for a key that your app would have created, if it has already run once. if the key isn't there, create it and add a DWORD value. set that value to the result from time().
2. if the key is there, get the value from the registry, get the current time, compare the two.
3. expire if difftime > X
that's a very basic way to do it. it's easy to beat, by just deleting the registry key or changing the system clock. but, if you don't think your customers are that sophisticated, this might be enough.
you can get much more complex, from here.
-c
As always, it's bread and circuses. And while bread is down right now, circuses are way up.
|
|
|
|
|
|
Hi, everyone!
Please look at the following statements,
--------
static void default_failure_notify(const char *);
void (*failure_notify) (const char *) = default_failure_notify;
--------
I think failure_notify stands for a pointer of a function,
whose return type is void and parameter list is (const char *).
Am I correct?
Cheers,
George
|
|
|
|
|
George Ma wrote:
Am I correct?
yes.
-c
As always, it's bread and circuses. And while bread is down right now, circuses are way up.
|
|
|
|
|
Thanks, pal!
You help a lot.
Cheers,
George
|
|
|
|
|
i want to send a function pointer to the dll so that dll could call my current application function?
let suppose
void add (int a,int b);
i want to send its function pointer to dll,so that it can be called in dll ?
is it possible ?
can any give the syntex of this example?
r00d0034@yahoo.com
|
|
|
|
|
declare a typedef somewhere
typedef void * (CALLBACK* MyCallbackFunctionType)(int a, int b);
in your DLL, have a function that accepts a function pointer as a parameter:
void SetCallback(MyCallbackFunctionType pCallback)
{
if (pCallback)
pCallback(a, b);
}
define the callback function in your app:
void CALLBACK MyCallbackFunction(int a, int b)
{
int c = a + b;
TRACE("%d+%d %d\n", a,b,c);
}
in your app:
SetCallback(MyCallbackFunction);
-c
As always, it's bread and circuses. And while bread is down right now, circuses are way up.
|
|
|
|
|
i want to creat a dll in my startup project's Dbeug directroy while compileing a dll sub project.
who to do it because i have seen many example but i could not understand?
r00d0034@yahoo.com
|
|
|
|
|
Go to your project settings for teh sub DLL, and click the general tab
then there is an edit box for your output files, simply change the directory from debug to the directory where you want it to go.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I have an MDI app using CEditView in the Doc/View architecture. In this view, I have a function like so, which I call from the Document class:
void CMyEditView::addText(LPCTSTR szOutput)
{
ASSERT_VALID(this);
int nSize = GetBufferLength();
GetEditCtrl().SetSel(nSize, nSize, TRUE);
GetEditCtrl().ReplaceSel(szOutput, FALSE);
}
After feeding it data for a while, the program inevitably crashes and the display gets corrupted. By watching the executable's resources in Task Manager, I notice that the GDI Objects are steadily increasing, until they reach 9999, and then the crash happens. By setting breakpoints, I can see that one GDI Object is consumed every time CEdit::ReplaceSel() is called, and never released.
Is this method for appending text to an Edit Control contained in a View appropriate? Anyone know a better way? Using GetWindowText() and SetWindowText() has the same problem! Any thoughts as to what's happening, and how I can prevent the resource loss?
Thanks !
scott sanders
|
|
|
|
|
I created a simple MDI application as you described and - using the same code you wrote - the GDI objects are changing between 31 and 32. It looks ok.
Where is that szOutput coming from?
rechi
|
|
|
|
|
Thank you for your reply !
After experimenting a bit more, I found out that the resource leak was actually coming from my CMyView::CtlColor() function. I was allocating a brush to change the background color of the window, depending on the program state, and never releasing it. So it was my silly fault all along; sorry to send you on a wild goose chase. I changed the brush to be static, and the problem disappeared.
Thanks again for looking into this for me.
scott
|
|
|
|