There is a small number of C ++ source codes that need to be translated into other source codes. for moderators and experts, please visit.

Source: Internet
Author: User
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;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.