|
You can safely do a send and recv on the same socket at the same time, so no need to start inventing all manner of problems for yourself!
|
|
|
|
|
there is some very good information on your subject here on codeproject:
http://www.codeproject.com/internet/
also, take a look at the "reusable, high performance, socket server class"...
nb
|
|
|
|
|
wow thanks! being able to call it at the same time makes it easier hehe. I already looked on CP though and also at that reusable class but that uses IOCP and i am targetting a win98 machine so that wouldnt work..
Kuniva
--------------------------------------------
|
|
|
|
|
You can use select() and specify maxtime your recv() will be waiting.
When time expires recv() will return even if no data arrived.
So, you can create arriving loop and inside of it you will be able to send().
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Oh thanks, i was just wondering about something like that since i wanted to put in something to check for keystrokes. Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
as on directX to do that some scene was always over the whole on screen?
|
|
|
|
|
If you want to switch to full screen mode, in d3d use the Windowed parameter in PresentParameters. In directdraw have a look at the SetCooperativeLevel() function.
Lorenz Prem
Microsoft Corporation
|
|
|
|
|
I'm looking for an example in VC++ 6 to hook (or subclassing) the RAS function (in rasapi32.dll). I'd like that my routine prevent every connection to the internet (with the browser or other applications): my routine must do a control about the number used. HOW CAN I DO THIS ?
Can anyone help me ?
|
|
|
|
|
Use RasEnumConnections() to get a list of connections.
RasGetConnectStatus will tell you if that connections is active.
RasHangUp will kill the connections.
I used CWnd::SetTimer() to monitor for connections.
This will not prevent a DSL/Modem or network connection from accessing the internet.
|
|
|
|
|
Really thanks for your help.
I'll try your solution.
Thanks again.
|
|
|
|
|
Hello,
how can I add a sizing gripper to a MFC dialog? (The dialog doesn't have any scrollbars or statusbars).
The dialog supports resizing, it's just the missing resizing gripper.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
haven't tried it out.. but (as much as i know.. from the back of my head)
using the WS_THICKFRAME style should do the trick..
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
My dialog has the WS_THICKFRAME style and it is resizable, but it doesn't have a sizing gripper.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Here is some code I use. It is part of a class, but should give you what you need.
bool
CWin_Resize::TrackCreateSize( bool want_sizebmp )
{
CRect rc;
ASSERT( IsValid() );
m_pWnd->GetWindowRect( &rc );
m_minWidth = rc.Width();
m_minHeight = rc.Height();
m_pWnd->GetClientRect( &rc );
m_old_cx = rc.Width();
m_old_cy = rc.Height();
m_bIs_Resizeable = ( m_pWnd->GetStyle() & WS_THICKFRAME ) ne 0;
if( want_sizebmp
&& m_bIs_Resizeable
)
{
if( !m_bmSizeBitmap.LoadOEMBitmap( OBM_SIZE ) )
TRACE0(_T("*** ERROR: CWin_Resize::OnInitDialog(): LoadOEMBitmap() failed.\n"));
else
{
BITMAP BitMap;
m_pWnd->GetClientRect( &rc );
m_bmSizeBitmap.GetBitmap( &BitMap );
CRect szrc( rc.Width() - BitMap.bmWidth, rc.Height() - BitMap.bmHeight, rc.Width(), rc.Height() );
if( !m_wndSizeBitmap.Create( NULL, WS_VISIBLE | WS_CHILD | SS_BITMAP, szrc, m_pWnd )
|| !m_wndSizeBitmap.ModifyStyleEx( 0, WS_EX_TRANSPARENT )
)
TRACE0( _T( "*** ERROR CWin_Resize::OnInitDialog() : Can't create bitmap control\n" ) );
else
{
m_wndSizeBitmap.SetBitmap( m_bmSizeBitmap );
Ctrl_SetAnchorInfo( m_wndSizeBitmap.m_hWnd, ANCHOR_RIGHT | ANCHOR_BOTTOM );
}
}
}
RestoreSize();
return TRUE;
}
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
What is Ctrl_SetAnchorInfo ?
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Dominik Reichl wrote:
What is Ctrl_SetAnchorInfo?
Is is part of my resizeable dialog class code.
m_wndSizeBitmap is a CStatic and this adds it to the list of controls that need to be moved when a dialog is resized. You've got your own resizing code I think you said, so just handle the CStatic in that.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Ok, so this is only a bitmap.
But when I move the mouse cursor on the resizing bitmap, it doesn't change to the resizing cursor... resizing only works when I point on a side or corner of the window...
I would like to make the resizing bitmap work like a gripper, so with real resizing cursor, as Internet Explorer does it.
Any idea or did I overlook something?
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Dominik Reichl wrote:
Ok, so this is only a bitmap.
But when I move the mouse cursor on the resizing bitmap, it doesn't change to the resizing cursor... resizing only works when I point on a side or corner of the window...
I would like to make the resizing bitmap work like a gripper, so with real resizing cursor, as Internet Explorer does it.
Any idea or did I overlook something?
I haven't bothered with that. The bmp us just a visual clue that the dialog is resizeable. They then drag the edges as per normal. I think that's enough.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
I haven't bothered with that. The bmp us just a visual clue that the dialog is resizeable. They then drag the edges as per normal. I think that's enough.
Create a new scrollbar class (I called it "CInvisibleGripper" ) derived from CScrollBar which overrides the OnPaint method (which simply doesn't draw itself). So you have a hidden scrollbar class. Create a sizebox/gripper as the others have posted below, and you have a working gripper
I've done it that way.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
By "sizing gripper" do you mean the triangular bitmap found at the lower right corner of an IE window? If so, just create a status bar in your dialog and position it at the bottom edge. You'll need to resize and reposition the status bar in your OnSize() handler. I don't believe the autosize option works for dialogs.
See this page[^] for an example screenshot of a sizing grip in a dialog based app.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
And if I don't want to have a status bar?
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Dominik Reichl wrote:
And if I don't want to have a status bar?
Try this:
Declare in MyDialog.h:
CScrollBar m_Grip;
in CMyDialog::OnInitDialog:
CRect rect;
GetClientRect(rect);
rect.left = rect.right - 10;
rect.top = rect.bottom - 10;
m_Grip.Create(WS_CHILD | SBS_SIZEBOX | SBS_SIZEBOXBOTTOMRIGHTALIGN |
SBS_SIZEGRIP | WS_VISIBLE, rect, this, AFX_IDW_SIZE_BOX);
in CMyDialog::OnSize:
CWnd *pGripper = GetDlgItem(AFX_IDW_SIZE_BOX);
if (pGripper)
{
CRect rectGripper, rectClient;
pGripper->GetWindowRect(&rectGripper);
GetClientRect(rectClient);
rectClient.left = rectClient.right - rectGripper.Width();
rectClient.top = rectClient.bottom - rectGripper.Height();
pGripper->MoveWindow(&rectClient);
}
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
Ahh, wonderful! Just one more question: is the size of a gripper always 10? Independent of how big statusbars and scrollbars are?
Thanks!!!
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Dominik Reichl wrote:
is the size of a gripper always 10?
No. Windows will size the gripper to whatever the system default is. You can actually replace 10 with anything (or just remove it), and it would probably work ok.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
Dominik Reichl wrote:
And if I don't want to have a status bar?
I assume you mean you don't want the status bar to look like a status bar (and not that you're averse to using a CStatusBar object).
You can restrict the width of the status bar to that of the sizer grip, so that it doesn't interfere with controls in your dialog, as in the standard Win2K "File Open" dialog for an example.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|