|
NetWkstaGetInfo라는 WIN32Api를 이용해서
아래와 같은 코드를 짰는데 langroup는 그렇다치고,
computername까지 모두 대문자로 나옵니다.
그러니깐 langroup야 내 컴퓨터의 등록정보에서도
대문자로 표시되니깐 별로 상관이 없는데,
computername은 안 그렇거든요?
pBuf->wki100_computername가 유니코드여서 문제가 생기는 것인지.. 쩝....
내컴퓨터의 등록정보에 나오는 것처럼 소문자도 표시될 수 있도록 할려면
어떻해야 하나요?
pBuf->wki100_computername은 LPWSTR형, 그러니깐 16비트 유니코드문자들에 대한 포인터,
ComputerNameEdit->Text(Tedit->Text)는 AnsiString입니다.
DWORD dwLevel = 100;
LPWKSTA_INFO_100 pBuf = NULL;
NET_API_STATUS nStatus;
//LPTSTR pszServerName = NULL;
//
// Call the NetWkstaGetInfo function, specifying level 100.
//
nStatus = NetWkstaGetInfo(NULL,
dwLevel,
(LPBYTE *)&pBuf);
//
// If the call is successful,
// print the workstation data.
//
if (nStatus == NERR_Success)
{
//ShowMessage(pBuf->wki100_computername);
ComputerNameEdit->Text = pBuf->wki100_computername;
WorkGroupEdit->Text = pBuf->wki100_langroup;
}
//
// Otherwise, indicate the system error.
//
else
ShowMessage("A system error has occurred: " + nStatus);
//
// Free the allocated memory.
//
if (pBuf != NULL)
NetApiBufferFree(pBuf);
return;
|