Created
April 26, 2012 08:43
-
-
Save melice/2497725 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fyttt.cpp : 定义控制台应用程序的入口点。 | |
// | |
#include "stdafx.h" | |
#include "windows.h" | |
#include <string> | |
using namespace std; | |
struct tagAuthResult | |
{ | |
long bAuthState; | |
long lPoint; | |
long bIsRealName; | |
long bLimited; | |
string a; | |
}; | |
typedef int(__stdcall *LPFNDLLFUNC1)(char*, char*,tagAuthResult*,int ); | |
typedef int(__stdcall *LPCONNECTTOSERVER)(char*, int); | |
LPFNDLLFUNC1 lpfnDllFunc1; | |
LPCONNECTTOSERVER lpConnecttoServer; | |
DWORD WINAPI ThreadFunction(LPVOID lpParameter) | |
{ | |
tagAuthResult ret; | |
printf("ThreadProc线程函数运行\r\n"); | |
lpfnDllFunc1( "fytest02", "123456",&ret, 10); | |
if (ret.bAuthState==1) | |
{ | |
MessageBoxA(NULL,"ok","",MB_OK); | |
} | |
else | |
{ | |
MessageBoxA(NULL,"f","",MB_OK); | |
} | |
printf("ThreadProc线程函数运行结束\r\n"); | |
return true; | |
} | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
HINSTANCE m_hDLL = LoadLibraryA( "fyauth.dll" ); // Handle to DLL | |
lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress( m_hDLL, "SendGetAuthInfo" ); | |
lpConnecttoServer = (LPCONNECTTOSERVER)GetProcAddress( m_hDLL, "ConnectToServ" ); | |
int m_nIsConnect = lpConnecttoServer("124.172.245.244", 13399); | |
if (m_nIsConnect==0) | |
{ | |
HANDLE hT=CreateThread(NULL,0,ThreadFunction,NULL, CREATE_SUSPENDED,NULL); | |
ResumeThread(hT); | |
// Sleep(9999); | |
// MSG Msg; | |
// while(1) | |
//{ // Sleep(10); | |
// GetMessage(&Msg, 0, 0, 0); | |
//TranslateMessage(&Msg); | |
//DispatchMessage(&Msg); | |
//}; | |
//WaitForSingleObject(hT,INFINITE); | |
// CloseHandle(hT); | |
} | |
printf("finished\r\n"); | |
getchar(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment