|
Hi,
yes you can!
I did it this way (it's a server, but it should help you):
.
.
.
SOCKET datasocket;
SOCKET listensocket;
listensocket = ::socket(AF_INET, SOCK_STREAM, 0);
if(listensocket == INVALID_SOCKET) throw runtime_error("server socket failed");
// importent port for non-blocking
unsigned long blockmode = 1; // see ioctlsocket call
if((ioctlsocket(listensocket, FIONBIO, &blockmode) == SOCKET_ERROR))
throw runtime_error("server set socket to non-blocking failed");
struct sockaddr_in local, from;
local.sin_family = AF_INET;
local.sin_addr.s_addr = INADDR_ANY;
local.sin_port = htons(clientConnectionOptions.port);
int rc;
rc = ::bind(listensocket,(struct sockaddr*)&local,sizeof(local));
if(rc != 0) throw runtime_error("server bind failed");
rc = ::listen(listensocket,2);
if(rc != 0) throw runtime_error("server listen failed");
while(!endServer)
{
int fromlen = sizeof(from);
datasocket = ::accept(listensocket, (struct sockaddr*)&from, &fromlen);
if(datasocket == SOCKET_ERROR)
{
if(WSAGetLastError() != WSAEWOULDBLOCK)
{
throw runtime_error("accept in service module failed");
}
Sleep(100);
continue;
}
if (datasocket == INVALID_SOCKET) break;// throw runtime_error("accept failed");
//datasocket is open and ready to send/recv data
.
.
.
|
|
|
|
|
Hi,
i am using thread for make httprequest for some urls timeout is occured and throwing CInternetException on that case thread is exit with 0. how to solve the problem. any one help to me. thanks in advance.
Have A Nice Day!
Murali.M
|
|
|
|
|
|
hello all,
i have "accidently" "misplaced" my license key for visual assist .net v7.1
can anyone help me?
|
|
|
|
|
Try sending these folks a message support@wholetomato.com or support@wholetomato.com. I'm sure they'll be able to help you
Regards,
|
|
|
|
|
my friend, i meant i "ACCIDENTLY" (*wink wink*) lost my license key.
can i call you joey?
|
|
|
|
|
i'll be frank,
the original post wants to know the license key number to enable visual assist.
|
|
|
|
|
try to search at astalavista.box.sk
|
|
|
|
|
I suggest you *wink wink* cough up US$79 - a laughably small price for a great productivity improvement.
Don't you yourself earn your income (or plan to) from the fact that others pay for your efforts?
Bernd
|
|
|
|
|
Here is my problem:
In order to use GetOpenFileName I use a OPENFILENAME structure which has a member variable called lStructSize.
In MSDN I am advised to use sizeof(OPENFILENAME) to initialize this one IF WINDOWS IS WIN2000 OR LATER!!!
otherwise I should use OPENFILENAME_SIZE_VERSION_400.
All is fine. I determine which type of Windows is my app running and use different initializations but this
OPENFILENAME_SIZE_VERSION_400 seems undefined! What can I do?!
TNX!
|
|
|
|
|
OPENFILENAME_SIZE_VERSION_400 is defined in <commdlg.h>
Call GetVersion[Ex] to determine which version of Windows your application is running on then set the lStructSize field of the OPENFILENAME accordingly.
Regards,
|
|
|
|
|
It doesn't work!
My commdlg.h header file supplied with VC++6 does *not* include this definition at all. In fact no .h file from my distribution doesn't contain it. In a moment of desperation I searched brute-force-style ALL files on the hard drive for this string. None. Except cache files of Opera (web browser and text files that I wrote).
Let's say I might (??!) have an incomplete distribution of this Visual Studio. What if I would nicely ask you if you could tell me the number value of this constant?
It's probably unnecessary to tell you how to do that.
Thank you.
PS: Could it be the fact that I don't really like C ?!? Maybe it has a mind of its own and senses my hate?
|
|
|
|
|
had the same problem.
#if (_WIN32_WINNT >= 0x0500) && !defined(OPENFILENAME_SIZE_VERSION_400)<br />
#ifndef CDSIZEOF_STRUCT<br />
#define CDSIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member))<br />
#endif<br />
#define OPENFILENAME_SIZE_VERSION_400A CDSIZEOF_STRUCT(OPENFILENAMEA,lpTemplateName)<br />
#define OPENFILENAME_SIZE_VERSION_400W CDSIZEOF_STRUCT(OPENFILENAMEW,lpTemplateName)<br />
#ifdef UNICODE<br />
#define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400W<br />
#else<br />
#define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400A<br />
#endif // !UNICODE<br />
#endif // (_WIN32_WINNT >= 0x0500) && !defined(OPENFILENAME_SIZE_VERSION_400)
found it on http://codeworks.gnomedia.com/wtl/wtldocs/atldlgs_8h-source.html
hope it will help.
greetz
tib
----------------------------------------------------------
I once had a nightmare in binary --- I think there was a 2
|
|
|
|
|
I am thinking about purchasing Visual Studio.Net and would like to know if there is a cheaper version of VS.Net since I can't afford an $899 product. I am a student though, I just want to transfer to new technologies... Is there a cheaper way of getting visual studio.net?
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
|
I know how to implement different UI controls but how can I owner draw them, I never thought about how useful they could be, though they are visually appealing in some cases, can anyone would recommend some article about how to make owner drawn controls, maybe websites...
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
|
How can I debug a vbscript macro in Visual Studio 6. How can I set the Macro tab of the Output window?
Thanks
|
|
|
|
|
Try posting it in the VB part of the message forums, since this part deals with visual c++.
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
Hi,
1. I have put a TabControl inside a formview in the MFC-SDI application. If I resize the window I want the tab control to always fit in the window (that means if I make the window bigger the control inside will become bigger and if I make the window smaller I want the control to get smaller). Please advise how I can do that?
2. How can I make a SDI application non-resizable?
Thanks,
|
|
|
|
|
Add a WM_SIZE handler in your view class. In it, do the following:
CRect rectView;
GetClientRect (&rectView);
m_tabCtrl.MoveWindow (&rectView);
This will cause the tab control to fill the view's client area.
/ravi
My new year resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I used following code Onsize
but I'm getting asserting error at line 279 of winocc.cpp
CFormView::OnSize(nType, cx, cy);
CRect rectView;
GetClientRect (&rectView);
m_TabCtrl.MoveWindow (&rectView);
|
|
|
|
|
Perhaps you haven't linked m_tabCtrl to the tab control in the dialog template? Put this line before the call to MoveWindow() :
ASSERT (m_tabCtrl.GetSafeHwnd() != NULL);
to ensure that m_tabCtrl has been properly created before you try to resize it.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
It worked. Thanks.... I have another similar question
I have two tree controls attached to the tabs in the tab control. To fit the tree control in the tab control what should I do? 'cause I can't write the wm_size handler for the tabcontrol as I'm adding the tree controls in the formview, not in the tabcontrol class.
|
|
|
|
|
I think you might be confusing a CTabCtrl with a CPropertySheet . A CTabCtrl doesn't "contain" child dialogs or controls - all it does is allow the user to select a tab. A tab control's parent receives notifications when the current tab selection changes.
That being said, what you probably want to do (to mimic the behavior of a CPropertySheet ) is to create a bunch of child controls/dialogs (whose common parent is your view), one of which is displayed in response to the change in the currently selected tab. You'll also need to check the "Transparent" attribute of the tab control so that it doesn't hide the child controls/dialogs. The appropriate control/dialog is displayed in response to a change in the currently selected tab in the following manner:
CWnd* pDisplayedWnd = NULL;
m_treeCtrl_1.ShowWindow (SW_HIDE);
m_treeCtrl_2.ShowWindow (SW_HIDE);
int nCurTab = m_tabCtrl.GetCurSel();
switch (nCurTab) {
case 0:
pDisplayedWnd = &m_treeCtrl_1;
break;
case 1:
pDisplayedWnd = &m_treeCtrl_2;
break;
default:
ASSERT (FALSE);
break;
}
ASSERT (pDisplayedWnd != NULL);
pDisplayedWnd->BringWindowToTop();
pDisplayedWnd->ShowWindow (SW_SHOW);
pDisplayedWnd->Invalidate();
pDisplayedWnd->UpdateWindow();
pDisplayedWnd->BringWindowToTop();
pDisplayedWnd->SetFocus();
If this is too much work, you might want to consider using a CPropertySheet . See the examples at CP if you need help.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|