• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ AfxSocketInit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中AfxSocketInit函数的典型用法代码示例。如果您正苦于以下问题:C++ AfxSocketInit函数的具体用法?C++ AfxSocketInit怎么用?C++ AfxSocketInit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了AfxSocketInit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: sizeof

BOOL CRadioAndCheckBoxesApp::InitInstance()
{
	// InitCommonControlsEx() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// Set this to include all the common control classes you want to use
	// in your application.
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}


	AfxEnableControlContainer();

	// Create the shell manager, in case the dialog contains
	// any shell tree view or shell list view controls.
	CShellManager *pShellManager = new CShellManager;

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	// of your final executable, you should remove from the following
	// the specific initialization routines you do not need
	// Change the registry key under which our settings are stored
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	CRadioAndCheckBoxesDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	// Delete the shell manager created above.
	if (pShellManager != NULL)
	{
		delete pShellManager;
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
开发者ID:inf-eth,项目名称:i02-0491-courses,代码行数:60,代码来源:RadioAndCheckBoxes.cpp


示例2: CreateListener

	BOOL TLServer_IP::CreateListener()
		{
		 if (!AfxSocketInit())
		 {
			 CString * s = new CString("IDP_SOCKETS_INIT_FAILED");
			PostMessage(UWM_INFO, (WPARAM)s, ::GetCurrentThreadId());
			 return FALSE;
		 }
		 // Create the listener socket
		 UINT portnum = PORT;
		 if(!m_listensoc.Create(portnum))
			{ /* failed to create */
			 DWORD err = ::GetLastError();
			 CString fmt;
			 fmt.LoadString(IDS_LISTEN_CREATE_FAILED);
			 CString * s = new CString;
			 s->Format(fmt, portnum);
			 PostMessage(UWM_INFO, (WPARAM)s, ::GetCurrentThreadId());
			 PostMessage(UWM_NETWORK_ERROR, (WPARAM)err, ::GetCurrentThreadId());
			 return FALSE;
			} /* failed to create */

		 { /* success */
		  CString fmt;
		  fmt.LoadString(IDS_LISTENER_CREATED);
		  CString * s = new CString;
		  s->Format(fmt, portnum);
		  PostMessage(UWM_INFO, (WPARAM)s,::GetCurrentThreadId());
		 } /* success */

		 m_listensoc.SetTarget(this);

		 m_listensoc.Listen();
		 return TRUE;
		} // TLServer_IP::CreateListener
开发者ID:Decatf,项目名称:tradelink,代码行数:35,代码来源:TLServer_IP.cpp


示例3: InitInstance

BOOL CNetDiskToolApp::InitInstance()
{
	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	SetUnhandledExceptionFilter(My_UnhandledExceptionFilter);

	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization.
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CNetDiskToolDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CNetDiskToolView));
	AddDocTemplate(pDocTemplate);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);


	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;
	

	// The one and only window has been initialized, so show and update it.
	m_pMainWnd->ShowWindow(SW_SHOW);
	m_pMainWnd->UpdateWindow();

// 	GetDocumnet()->GetDataType();
	

	return TRUE;
}
开发者ID:MatthewChan,项目名称:Softlumos,代码行数:60,代码来源:NetDiskTool.cpp


示例4: InitInstance

BOOL CKeyBoardWinCEApp::InitInstance()
{

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	CKeyBoardWinCEDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: 在此处放置处理何时用“确定”来关闭
		//  对话框的代码
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}
开发者ID:SherlockLee,项目名称:KeyBoardWinCE,代码行数:33,代码来源:KeyBoardWinCE.cpp


示例5: sizeof

BOOL CVPingApp::InitInstance()
{
	// InitCommonControlsEx() требуется для Windows XP, если манифест
	// приложения использует ComCtl32.dll версии 6 или более поздней версии для включения
	// стилей отображения. В противном случае будет возникать сбой при создании любого окна.
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// Выберите этот параметр для включения всех общих классов управления, которые необходимо использовать
	// в вашем приложении.
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}


	AfxEnableControlContainer();

	// Создать диспетчер оболочки, в случае, если диалоговое окно содержит
	// представление дерева оболочки или какие-либо его элементы управления.
	CShellManager *pShellManager = new CShellManager;

	// Стандартная инициализация
	// Если эти возможности не используются и необходимо уменьшить размер
	// конечного исполняемого файла, необходимо удалить из следующих
	// конкретных процедур инициализации, которые не требуются
	// Измените раздел реестра, в котором хранятся параметры
	// TODO: следует изменить эту строку на что-нибудь подходящее,
	// например на название организации
	SetRegistryKey(_T("Локальные приложения, созданные с помощью мастера приложений"));

	CVPingDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Введите код для обработки закрытия диалогового окна
		//  с помощью кнопки "ОК"
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Введите код для обработки закрытия диалогового окна
		//  с помощью кнопки "Отмена"
	}

	// Удалить диспетчер оболочки, созданный выше.
	if (pShellManager != NULL)
	{
		delete pShellManager;
	}

	// Поскольку диалоговое окно закрыто, возвратите значение FALSE, чтобы можно было выйти из
	//  приложения вместо запуска генератора сообщений приложения.
	return FALSE;
}
开发者ID:KroTozeR,项目名称:CompNet_Lab3,代码行数:60,代码来源:VPing.cpp


示例6: InitInstance

BOOL CFilePosterApp::InitInstance()
{
	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	// Standard initialization

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	CFilePosterDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
	}
	else if (nResponse == IDCANCEL)
	{
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
开发者ID:BrianAberle,项目名称:XMLFoundation,代码行数:32,代码来源:FilePoster.cpp


示例7: InitInstance

BOOL CNetworksApp::InitInstance()
{
	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	/////////////Êý¾Ý¿â
   	if( (_access( "./user.db", 0 )) == -1 )
	{
		char * pErrMsg = 0;  
		int ret = 0;  
		sqlite3 * db = 0;  
		ret = sqlite3_open("./user.db", &db);  
		if ( ret != SQLITE_OK )  
		{  
		AfxMessageBox(sqlite3_errmsg(db));  
		exit(1);  
		} 
		ret = sqlite3_exec(db, "BEGIN TRANSACTION;", NULL, NULL, NULL);  
		
		  sqlite3_exec(db, "CREATE TABLE login(username varchar(64), password varchar(64));", NULL, NULL, NULL);
		  ret = sqlite3_exec(db, "INSERT INTO login VALUES('18d86ccba6c49512154e5abfe51eaa06','d8c993d0e022c4849ac0c27db27ecf69'); \
		  INSERT INTO login VALUES('5efb93a618588266af575fb8a381d60f','ccf82797241106ef5cbb8c28f2edd63d')", NULL, NULL, &pErrMsg); 
		  ret = sqlite3_exec(db, "COMMIT TRANSACTION;", NULL, NULL, NULL);                     
		  sqlite3_close(db);  
		  db = 0; 
	}
开发者ID:jordanchuang,项目名称:geeknimo,代码行数:31,代码来源:networks.cpp


示例8: sizeof

BOOL CToolApp::InitInstance()
{
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}


	AfxEnableControlContainer();

	// 创建 shell 管理器,以防对话框包含
	// 任何 shell 树视图控件或 shell 列表视图控件。
	CShellManager *pShellManager = new CShellManager;

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	CToolDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: 在此放置处理何时用
		//  “确定”来关闭对话框的代码
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: 在此放置处理何时用
		//  “取消”来关闭对话框的代码
	}

	// 删除上面创建的 shell 管理器。
	if (pShellManager != NULL)
	{
		delete pShellManager;
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}
开发者ID:CN-Zxcv,项目名称:QService,代码行数:60,代码来源:Tool.cpp


示例9: CListenSocket

/*********************************************************
函数名称:OpenServer
功能描述:初始化服务器
作者:    余志荣
创建日期:2016-08-03
返 回 值:成功返回IDS_SERVER_OPEN_SUCCESS
*********************************************************/
int CSocketServerDlg::OpenServer(void)
{
	m_pSocketListen = new CListenSocket(this);

	if(!AfxSocketInit())
	{// 套接字初始化失败		
		OutputInfo(IDP_SOCKETS_INIT_FAILED); // 输出信息
		delete m_pSocketListen; // 清除Socket
		m_pSocketListen = NULL; // 指针置空
		return IDP_SOCKETS_INIT_FAILED;
	}

	if(m_pSocketListen->Create(8080) == NULL) 
	{// 绑定端口失败
		OutputInfo(IDP_SOCKETS_BIND_FAILED); // 输出信息
		delete m_pSocketListen; //清除Socket
		m_pSocketListen = NULL;
		return IDP_SOCKETS_BIND_FAILED;
	}
	
	m_pSocketListen->Listen(); //启动监听

	SetTimer(123, 10000, NULL); // 定时刷新Socket

	OutputInfo(IDS_SERVER_OPEN_SUCCESS); // 输出信息

	return IDS_SERVER_OPEN_SUCCESS;
}
开发者ID:yzr0512,项目名称:ChatServer,代码行数:35,代码来源:SocketServerDlg.cpp


示例10: InitCommonControls

BOOL CSyncNoteApp::InitInstance()
{
	// InitCommonControls() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	InitCommonControls();

	CWinApp::InitInstance();

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}
	AfxEnableControlContainer();
	// Standard initialization
	// If you are not using these features and wish to reduce the size
	// of your final executable, you should remove from the following
	// the specific initialization routines you do not need
	// Change the registry key under which our settings are stored
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));
	LoadStdProfileSettings(4);  // Load standard INI file options (including MRU)
	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views
	CMultiDocTemplate* pDocTemplate;
	pDocTemplate = new CMultiDocTemplate(IDR_SyncNoteTYPE,
		RUNTIME_CLASS(CSyncNoteDoc),
		RUNTIME_CLASS(CSyncNoteFrame), // custom MDI child frame
		RUNTIME_CLASS(CSyncNoteView));
	if (!pDocTemplate)
		return FALSE;
	AddDocTemplate(pDocTemplate);
	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
		return FALSE;
	m_pMainWnd = pMainFrame;
	// call DragAcceptFiles only if there's a suffix
	//  In an MDI app, this should occur immediately after setting m_pMainWnd
	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);
	// Dispatch commands specified on the command line.  Will return FALSE if
	// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;
	// The main window has been initialized, so show and update it
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();
	return TRUE;
}
开发者ID:surf148,项目名称:SyncNote,代码行数:60,代码来源:SyncNote.cpp


示例11: OutputDebugString

BOOL CClientThread::InitInstance()
{



	OutputDebugString(L"CClientThread::InitInstance()\n");


    if (!AfxSocketInit())
	{

		return FALSE;
	}



	m_socket.Create();
		
	// Try to connect to the peer
	OutputDebugString(L"Try to connect to the peer");
	if (m_socket.Connect(L"206.220.42.147", 25999) == 0)
	{
		if (GetLastError() != WSAEWOULDBLOCK)
		{
			//error in the connection process, terminate myself

			OutputDebugString(L"CClientThread::InitInstance() m_socket Failed");
			::PostQuitMessage(0);
		}
	}

     OutputDebugString(L"End CClientThread::InitInstance()");
	
	return TRUE;
}
开发者ID:davidedellai,项目名称:XFMobile,代码行数:35,代码来源:ClientT.cpp


示例12: InitInstance

BOOL CHTTPSpyApp::InitInstance()
{
	CHTTPSpyDlg dlg;

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

	Enable3dControls();			// Call this when using MFC in a shared DLL

	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();

	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:35,代码来源:HTTP+Spy.cpp


示例13: InitInstance

BOOL CMMCApp::InitInstance()
{
	CWinApp::InitInstance();

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	// 将所有 OLE 服务器(工厂)注册为运行。这将使
	//  OLE 库得以从其他应用程序创建对象。
	COleObjectFactory::RegisterAll();


	
	//LC_ConnectionOper(1);






	return TRUE;
}
开发者ID:sechacking,项目名称:r3pos,代码行数:25,代码来源:MMC.cpp


示例14: InitInstance

BOOL CAVSApp::InitInstance()
{
	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	#ifdef _AFXDLL
		Enable3dControls();			// Call this when using MFC in a shared DLL
	#else
		Enable3dControlsStatic();	// Call this when linking to MFC statically
	#endif

	/////////////////////////
	//
	/////////////////////////



   
	CAVSDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
	}
	else if (nResponse == IDCANCEL)
	{
	}
	return FALSE;
}
开发者ID:wvoice,项目名称:realtime,代码行数:34,代码来源:AVS.cpp


示例15: InitInstance

//--------------------------------------------------------------------------------
BOOL CTokenEditorApp::InitInstance()
	{
	if (!AfxSocketInit())
		{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
		}

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	CGenRandomTable tbl;

	CMainDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
	}
开发者ID:richschonthal,项目名称:Security-Server,代码行数:30,代码来源:TokenEditor.cpp


示例16: trmsocketinit

// init socket
int ctrmthreaddirecttcp::trmsocketinit()
{
	CString t_cs;
	// 初始化socket
	if( AfxSocketInit()==FALSE)
	{ 
		assert(0);
	}
	// 初始化 CSocket 对象, 因为客户端不需要绑定任何端口和地址, 所以用默认参数即可
	if(!m_modeip.Create())
	{
		t_cs.Format(_T("CSocket create faild: %d"),m_modeip.GetLastError());
		trmsendtrmdlgcstring(t_cs);
		return TRUE;
	}
	// 连接指定的地址和端口
	if(!m_modeip.Connect(m_pitemdata->host,m_pitemdata->port))
	{
		m_modeip.Close();
		t_cs=m_pitemdata->host+_T(" Connect FAIL!");
		trmsendtrmdlgcstring(t_cs);
		return TRUE;
	}
	return FALSE;
}
开发者ID:xaviet,项目名称:tew,代码行数:26,代码来源:trmthreaddirecttcp.cpp


示例17: InitInstance

//
// Override InitInstance to create main window.
//
BOOL CPokerApp::InitInstance()
{
  if (!AfxSocketInit())
  {
    AfxMessageBox(IDS_SOCKETINITFAILED);
    return FALSE;
  }
  
  CMainWnd* pMainWnd = new CMainWnd();
  m_pMainWnd = pMainWnd;

  BOOL rc = FALSE;

  if (pMainWnd)
  {
    rc = pMainWnd->Create(NULL, g_szWndClass);
  }
  else
  {
    rc = FALSE;
    AfxMessageBox(g_szNotEnoughMemory);
  }

  if (rc)
    rc = Global::Instance().initInstance();

  return rc;
}
开发者ID:angeldv95,项目名称:pokerspot,代码行数:31,代码来源:poker.cpp


示例18: ASSERT

// Starts listening on the specified port.
BOOL CNDKServer::StartListening(long lPort)
{
	// Don't call this method two times, call Stop before another
	// call to StartListening
	ASSERT(m_pListeningSocket == NULL); 

	BOOL bResult = FALSE;

	if ((m_pListeningSocket == NULL) && AfxSocketInit())
	{
		m_lPort = lPort;

		m_pListeningSocket = new CNDKServerSocket(this);

		if (m_pListeningSocket != NULL)
		{
			// Create the socket
			bResult = m_pListeningSocket->Create(m_lPort);

			// Start listening
			if (bResult)
				bResult = m_pListeningSocket->Listen();		
		}
	}

	// If an error occured destroy the socket
	if (!bResult && (m_pListeningSocket != NULL))
	{
		delete m_pListeningSocket;
		m_pListeningSocket = NULL;
	}

	return bResult;
}
开发者ID:saladyears,项目名称:Sea3D,代码行数:35,代码来源:NDKServer.cpp


示例19: sizeof

BOOL CClientApp::InitInstance()
{
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinAppEx::InitInstance();

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	HANDLE  hMutex=::CreateMutex(NULL,TRUE, _T("Remote"));  //设置信号量,只允许同一时间只有一个程序运行   
	if (NULL != hMutex)   
	{   
		if (ERROR_ALREADY_EXISTS == GetLastError())   
		{   
			MessageBox(NULL,_T("已有一个在程序运行!"), _T("BlackYe远程控制软件"), MB_OK | MB_ICONWARNING);   
			return FALSE;   
		}   
	}   

	CClientDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: 在此放置处理何时用
		//  “确定”来关闭对话框的代码
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: 在此放置处理何时用
		//  “取消”来关闭对话框的代码
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}
开发者ID:blackye,项目名称:remote_control,代码行数:59,代码来源:Client.cpp


示例20: InitInstance

BOOL CSnmptreeApp::InitInstance()
{
    if (!AfxSocketInit())
    {
        AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
        return FALSE;
    }

    // Standard initialization
    // If you are not using these features and wish to reduce the size
    //  of your final executable, you should remove from the following
    //  the specific initialization routines you do not need.

#ifdef _AFXDLL
    Enable3dControls();            // Call this when using MFC in a shared DLL
#else
    Enable3dControlsStatic();    // Call this when linking to MFC statically
#endif

    // Change the registry key under which our settings are stored.
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization.
    SetRegistryKey(_T("Mbuf"));

        // 6-Feb-05 ; load global variable settings
        int retcode = init_globals();
        ASSERT( retcode == 0 );

//    LoadStdProfileSettings(6);

    char *mibdir = netsnmp_get_mib_directory();

    /* Fire up the Net-SNMP library */
    if( snmpcore_init() != SNMPCORE_SUCCESS ) {
        // FIXME -- need better error message
        AfxMessageBox( "Net-SNMP failed to start" );
        return FALSE;
    }

    mibdir = netsnmp_get_mib_directory();

    // To create the main window, this code creates a new frame window
    // object and then sets it as the application's main window object.

    CMainFrame* pFrame = new CMainFrame;
    m_pMainWnd = pFrame;

    // create and load the frame with its resources

    pFrame->LoadFrame(IDR_MAINFRAME,
        WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
        NULL);
    
    // The one and only window has been initialized, so show and update it.
    pFrame->ShowWindow(SW_SHOW);
    pFrame->UpdateWindow();

    return TRUE;
}
开发者ID:linuxlizard,项目名称:snmptree,代码行数:59,代码来源:snmptree.cpp



注:本文中的AfxSocketInit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AfxTermExtensionModule函数代码示例发布时间:2022-05-30
下一篇:
C++ AfxSetResourceHandle函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap