My ATL dll used wxsocketClinet. but now the program need in console.
but. I can't Initialize in the Main......
How can I do Now?
[Help] How to use DLL with wxSocketClient in the console program Topic is solved
Re: [Help] How to use DLL with wxSocketClient in the console program
Hi,
Are you doing both GUI and console application? Or the application will be the same with the switch?
Thank you.
Are you doing both GUI and console application? Or the application will be the same with the switch?
Thank you.
Re: [Help] How to use DLL with wxSocketClient in the console program
ONEEYEMAN wrote:Hi,
Are you doing both GUI and console application? Or the application will be the same with the switch?
Thank you.
My previous project was GUI, so I encapsulated my own network communication into ATL DLL(dll only use wxsocket).
But now the project is only on the console. And only use the network communication in my DLL,
But it is not possible to initialize wxSocket in the console.
So I want to ask what the solution is.
by the way:
My DLL declares the function Initialize and UnInitialize
Code: Select all
void Initialize (){wxSocketBase::Initialize();}
void UnInitialize (){wxSocketBase::Shutdown();}
Re: [Help] How to use DLL with wxSocketClient in the console program
Thanks for doublemax !
Let me solve this problem.
if the program is Not GUI. so this's not the wxApp::OnInit(), so I must Init wxwidgets myself.
so in the console program, I can do this:
if in dll. I can do this:
so, I can use the wxwidgets in everywhere what I need!
Let me solve this problem.
if the program is Not GUI. so this's not the wxApp::OnInit(), so I must Init wxwidgets myself.
so in the console program, I can do this:
Code: Select all
int _tmain(int argc, _TCHAR* argv[])
{
//Init wxwidgets first, then Init wxsocket
wxInitialize();
wxSocketBase::Initialize();
// do something.........
//the end release them.
wxSocketBase::Shutdown();
wxUninitialize();
return 0;
}
Code: Select all
int WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
hInstance;
switch(dwReason){
case DLL_PROCESS_ATTACH:{
wxInitialize();
wxSocketBase::Initialize();
break;}
case DLL_PROCESS_DETACH:{
wxSocketBase::Shutdown();
wxUninitialize();
break;}
}
return 0;
}