c++¶Á×¢²á±í»ñȡԶ³ÌÖն˶˿Ú

2014-11-24 13:01:28 ¡¤ ×÷Õß: ¡¤ ä¯ÀÀ: 0

///////////////////////////////////////////
// port.cppÎļþ
#include
#include
#include <windows.h>
#include
using namespace std;
//typedef unsigned char byte;

int main()

{
HKEY hKey;

LONG lRet = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE,L"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp",0,KEY_QUERY_VALUE, &hKey);

if(lRet != ERROR_SUCCESS)
{

printf(" failed ");
return 0;
}
else
{
printf("Terminal Server(Ô¶³Ì×ÀÃæ)¶Ë¿ÚΪ:");
DWORD port,Length;
long ret1=::RegQueryValueExW(hKey, L"PortNumber", 0, 0, (unsigned char*)&port, &Length);
//cout < cout << port;

}

::RegCloseKey(hKey);
getchar();
return 0;
}