|
My guess is CRect(-2, -3, 9, 8).
BTW you have a debugger, haven't you?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I have 2 rect
CRect rect1( 4,5, 60,70);
CRect rect2(10,11, 90,100);
Bool IsIntersected ;// to check whether the rectangles are intersected ?!
how to use IntersectRect to see wheather the rectangle are intersected
I saw from msdn it uses casting? !~!
|
|
|
|
|
From documentation http://msdn.microsoft.com/en-us/library/262w7389(VS.80).aspx:
CRect rect1( 4,5, 60,70);
CRect rect2(10,11, 90,100);
CRect rectInter.IntersectRect(rect1, rect2);
bool areIntersected = rectInter.IsRectNull()==FALSE;
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
That's viable (just make sure to declare the flag as BOOL , instead of bool ).
BTW: why posting question here, if you've the solutions?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi There,
I need to download web pages from a website but don't want the images on that page.
Please let me know how we can download only contents of web page without any image.
Thanks!
|
|
|
|
|
Did you see IHTMLElement?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi,
I'm a newbie in VC++.
I have to implement this into VC++, so please suggest.
|
|
|
|
|
Open a particular Directory
void CMultipleEOFDlg::OnBrowse()
{
CFileDialog dlg(TRUE);
CString sPath = "c:\\program files\\my folder\\1.c";
int nPos = sPath.Find("\\");
nPos = sPath.Find("\\",nPos + 1);
sPath = sPath.Left(nPos + 1);
dlg.m_ofn.lpstrInitialDir=sPath;
dlg.DoModal();
}
================================================================================
void CMultipleEOFDlg::OnBrowse()
{
char strFilter[] = { "Text Files (*.txt)|*.bcr|All Files (*.*)|*.*||" };
CFileDialog FileDlg(TRUE, "*.txt", NULL, 0, strFilter);
if( FileDlg.DoModal() == IDOK )
{
m_strFilePath = FileDlg.GetPathName();
}
AfxMessageBox(m_strFilePath);
UpdateData(FALSE);
}
|
|
|
|
|
Hi, just like the topic, thanks.
|
|
|
|
|
Nope, need a little more idea of what you mean. The terms you use are broad enough that you could mean one of several things.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I want to open a .html file via ShellExecute, but it has
warning. So I want to try use memory map file instead of
the file on disk, thanks your reply.
|
|
|
|
|
Yeahhh - can't see that making any difference. What was the warning you got?
[edit]Also - i know of no way to tell an application (using ShellExecute, CreateProcess or whatever) to open a file using a memory mapped file rather than any other mechanism - the way it opens files is a design decision of hte application and likely hard-coded into it.[/edit]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
ShellExecute opens shell items - objects that the shell is aware of. If you can make your memory mapped file visible to the shell (via a shell extension) you could make ShellExecute open it - but trust me, this is not something you want to do
|
|
|
|
|
After searching around i still can't get the right way.
Firstly, since there are lots of web tabs, how can I determine the exact one's HANDLE?
Secondly, there are a lot of code involving COM and BHO to solve this problem, common on, I just need the current webpage's source code, I don't need and don't want to learn the architect of COM and BHO before I can solve this problem!
Can somebody give me some hints, source code provided will be more appreciated!
BTW, somebody told me I can get the url and socket-send-receive the source code. But that didn't work because the URl in the address toobar of IE sometimes doesn't reflect the exact page so the safer way is to try to find the source code in local disk or somewhere else in my own computer.
Thanks!!
Jack
|
|
|
|
|
A BHO will be the easiest to do this.
Visual Studio ATL COM project wizard does give you the option to create a BHO.
An instance of the BHO is loaded for each tab of the browser.
So you needn't worry about identifying the correct tab.
A BHO must implement the IObjectWithSite interface.
When the BHO is loaded the IObjectWithSite::SetSite function is called and the web browser control interface pointer is passed in.
You can retrieve the web page source using IHTMLElement::get_outerHTML .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
cs60089 wrote: I don't need and don't want to learn the architect of COM and BHO before I can solve this problem!
Let me rephrase that for you:
"I have a tin of pineapple chunks. I don't nned and don't want to learn how to use a tinopener before I can solve this problem!"
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
As the dispute continues between me and doc/view, I'm posting my next rant/questions.
[The sample I'm talking about is simply the wizard generated SDI executable, without touching the keyboard. So the perfect default application in VS2005]
Ok, first off, How do I debug a document application, for example an SDI, When I click on "Save" from the menu, where does the command land? More importantly, How do I see it? Where should I keep the break point. just blows my mind.
Second, When you click on "save" it goes through Serialize() function [God only knows how it gets called], and when you check for "IsStoring()" that says true and hence..save. BUT, When I open a document, It doesn't go through the Serialize method. WTH?? It's been clearly said in the book. If "IsStoring()" is false, it means you are opening a document.
Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
AfxMessageBox("Saving");
}
else
{
AfxMessageBox("Loading");
}
}
Third,
And on what basis, do these handlers exist in the file where CMyApp theApp object exists. Where is the handler for "OnFileSave"? Why is it not transparent? Why do they need to show only New & Open option here? Do you agree with me, they are least intuitive when it comes to Doc/View?
ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)
Thanks.
|
|
|
|
|
grassrootkit wrote: Ok, first off, How do I debug a document application, for example an SDI, When I click on "Save" from the menu, where does the command land? More importantly, How do I see it? Where should I keep the break point. just blows my mind.
Look at the message maps - they tell you where the messages go. Also, pop a breakpoint on your Serialize method and look at the call stack - that shows you where the message has been routed.
grassrootkit wrote: Second, When you click on "save" it goes through Serialize() function [God only knows how it gets called], and when you check for "IsStoring()" that says true and hence..save. BUT, When I open a document, It doesn't go through the Serialize method. WTH?? It's been clearly said in the book. If "IsStoring()" is false, it means you are opening a document
The reason an open command might not land on your Serialize method is because you're re-opening the currently open document - that's certainly what I've found. MFC detects that case and performs no action (unless, I suspect, you've altered the document since you last saved it).
grassrootkit wrote: And on what basis, do these handlers exist in the file where CMyApp theApp object exists. Where is the handler for "OnFileSave"? Why is it not transparent? Why do they need to show only New & Open option here? Do you agree with me, they are least intuitive when it comes to Doc/View?
The handlers live with your app because you may have multiple documents and document types - the app attempts to determine what type of document you're opening before opening the document and asking it to load the file - even if you only have one document type and one document.
Yes, it can be obscure. The best way to approach MFC is to just go with the MFC flow and accept that it does loads of weird sh*t. Or try and work through a copy of MFC Internals[^]. And then accept that MFC's going to do what MFC does
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Stuart Dootson wrote: Also, pop a breakpoint on your Serialize method and look at the call stack - that shows you where the message has been routed.
Hmm, as you see in my case, it will not get into the serialize method. So I cannot put a break point anywhere and so can't catch the call stack.
A the worst case would be the "Save". I do not find any message map for "save". It would have been much difficult if it malfunctioned during save, I do not have a visible handler and it doesn't go through Serialize method. It'd be clueless, but anyway no problem yet with Save command.
Okay now , I see the handler for "OnOpen" command. But as you know it did not get into serialize method, I cannot put a break point there. If I want to see where the control goes, which file should I open to put the break point? In short,where will CWinApp::OnFileOpen() be defined?
ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)
Please hold on till I get the book
|
|
|
|
|
The SAVE message map should be in your doc class.
As I said, I found the serialize method is invoked when you open a different file than the one you currently have open (I saved a file called a.a then re-opened it - MFC detects that condition and doesn't re-open).
CWinApp is in the MFC source - I can't remember off the top of my head which file and I haven't got enugh battery to open VMWare Fusion (I use OS X normally) at thh moment Still - go into the MFC source directory and grep for OnFileOpen.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: The SAVE message map should be in your doc class.
Oops! You are right.
Stuart Dootson wrote: As I said, I found the serialize method is invoked when you open a different file than the one you currently have open (I saved a file called a.a then re-opened it - MFC detects that condition and doesn't re-open).
I knew my question was not clear this time.Sorry. Actually I understood what you said in your last reply. I was talking in context with the 0 size files. "Assuming I'm opening the 0 size file" and trying debugging, trying to catch the call stack. etc. Anyway helped enough already.
Stuart Dootson wrote: CWinApp is in the MFC source - I can't remember off the top of my head which file and I haven't got enugh battery to open VMWare Fusion (I use OS X normally) at thh moment Smile Still - go into the MFC source directory and grep for OnFileOpen.
Oh! okay No probs. You are clever to move out of windows .
|
|
|
|
|
grassrootkit wrote: I knew my question was not clear this time.Sorry. Actually I understood what you said in your last reply. I was talking in context with the 0 size files. "Assuming I'm opening the 0 size file" and trying debugging, trying to catch the call stack. etc. Anyway helped enough already.
(Back on AC now!) You're quite right - it doesn't bother calling serialize for zero byte files - makes sense, I guess.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|