|
Hi,
I wonder if anyone here knows how to intercept the "activate window" items on the Windows menu of a standard MFC app? You know the ones, the list of MDI client windows with the hint "Activate this window"?
If anyone knows it would be most useful to me,
Thanks.
Jim
|
|
|
|
|
Looking through my string resources, I find "Activate this window" is String Resource with an ID of AFX_IDS_MDICHILD.
If you want to change it to another constant string, just change this string resource.
If you want it to be more dynamic, you will need to override void CFrameWnd::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu ,
which looks a bit more complex...
If you are more specific about what you want to change to, I/we may be able to help more.
Iain.
|
|
|
|
|
The problem we are attacking is to do with the fact that our document format saves the positions of the child windows. Our application is a traffic engineering program and it uses a lot of different views, each in a child window. For this reason we recommend our users to use a dual-monitor system.
We want to deal with a posible situation where a user is running on a two monitor system and passes a file to a user with only one: some of the windows could disappear off screen. We cannot make them reposition when they get the focus as the user may wish to move the window off screen for a few moments while they are working and we don't want windows jumping about all over the place.
We just want the windows to reposition when the user activates the window... so this is why we want to intercept the 'Windows' menu.
Thanks for your reply, I'll take a look at using CFrameWnd::OnMenuSelect and see if I can make that work.
Thanks!
Jim
|
|
|
|
|
In that case, I'd look at the command value(s) that "window 1", "window 2", etc pass. These will go through the normal command routing mechanism.
I've just looked, and the first window command is
#define AFX_IDM_FIRST_MDICHILD 0xFF00 // window list starts here
You could use
ON_COMMAND_RANGE_EX (AFX_IDM_FIRST_MDICHILD, AFX_IDM_FIRST_MDICHILD + 8, MyWindowHandler)
...
BOOL CMyFrame::MyWindowHandler (UINT nCmd)
{
....
return FALSE;
}
I can't remember the exact details of the handler definition, or whether the return should be true or false, but you can do the legwork - I'm too lazy.
Probably simpler than getting a menuselect handler wrong!
Iain.
|
|
|
|
|
Thanks to you pointing me in the right direction I was able to do it in the end:
<br />
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)<br />
{<br />
if (wParam >= AFX_IDM_FIRST_MDICHILD && wParam <= AFX_IDM_FIRST_MDICHILD + 8)<br />
{ <br />
HWND hWnd = ::GetDlgItem(m_hWndMDIClient, wParam);<br />
CMDIChildWnd* pChild = (CMDIChildWnd*)CWnd::FromHandlePermanent(hWnd);<br />
<br />
pChild->DoWhatEver();<br />
}<br />
<br />
return __super::OnCommand(wParam, lParam);<br />
}
The trick was realising that GetDlgItem() works with MDI child windows.
Thanks for your help,
Jim
|
|
|
|
|
good day to all of you!!!
by the way i have a trouble in understanding the timer botton in MFC coz im a beginner, then its really difficult for coz i dont have books, so please help me.
thank you so much.... i'll wait for ur reply
|
|
|
|
|
Are you asking what the equivalent in MFC of the VB timer event control?
AFAIK, MFC has no timer buttons.
I Dream of Absolute Zero
|
|
|
|
|
I'm working on a project that extracts the content (plain text and preferably image) of a html document and a url. Does anyone know how any method to do so?
|
|
|
|
|
It depends on what you're using. Is you're using MSHTML then you could get the text by using the innerText property on the body element. In C++ using ATL this could look something like this:
HRESULT GetText(IHTMLDocument2* pDoc, BSTR* pTextOut)
{
if ( pTextOut == NULL )
{
return E_POINTER;
}
*pTextOut = NULL;
CComPtr<IHTMLElement> spBody;
HRESULT hr = pDoc->get_body(&spBody);
if ( FAILED(hr) )
{
return hr;
}
return spBody->get_innerText(pTextOut);
}
To get the images you can use the IHTMLDocument2::get_images method.
NOTE: I haven't tried this code!
Steve
|
|
|
|
|
Hmm how do i get the images from IHTMLElementCollection? I shld use image rite but what parameters do I have to pass?
|
|
|
|
|
How do i extract text from MS word? It would be better if the end user does not need to have microsoft office installed.
|
|
|
|
|
The words from .doc file???
|
|
|
|
|
Well, try searching for any character with an ASCII value of between 32 and 128 (i think thats right, the characters that can be typed on a keyboard, but just check it before you do)
|
|
|
|
|
|
What i need is to convert a microsoft words document to a text file. How can I do this without having microsoft office? If not, using library in microsoft office is fine but how?
|
|
|
|
|
Geez. Open the document, parse it, but discard any formatting information - just keep the text. Write the text to a file. Done.
WHY, do YOU think, "Office-to-anything-else" converters are so freaking expensive?
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
|
From now on, questions are answered at a rate of 40 EUR/h.
Answering your last question would take around 6-12 months. Should I go ahead?
Seriously, if you really want to do it, you will have to analyze the file yourself. I aint got no clue how Word hides its content.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
I could recommend www.wordcnv.com[^] - these guys have fastest library, which can be supplied in a small (<50K!) lib file, and their support is great. I'm using their library myself.
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|
|
like others wrote, you need to do your own reverse engineering on the Word format to extract the text; which is no walk in the park.
I'm certain that if you google enough you might find something interresting on the subject.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Without using Word, you'll need to know the format of a .doc file. See http://www.wotsit.org/[^] for this.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
hi
Just type this in your VC project
void operator: (int kd)
{
}
Some time u may need to compile..
The visual studio will disappear ..
regards
krishnan
If u can Dream... U can do it
|
|
|
|
|
|
if u save that in some cpp file.. Then u can never able to open Your project.
If u can Dream... U can do it
|
|
|
|
|