|
|
I have an MFC MDI program using VC6. When the application starts I want the initial child window to be maximized within the frame. I've tried ModifyStyle(0,WS_MAXIMIZE); in the OnActivateView() and added cs.style |= WS_MAXIMIZE; to the beginning of PreCreateWindow(); Any other ideas?
|
|
|
|
|
I don't know if this is the correct way, but in the ActivateFrame Method I set the SW_SHOMAXIMIZED flag, this does the job just for the intial activation of the window.
<br />
void CChildFrame::ActivateFrame(int nCmdShow)<br />
{<br />
nCmdShow = SW_SHOWMAXIMIZED;<br />
CMDIChildWnd::ActivateFrame(nCmdShow);<br />
}<br />
If you have more than one window in your MDI, i have noticed it will unmaximize when you switch to a new window.. I tried to get around this by using a ModifyStyle(NULL,WS_MAXIMIZE)
<br />
void CChildFrame::OnSetFocus(CWnd* pOldWnd) <br />
{<br />
CMDIChildWnd::OnSetFocus(pOldWnd);<br />
<br />
ModifyStyle(NULL,WS_MAXIMIZE);<br />
}<br />
As I said, I don't know if this is the correct way to do it.. Its just what I figured out while I was playing.. Please let me know if you find a better way.
-Rick
|
|
|
|
|
Thank you for your help. ActivateFrame() alone works in my program without the problem you described. My view is derived from CHtmlView, which is derived from CFormView. I created two instances of the same view during runtime (that is, I selected File | New), switched between them (Window | <view number="">) and both windows stayed maximized.
|
|
|
|
|
CChildFrame::ActivateFrame() is a recomended way to do this. I don't know if your code in CChildFrame::OnSetFocus() will do anything usefull however.
With MDI only one window is ever maximized at a time. When you switch to another window, the current window is restored to its normal size and then the new window is maximized. This is all a pain in the backside as far as I'm concerned and I assume it has something to do with the early Win 3.x MDI implementation.
One of the problems with this is that you can see the windows flash to restored and then maximized size as you change MDI windows and open and close windows. This flashing varies across different windows versions.
In my CChildFrame::ActivateFrame() in ED for Windows (see sig) I wrap the call to CMDIChildWnd::ActivateFrame() in pMDIClient->SetRedraw( FALSE/TRUE ) calls.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Hi, I'm a newbie to MFC.
I have an MDI with CFormView as my base class. I can't find the ActivateFrame() function.
Someone suggested I try this in CMyFormView::OnInitialUpdate()
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit(FALSE);
but this still doesn't work.
Any suggestions?
Cheers
|
|
|
|
|
Kash wrote:
ActivateFrame() is a member of CMDIChildWnd. The Help will tell you this. To access it you need to derive a class from CMDIChildWnd. This is usually named CChildFrame.
Then you can use CChildFrame::ActivateFrame()
If you want to get at the MDI Client Window inside this then use: CWnd* pMDIClient = GetParent();
Make sure you call CMDIChildWnd::ActivateFrame() from within your CChildFrame::ActivateFrame().
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
I've used it in PreCreateWindow in the ChildFrm and it works great. cs.style |= WS_MAXIMIZE. I placed it after the CMDIChildWnd::PreCreateWindow( cs ); Perhaps something else is confusing it.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
I didn't put it in that class, and that's why it probably did not work. Thanks for your suggestion.
|
|
|
|
|
|
Checkout the docs on WM_PAINT . (sorry, i'm just too tired to try and explain this any better tonight. If the docs don't help, do a search here - there are several examples i think).
---
Shog9
Actually I use to find learning in bars when drinking really useful.
It sort of makes a language liquid. - Colin Davies, Thinking in English?
|
|
|
|
|
I have dialog based app, and I need to remove the horisontal scroll bar. How can I prevent horisontal bar creation in the ListCtrl?
Pavel Sokolov,
CEZEO software,
LanTalk Network,
http://www.cezeo.com
http://www.lantalk.net
|
|
|
|
|
Hello,
I would like to create an icon resource in order for me to create the icon at run time. Do you have any idea how to prepare the raw data for CreateIconFromResourceEx? The following is the example for what I'm talking about. This is an example from WTL Docking windows by Sergey Klimov (kidd@ukr.net)
static BYTE pinnedIconData[]={
0x28, 0000, 0000, 0000, 0x0b, 0000, 0000, 0000,
0x16, 0000, 0000, 0000, 0x01, 0000, 0x04, 0000,
0000, 0000, 0000, 0000, 0x84, 0000, 0000, 0000,
0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
0x10, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
0000, 0000, 0000, 0000, 0000, 0000, 0x80, 0000,
0000, 0x80, 0000, 0000, 0000, 0x80, 0x80, 0000,
0x80, 0000, 0000, 0000, 0x80, 0000, 0x80, 0000,
0x80, 0x80, 0000, 0000, 0x80, 0x80, 0x80, 0000,
0xc0, 0xc0, 0xc0, 0000, 0000, 0000, 0xff, 0000,
0000, 0xff, 0000, 0000, 0000, 0xff, 0xff, 0000,
0xff, 0000, 0000, 0000, 0xff, 0000, 0xff, 0000,
0xff, 0xff, 0000, 0000, 0xff, 0xff, 0xff, 0000,
0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
0000, 0x07, 0x70, 0000, 0000, 0000, 0000, 0000,
0000, 0x77, 0x77, 0000, 0000, 0000, 0000, 0000,
0000, 0x7f, 0x80, 0000, 0000, 0000, 0000, 0000,
0000, 0xf0, 0x07, 0x77, 0000, 0000, 0000, 0000,
0000, 0x0f, 0000, 0xf7, 0x70, 0000, 0000, 0000,
0000, 0000, 0x0f, 0x0f, 0x70, 0000, 0000, 0000,
0000, 0000, 0000, 0xf0, 0x70, 0000, 0000, 0000,
0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
0x7f, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff,
0x80, 0xff, 0xff, 0xff, 0x80, 0x7f, 0xff, 0xff,
0x80, 0x7f, 0xff, 0xff, 0x90, 0x3f, 0xff, 0xff,
0xa4, 0x3f, 0xff, 0xff, 0xd2, 0x3f, 0xff, 0xff,
0xe5, 0x3f, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff};
HICON icons = CreateIconFromResourceEx(unpinnedIconData, 0xec, TRUE, 0x00030000, 11, 11, LR_DEFAULTCOLOR);
|
|
|
|
|
Why not just CreateIcon ? As its name implies, CreateIconFromResource is to create a HICON from a resource.
|
|
|
|
|
I have a list control with checkboxes extended style. The check boxes still shows up if the value is NULL or "". I want to gray them out when there is no corresponding text in the item. I read that SetCheck is used for CButton. I cant imagine what is meant by a checked button! What would be even better would be if the blank checkboxes vanished altogether. Any ideas on how I can go about my goals ?
(One obvious idea is to filter out the NULLs and spaces, but its not at clear to me about how to work it around my code so I'm not going that route).
Thanks,
ns
|
|
|
|
|
I think you're going to have to manage the checkboxs as images yourself. The standard control is only for checked or unchecked, but always shown. You should probably create your own ImageList and set the image property for each item separately.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
I'm new to MFC and I was wondering if anyone knows a way to convert a STL string to an MFC CString.
Any help would be much appreciated.
|
|
|
|
|
|
That worked great, thanks much Mike.
- Monrobot13
|
|
|
|
|
My Question is that how we can get all the key strokes are pressed in the current windows(98) session while the other applications are running.
amir rao
|
|
|
|
|
I believe you have to use a keyboard hook to do this. Look up SetWindowsHookEx() with the WH_KEYBOARD type hook.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
I'm coming from a strong *nix background and I'm writing a packet sniffer for Windows. I'm having trouble when I try to access WIndows Devices. I'm looking for documentation on how to maniuplate my ethernet card devices. I've gone through the MSDN documentation as much as possible and so far all I've found is that I should probably use DeviceIOControl to maniupulate devices.
Can someone post a link to a good page that explains manipulating Windows Devices. So far I've been unable to find one that is good.
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
I looked into this over a year ago but my memory is not fresh. This may not be what you want but I found out from an article on the web that you could do this rather easily in Win2K using Winsock 2.0. I also D/L'd a control that was Winsock 2.0 compatable, had some problems with it, but they supposedly fixed the problems so that I could sniff with it. Unfortuntately, I ran out of time to complete this project but if you need any more info on the control etc. let me know, I can look it up.
Oh yeah, I found a pretty good shareware sniffer at www.ufasoft.com. It appears to work for all versions of Windows, is cheap, $39.00, though it only monitors or records data with filters. It is not programamble via script or anything but fine for what I needed it for.
HTHs
|
|
|
|
|
I think I found the web article that you were talking about. Without knowing it I had already set the ethernet card to promisc mode. I though the SIO_RCVALL just set you to receive all packets destine for your computer. I am currently testing my sniffer on a switched network so I don't get a lot of chances to capture other pepoles packets. Thanks for the reply
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
Use WinPcap Library for Packet Sniffing.
I have used it in my final year project...
http://winpcap.polito.it
M e e R
|
|
|
|
|