|
I want my VC program window run as the sidebar,what should I do ?
|
|
|
|
|
|
hello,
I need to parse a text file and take some tag as <cover href="url"> or , I need it to be written in C, do you think I better use an XML parser ( if yes, which one should I use?, I premitt that I've not got much experience with XML) or should I better so it sequentially by doing
<br />
if( strcmp(line,"<cover..............)???<br />
thanks in advance
Paolo
|
|
|
|
|
Easiest will be to process the input char-by-char. Use a state machine, switching states when you reach a '<' or a '>', adding the finished tags or between-tag-content to arrays as appropriate. As a matter of a fact, you should have state changes for spaces and '='s inside the tags as well.
|
|
|
|
|
You can use the static string parsing methods in this[^] article to do exactly that.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
A SAX-parser would probably be the best solution for you. They're fast and they don't require lots of memory. Parsing XML using SAX-parsers is kind of like recursive descent parsing if I'm not mistaken. When the parser finds an element <img , it'll call your callback, notifying you of that. Then when it finds href="img" , it'll call your callback notifying you of that. So, basically you need two (possibly three) callbacks. One for notifying you that you've <img has begun, one that tells you href="img" was found, and possibly one that says </img> .
Here's one such parser: libxml2[^]. It's licensed under the MIT License, so there's no problem using it in a closed source/commercial application.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
I'm trying to pass a value between property sheets in a CFormview.
From searching old comments in this forum, I read that the method is to use GetParent();
However this gets me the CMainframe window that doesn't appear useful for passing such variables.
Suggestions anyone ?
|
|
|
|
|
To pass values between sibling pages on a property sheet, use the PSM_QUERYSIBLINGS message. Use CPropertyPage::QuerySiblings to send the message.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
PJ, I have seen this method alluded to several times, and have tried getting it to work unsucessfully as well. Most likely when I do get it working it will be one of those things where I'd go, "Is that all that had to be done!!!"
As Losehead said there have been numerous questions about this in the forum, so if you could put this matter to rest it would be great.
For me I can't see how to use the wParam and lParam at all.
Regardz
Colin J Davies
* WARNING * This could be addictive The minion's version of "Catch "
It's a real shame that people as stupid as you can work out how to use a computer. said by Christian Graus in the Soapbox
|
|
|
|
|
It's not all that difficult really. I figured it out by stepping through the MFC source code.
The first step is to look at the CPropertyPage::QuerySiblings function
LRESULT CPropertyPage::QuerySiblings(WPARAM wParam, LPARAM lParam)
{
ASSERT(::IsWindow(m_hWnd));
ASSERT(GetParent() != NULL);
return GetParent()->SendMessage(PSM_QUERYSIBLINGS, wParam, lParam);
} You will see all it does is sends a PSM_QUERYSIBLINGS message to the parent CPropertySheet. The property sheet's default behaviour is to relay the PSM_QUERYSIBLINGS message to all of it's child pages. So for each page you would set up a message map entry to catch the PSM_QUERYSIBLINGS message, and add the function to handle it.
BEGIN_MESSAGE_MAP(CMyPropertyPage, CPropertyPage)
ON_MESSAGE(PSM_QUERYSIBLINGS, OnQuerySiblings)
END_MESSAGE_MAP()
...
LRESULT CMyPropertyPage::OnQuerySiblings(WPARAM wParam, LPARAM lParam)
{
return 0;
} If you want the property sheet to handle the message, you would set up the sheet's message map to also catch the PSM_QUERYSIBLINGS message. Just be sure to call Default() so that the default handler gets called.
LRESULT CMyPropertySheet::OnQuerySiblings(WPARAM wParam, LPARAM lParam)
{
return Default();
} If you want to change the wParam and lParam values when your sheet handles the message, and pass the changed values onto the property pages, you will have to send the PSM_QUERYSIBLINGS message to each window yourself.
LRESULT CMyPropertySheet::OnQuerySiblings(WPARAM wParam, LPARAM lParam)
{
int nPages = GetPageCount();
LRESULT result = 0;
for (int page = 0; page < nPages, result == 0; ++page)
result = GetPage(page)->SendMessage(PSM_QUERYSIBLINGS, wParam, lParam);
return result;
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
|
Check out my latest article http://www.codeproject.com/useritems/Psm_QuerySiblings.asp[^]. It is my answer to your question in article format. Had to get my article count up some how
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks PJ, You are a top chap.
I'm sure there are plenty of other "tricks" you know like this that need documenting.
Sure some of them must seem simple to you now, however they will save a lot of other programmers a lot of time.
Regardz
Colin J Davies
* WARNING * This could be addictive The minion's version of "Catch "
It's a real shame that people as stupid as you can work out how to use a computer. said by Christian Graus in the Soapbox
|
|
|
|
|
|
hi !
One can create a profile quite easily by using MAPI. But how does he create an e-mail account inside the profile programatically , and also maybe set that account as the default one ? Any of you guys having any info on this ?
Thanks in advance
Kane
Some guys hack just to get themselves a girlfriend.what a pathetic reason , huh ?
|
|
|
|
|
Hi there,
Basically I have several modeless dialog boxes which need to have their title bars customly painted. This is due to the fact that I can't let the windows look inactive -- they must all appear to the user to be simultaneously active.
Anyway, because I couldn't find a better solution to solve this (OnNcActivate
seems to block messages from reaching the main frame window for some reason...), I was wondering if someone knows of an API method (or an example) which could allow me to draw the title bar (and perhaps the window frame if needsbe)? Something similar to DrawFrameControl , but for the window frame itself?
Thank you,
David
|
|
|
|
|
if i had to do this, i would fake the titlebar.
i would construct the dialogbox without a title and paint
the title myself.
you can construct the buttons also
then:
m_dialog1->writeMyTitel("Title 1");
m_dialog2->writeMyTitel("Title 2");
|
|
|
|
|
Hi, thanks for the reply.
GermanGeorge wrote:
i would construct the dialogbox without a title and paint
m_dialog1->writeMyTitel("Title 1");
Yeah, I understand, but is there any GDI method I could use to draw the window title? Something similar to DrawFrameControl which would make the window title look according to the user's installed Windows OS style? [I mean, under Windows '95 the windows look differently than they do in Windows XP]
Cheers,
David
|
|
|
|
|
you are right.
but, i found a solution to your problme (hopefully)
it works fine here.
in the header of the modeless dialog declare:
afx_msg BOOL OnNcActivate( BOOL bActive );
In the MassageMap of the dialog declare
ON_WM_NCACTIVATE()
add a method:
BOOL Dialog1::OnNcActivate (BOOL bActive)<br />
{<br />
return TRUE;<br />
}
that's it.
|
|
|
|
|
Do you know a good article about managing the instances of an application ?
|
|
|
|
|
|
How do i create a new window ina MFC dialog based app w/o using window wrapper class SDK way ?
|
|
|
|
|
::CreateWindow or ::CreateWindowEx .
|
|
|
|
|
Not SDK way ... with "Create" or "CreateEx" there is no way really ?
|
|
|
|
|
Now you leave me baffled. What is it that you want to do, not use SDK and not use any classes? As this is completely nonsensical, I guess you have to clarify the question a little.
|
|
|
|