|
Did you try ModifyStyle() or modify the window styles before its creation (in OnCreate() or else)?
I modified dialog in this way, it should work for other windows.
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
I tried that, but perhaps I just used modifyStyle incorrectly.
Can you please send me a code snippet of how you did it?
Thanks,
-----------------
Genaro
|
|
|
|
|
try
UNIT uRemove=WS_MAXIMIZEBOX|WS_MINIMIZEBOX;
//call
pYourWnd->ModifyStyle(uRemove,0);
//or call
pYourWnd->ModifyStyle(uRemove,0,SWP_NOSIZE|SWP_NOMOVE);
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
I have a dialog box with some buttons, etc, and I wanted to make the dialog box full screen, and I was able to do that without any problems(using the code below). But I noticed that when it's full screen, that basically my dialog box has been shifted to the top left corner, with rest of the screen filled in gray to create the "full screen" effect. What I really want is my dialog to be in the center, with gray filled in around it to create the "full screen" effect. Is there any possible way to do this? Thank you!
This is where my controls show up in full screen
-----------
xxx
-----------
I would like to have my controls show up in the middle of the full screen
-----------
----xxxx---
-----------
Code I have to make it full screen:
int cx, cy;
HDC dc = ::GetDC(NULL);
cx = GetDeviceCaps(dc,HORZRES) +
GetSystemMetrics(SM_CXBORDER);
cy = GetDeviceCaps(dc,VERTRES) +
GetSystemMetrics(SM_CYBORDER);
::ReleaseDC(0,dc);
// Remove caption and border
SetWindowLong(m_hWnd, GWL_STYLE,
GetWindowLong(m_hWnd, GWL_STYLE) &
(~(WS_CAPTION | WS_BORDER)));
// Put window on top and expand it to fill screen
::SetWindowPos(m_hWnd, HWND_NOTOPMOST,
-(GetSystemMetrics(SM_CXBORDER)+1),
-(GetSystemMetrics(SM_CYBORDER)+1),
cx+1,cy+1, SWP_NOZORDER);
-- modified at 17:52 Thursday 26th January, 2006
|
|
|
|
|
You would have to move all the child controls. You could do it something like this:
struct OffsetInfo
{
OffsetInfo(HWND hWnd, int OffsetX, int OffsetY):
m_hDialog(hDialog), m_OffsetX(OffsetX), m_OffsetY(OffsetY)
{}
HWND m_hDialog;
int m_OffsetX;
int m_OffsetY;
};
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
{
OffsetInfo* pInfo = reinterpret_cast<OffsetInfo*>(lParam);
RECT rc;
GetWindowRect(hwnd, &rc);
POINT pt = {rc.left, rc.top};
ScreenToClient(pInfo->m_hDialog, &pt);
pt.x += pInfo->m_OffsetX;
pt.y += pInfo->m_OffsetY;
SetWindowPos(hwnd, NULL, pt.x, pt.y, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
return TRUE;
}
void CYourDialog::DoIt()
{
CRect rcBefore;
GetClientRect(&rcBefore);
CRect rcAfter;
GetClientRect(&rcAfter);
OffsetInfo oi(m_hWnd, (rcAfter.Width()-rcBefore.Width())/2, (rcAfter.Height()-rcBefore.Height())/2);
EnumChildWindows(m_hWnd, &EnumChildProc, reinterpret_cast<LPARAM>(&oi));
}
Note: I haven't tested this code but I believe that the concept is sound.
Steve
|
|
|
|
|
Steve,
Tried your solution, and works well!
Thank you very much!!
|
|
|
|
|
Hi all,
How can I manage the IP header of a TCP/IP Socket?
I know this is done using RAW sockets, I want some source code for TCP not UDP.
I have seen an example on the net but it did not work!
2nd Question: if I change my IP in the IP header and request some data via HTTP, would the data be sent to me or would it be sent to the new IP in the header??????????
Thank you all
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
|
I can answer your second question:
It will be sent to the IP that is set as source-IP in the outgoing header.
If your "real" IP was 10.127.3.54 and you change the header to read "Source-IP = 10.127.3.53", the answer to that packet will go to 10.127.3.53.
If there is an answer, that is. The target will simply drop most packets.
Oh, and if you are after messing the target up on purpose, you will (in most European, Asian and American countries) violate at least one law. Depending on where you are doing this from, you might get more than you expected in terms of response and jailtime.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Thank you man,
Really I am not in Euorpe nor in America... Regardless, I am here to learn some aspects of network programming
Thank you
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
I am new to VC++ programming so I am sure this question will be very simple for a lot of you. I am trying to reposition a button every time the user resizes the dialog.
What is the best way to accomplish this?
Thanks!
|
|
|
|
|
masnu wrote:
What is the best way to accomplish this?
By reading the "Extras" section of this article.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
|
Use MoveWindow API.
Manish Rastogi
|
|
|
|
|
|
|
|
In MDI project. I want my child frame fill main frame window. So I inplement this in
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
CWnd* pwnd = AfxGetMainWnd();
CRect rect;
pwnd->GetClientRect( &rect );
cs.cx = rect.Width(); cs.cy = rect.Height();
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
It's very close to success. But look closely, you will find a bit off. main frame overlapped child frame a little bit. I think that is because of edge of main frame window. But I am getting client area, it should not include edge right? any one can explain?
|
|
|
|
|
I create a 1 column, 2 row splitter window. use CreateStatic, because I want too different view in each panes. But I also want dynamically delete a pane, how to do this?
Thank u.
|
|
|
|
|
LeeeNN wrote: But I also want dynamically delete a pane, how to do this?
Use CSplitterWnd::DeleteView() for this.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Hey,
I have form derived from CFormView. On the form I placed a tabcontrol. Now I want to paint a line on the tabcontrol (in my CFormView::OnPaint) and not in the tabcontrol (derived) class!
My problem is that the tab overwrites my graphic... Is there any solution?
|
|
|
|
|
Anyone using good alternatives to WinHTTP and SoapToolkit?
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
install a service on a host OS such as Win2K or XP? I mean the binary executable file. Should it go into the System32 directory? I see that under System32 there is a Drivers sub-dir but nothing for services.
I realize that I can deliver the service with my runtime deliverables and place it into my runtime directory but prefer not to since I may want to leave the service even though my program has been uninstalled or deleted accidentally.
Clarification: I have a program that I will be installing in addition to the service (a RFC-868 Time Server) I will be installing. When my program is uninstalled or the directory is accidentally deleted, I still want my service to run and am looking for the (Windows) conventional directory location that it should be stored in.
-- modified at 11:19 Thursday 26th January, 2006
|
|
|
|
|
Just going down through the list of services on my XP machine, I see that a lot of them reside in the System32 folder.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Hi I need to determine, if possible using VC++, the size and date information relating to the current logged in user's profile.
I can get who is logged in, their Domain and SID value, but struggling to find how to find out details as to if the user's profile is roaming, local etc and then the size/quota, date etc information.
Any help would be greatly appreciated, thanks in advance.
Phil
|
|
|
|