|
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!
|
|
|
|
|
See if there are invalid characters in your winnt\system32\config.nt or winnt\system32\autoexec.nt. (look at environment vars too)
You can compare these files with the same files in winnt\repair.
Reapply your NT Service pack (maybe some of the WOW files have become corrupt).
Hope it helps..
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Thank you very much.
I did some more searching, and found some information leading me to the same files you mentioned. I think it may have been a problem that I introduced, and not the VC7 installation.
I added
PATH=%PATH%;C:\utils\
to one of the files, (I may be wrong about the exact syntax). The idea was that I could use programs from my c:\utils when in a DOS window. It worked fine when using the DOS window but running 16-bit apps always failed.
I took this line out, and things are back to the way they were long ago.
Thank you very much for responding, and with the correct diagnosis.
|
|
|
|
|
Hi, I'm using Visual C++ 6 to build an ATL component, and I'm pointing my debug exe at the c:\program files\vs...\VB.exe and making the parameter a small test harness project in VB.
Now when I hit F5 to compile/launch my Component in VB the very first time I do it everything is fine. Any subsequent attempts result in VB not starting, and not being able to Kill or even get Task Manager to come to the front... My only option is to log off and start again.
I've got VS sp5 installed. And W2k Srv sp3
Any ideas what I may be doing wrong??
|
|
|
|
|
Compile your code, into vbApp.exe. Run VBApp and attach bugger to it.
Don't use vb.exe!
|
|
|
|
|
thanks this works..
But my other technique works on my other computer. (Attaching to VB, and tripping when invoking my component)
How would I be able to find what has changed?
|
|
|
|
|
Found the problem.
The machine debug manager for Visual Studio 7 was started on the machine.
I disabled the service, and everything is back to normal
|
|
|
|
|
I want to write application that get mail from POP3 server with socket.I stablish a connection to POP3 server and send username to it with POP3 command(USER XXXXXX) like this:
m_socket.Connect(serverstr,110);
char buffer[256];
UINT uiport;
CString username;
m_usernameEdit.GetWindowText(username);
username = "USER " + username +"\t\n";
m_socket.Send(username.GetBuffer(),username.GetLength());
First I want to know if this is correct way and my second question is how can I get the status from POP3 (+OK) so I can find out I've done the proccess correctly?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Check out the many examples here at cp.com about pop3, you'll definately find your answer there
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
OK,Thanks.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|