There is a small number of C ++ source codes that need to be translated into other source codes. for moderators and experts, please visit. Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiAPI/html/delphi_20061121222102188.html
The source code below is used to determine the encoding of the data stream, provided by a friend named jiangsheng. Thank you first.
However, I will not use C ++. I am eager to use this source code. Please help me and translate the source code below into VB, Delphi, or net, or make a DLL for me. It is best to translate it into VB. net, I am very grateful. Thank you first. Mail: 237019683@qq.com
Static hresult detectcodepage (
Istreamptr spstream,
STD: vector <DWORD> & dwcodepages,
DWORD dwflag = mldetectcp_8bit,
DWORD dwprefwincodepage = 0)
{
Hresult hR = s_ OK;
Const int n = 32;
Int nscores = N;
Detectencodinginfo info [N];
HR = detectcodepageinistream (
Dwflag,
Dwprefwincodepage,
Spstream,
Info,
& Nscores );
If (failed (HR ))
{
Return hr;
}
For (INT I = 0; I <nscores; I ++)
{
Dwcodepages. push_back (info [I]. ncodepage );
}
Return s_ OK;
}
// Ie5.0 or lator
Static hresult detectcodepageinistream (
DWORD dwflag,
DWORD dwprefwincodepage,
Istream * pstmin,
Detectencodinginfo * lpencoding,
Int * pnscores)
{
Hresult hR = s_ OK;
Try
{
Imulti1_age2ptr spmulti1_age2 = getmultilanguage ();
If (spmulti‑age2 = NULL)
{
Return e_fail;
}
This is a method to call the browser's spmulti‑age2 interface, detectcodepageinistream
HR = spmulti‑age2-> detectcodepageinistream (
Dwflag,
Dwprefwincodepage,
Pstmin,
Lpencoding,
Pnscores );
If (failed (HR ))
{
Return hr;
}
}
Catch (...)
{
Return e_fail;
}
Return s_ OK;
}
Static imultilanguageptr getmultilanguage ()
{
Hresult hR = s_ OK;
Imultilanguageptr spmultilanguage;
HR = spmultilanguage. createinstance (_ uuidof (cmultilanguage ));
If (failed (HR ))
{
Return NULL;
}
Return spmultilanguage;
}