|
use WM_MDINEXT to enum mdi windows
|
|
|
|
|
I tried to "steal" this message for my CDialog class even though its not in the classwizrad for my cdlg class. SO i did:
void CRemote::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
lpMMI->ptMinTrackSize = CPoint(640,460);
lpMMI->ptMaxTrackSize.x = min(lpMMI->ptMaxTrackSize.x, 1228);
lpMMI->ptMaxTrackSize.y = min(lpMMI->ptMaxTrackSize.y, 900);
CMDIFrameWnd::OnGetMinMaxInfo(lpMMI);
}
============
E:\tests\Remote.cpp(63) : error C2248: 'OnGetMinMaxInfo' : cannot access protected member declared in class 'CWnd'
but the same thing works when this code in my my MainFrame class...
Can I do this ? What needs changed? If not, howe to restrict size of CDlg?
Appreciate your help,
ns
|
|
|
|
|
You need to call:
CDialog::OnGetMinMaxInfo(lpMMI) not CMDIFrameWnd::OnGetMinMaxInfo(lpMMI) , and don't forget ON_WM_GETMINMAXINFO() in your message map.
By the way, is your dialog resizable?
ÿFor the bread of God is he who comes down from heaven and gives life to the world. - John 6:33
|
|
|
|
|
yes. it is resizable. Thanks. Finally why didnt the Cwizard have this in its available trappable messages for my CDialog class? For that reason I didnt think that CDialog had a OnGetMaxMinINfo function....
Many thanks!
Appreciate your help,
ns
|
|
|
|
|
Hi,
the class wizard has a message for GetMinMaxInfo. Just change the message filter from Dialog to Window.
I don't know, why they filtered this message out for dialogs. Probably because dialogs usually are not resizeable.
G. Steudtel
Efen dwarves started small.
|
|
|
|
|
Thats really cool.....setting filter as "Window" instead of "dialog" . I really thank you because I dont have to put in the stuff myself in the maps.....
Appreciate your help,
ns
|
|
|
|
|
Hello,
i want to show a ContextMenu when the user click(right) on a tab (of a CTabCtrl). I tried to handle the OnNMRclickTab - Message but I had no sucess (no mouse coordinates and no information about the Tab which has been clicked...)
How can I solve that problem?
|
|
|
|
|
Did you try: WM_CONTEXTMENU (afx_msg void OnContextMenu ( CWnd* pWnd, CPoint pos ))?
I didn't try it though but I don't see any reason why it shouldn't work.
ÿFor the bread of God is he who comes down from heaven and gives life to the world. - John 6:33
|
|
|
|
|
|
Hi,
how can I reactivate the one and only view of the one and document in a SDI app?
A little explanation why I must do this: I have a standard SDI application and added a ControlBar with an embedded CEditView latetly. The problem is, that this EditView will activate itself within the MainFrame if you click on it. I need the possibility to reactive the View of the main document programatically if I want to do some view dependant processing, for example closing the app. Closing the app e.g. will query the active view wether the underlying document has changed. If I have the wrong view active (e.g. the CEditView), this message is send to the wrong document.
As a second example: The CEditView is a LogConsole for my application. If I have activated the CEditView, e.g. with a mouseclick I want to reactivate the main SDI view with the ESC key like the Output Control bar in the Visual Studio. But how do I find the document to send the Acitvation command to?
In a MDI application there is the MDIGetActive() window, i think, but there seems to be no such window handle in a SDI application.
I thought about hooking somewhere into the InitialUpdateFrame or OnCreateClient procedure, and safe the created view from there. But I'm sure wether this is safe, also when I have opened different documents.
Thanks for any ideas.
Dirk
|
|
|
|
|
...Why in the world are you using CEditView???...
Sounds like all your problems would go away if you just switch to plain edit. CEditView is there to support view & document stuff, you seems to not want either? ( You are using SDI, EditView stuffed in control bar most likely has some other document )
So either use plain Edits or switch to MDI and limit it to single document, remove windows menu, get rid of close view.
Brian
|
|
|
|
|
Hi,
because the CEditView can do FindText out of the box.
I know, you can always implement that yourself, but why should I. Only because MFC does a tight coupling between Views and the Frame?
There are thousands of reasons, why someone does this or that. I tried converting my application to an MDI app. With the result, that this is as much trouble, than sticking with an SDI app.
Views are the same thing than Controls. Only that they have an attached document (which is no problem), and that they talk to the frame directly (which is a problem). There is no bad thing about using Views as Controls. Thing for example at the CScrollView. I can think of a lot of Controls that could need scrolling capabilites. Why shouldn't I use a CScrollView as the base class for such controls.
And now think of a CFrameView that has these CScrollView derived controls on them. Boom, you get the same problem if you click on this control.
I would have derived my controls from a CScrollCtrl if there was one, but there wasn't.
I would have used a CEditCtrl that can do FindText, if there was one, but there wasn't
Dirk
|
|
|
|
|
This is what I did and it doesnt crash but is it safe etc? I am going to put this in my OnSize to find out what the width and height of the window are so I can pinpoiint the exact dimensions when the dlg looks best. Then I'll make onsize restrict it to these minimum dimensions when its resized. I think I'l get cx, cy which are height and width, so I dont need CRect, but I was wondering if there is a more direct way of outputting two simple integers rather than formatting them into a string...
thanks
void CTestsView::OnButtonwrite()
{
CFile cFile("E://testWrite.txt", CFile::modeCreate|CFile::modeWrite);
CRect cRect;
GetClientRect(&cRect);
int width = cRect.Width();
int height = cRect.Height();
CString pos;
pos.Format("widthe %d height %d", width, height);
int bufLength = pos.GetLength() + 1;
LPCTSTR lP = pos.GetBuffer( bufLength);
cFile.Write(lP, bufLength);
cFile.Close();
pos.ReleaseBuffer();
}
|
|
|
|
|
FILE *fp = fopen(filename, "a");
fprintf(fp, "%d,%d", a, b);
fclose(fp);
-c
When history comes, it always takes you by surprise.
|
|
|
|
|
oh! Thanks!
My fix-minimum-dimensions idea is flawed. I tried in OnSize()
if (cx > 120 && cy > 130)MoveWindow(left, top, cx, cy) where top and left are from Crect cRect and GetClienRect.
Two things: 1. It scooted my dlg to 0,0 on the screen instead of where it was so I amggoing to try getwindowplacement. The other and more serious thing is that it flickers greatly asI try to oversize it and it snaps back...
Whats the smart way that I'm not seeing of doing this fix-minimum?
Appreciate your help,
ns
|
|
|
|
|
GetWindwoRect is good , but not gEtClientRect ...why ?
ALos the flicker still remains
Appreciate your help,
ns
|
|
|
|
|
Hello,
I need to embed the Microsoft Internet Explorer Control...
Unfortunately I cannot use the MFC classes CHtmlView etc, the project doesn't use MFC.
How can I embed the Internet Explorer? Any tutorial, link, hint?
-Dominik
|
|
|
|
|
|
I've to display a previously readed RAW image: I've stored image data into a LPBYTE buffer, then I read every 24bit to get RGB code.
If the image size is lower than 12528000 byte (2000x2088 pixel) there's no problem, but if I exceed this size, I can't get no more bitmap created in the memory DC.
This is my code:
<br />
CBitmap* oldBmp;<br />
CProgressBar loadBar("Loading RAW data", 40, m_BmHeight*m_BmWidth);<br />
<br />
m_pVHDbmp = new CBitmap;<br />
int bmpResult = m_pVHDbmp->CreateCompatibleBitmap(pDC, m_BmWidth, m_BmHeight);<br />
TRACE("CVHDImage::CreateVHDBitmap - CreateBitmap result : %d\n", bmpResult);<br />
<br />
oldBmp = memDC->SelectObject(m_pVHDbmp);<br />
BYTE* tmpPtr = m_pDIBbits;<br />
UINT sizeByte = sizeof(tmpPtr);<br />
DWORD curY, curX;<br />
COLORREF tmpColor;<br />
loadBar.SetStep(m_BmWidth);<br />
for (curY = 0; curY < m_BmHeight; curY++){<br />
for (curX = 0; curX < m_BmWidth; curX++){<br />
CPixel* curPixel = new CPixel(*tmpPtr, *(tmpPtr+1), *(tmpPtr+2));<br />
tmpColor = memDC->SetPixel(curX, curY, curPixel->GetColorRef());<br />
tmpPtr+=3;<br />
delete curPixel;<br />
}<br />
loadBar.StepIt();<br />
}<br />
memDC->SelectObject(oldBmp);<br />
When I set m_BmWidth and m_BmHeight so that height*width>4176000 pixel (24 bit per pixel) the bmpResult is set to 0.
Why?
Is there a limit to bitmap creation size?
Thanks
|
|
|
|
|
Anonymous wrote:
Why?
Is there a limit to bitmap creation size?
Yes. You just hit it.
Joel Lucsy
|
|
|
|
|
So I've to split the 35MB raw image into two bitmaps or there's a secod way?
|
|
|
|
|
With such large images as that (up to about 700MB),
I've had good results by creating a DIB section for
just the viewable area needed (a "window" on the image)
and directly copying the image data into the DIB before
blitting to screen. The main image remains just the
raw data and you only use pieces of it as required.
|
|
|
|
|
I didn't try this way yet, but I think it's the same, as I've got to let the user zoom in and out, so when the zoom will be set as "fit in window", I've got to create a DIB section big enough.
And there we are again...
|
|
|
|
|
Make your DIB always as big as the viewable area in the display,
not the source. Then it is all a matter of how you fill that
DIB section. If you will be zooming, you'll have to do a bit
more than simply copying pieces of scan lines. You have to
resample or interpolate from the RAW image. For performance, you
may wish to limit zooming out to discrete steps and for large
zoom factors, you may even use a pre-resampled image that can
interpolated up or down for the final display.
|
|
|
|
|
I tried installing VC7 a while ago, and ended up having to remove it. Once I did that, I was no longer able to run 16-bit programs on my NT machine. I have been searching the web since then for an answer to this but cannot find anything.
Does anyone have any idea how I can get my NTVDM.EXE back running properly again? It just sits there at 99% until I kill it.
Ugghh!
|
|
|
|