Click here to Skip to main content
13,046,281 members (126,793 online)
Click here to Skip to main content
Add your own
alternative version


23 bookmarked
Posted 12 Nov 2000

Hex Converter

, 13 Nov 2000
Rate this:
Please Sign up or sign in to vote.
Converts a lump of binary/text data to hex format.
<!-- Link to source file download --> <!-- Add the rest of your HTML here -->


This is a simple COM component that converts a lump of binary/text data to the hex format. I just wrote it for one of my projects to have a look at the binary data. The component supports only two interfaces; IHexConverter and ISupportErrorInfo, with four methods. It's been developed on Win98, with VC++ 6.0. It's very simple in use, and I thought it might be useful for others.


SetFile([in] BSTR bstrFilePath);
SetString([in] BSTR bstrInput);
GetLineCount([out] long* pLineCount)
GetNextLine([out] BSTR* pbstrOutput)

Typical Usage (in C++):


IHexConvertor* pHC = NULL;
HRESULT hr = CoCreateInstance(CLSID_HexConverter,

//Set the input file / string
CComBSTR bstrFile(_T("C:\MyFile.dat"))
hr = pHC->SetFile(bstrFile);


CComBSTR bstrInput(_T("blah........blah............"));
hr = pHC->SetString(bstrString);

//get the total no. of lines in the output string (containing 16 bytes each)
long lLines;
hr = pHC->GetLineCount(&iLines);

//get each line
for(int i = 0; i < iLines; i++)
    CComBSTR bstrOutput;
    hr = pHC->GetNextLine(&bstrOutput);



You need to register the component before use. If you spot any problems or possible enhancements please let me know at <a href="">[Mukesh Gupta].


  • Windows Programming With MFC By: Jeff Prosise


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Mukesh Gupta
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

Questionsql connection with MFC Pin
koushik.net2-Jun-08 3:07
memberkoushik.net2-Jun-08 3:07 
GeneralMore Bugs Pin
James R. Twine16-Nov-02 13:28
memberJames R. Twine16-Nov-02 13:28 
GeneralHex to string Pin
anoymous27-Apr-02 18:30
memberanoymous27-Apr-02 18:30 
GeneralSome bugs Pin
Thomas Hoekstra14-Feb-02 7:34
memberThomas Hoekstra14-Feb-02 7:34 
GeneralHelp me for converting ! Pin
55AABK19-Nov-01 9:49
member55AABK19-Nov-01 9:49 
GeneralRe: Help me for converting ! Pin
llangolas28-Nov-01 6:05
memberllangolas28-Nov-01 6:05 
Questionhow to write a Test program of COM object Pin
Anonymous3-Oct-01 18:58
memberAnonymous3-Oct-01 18:58 
Questionhow to use? Pin
linghuchong14-Dec-00 16:44
memberlinghuchong14-Dec-00 16:44 
AnswerRe: how to use? Pin
Mukesh Gupta14-Dec-00 20:19
memberMukesh Gupta14-Dec-00 20:19 
GeneralIt is me,again Pin
linghuchong15-Dec-00 0:15
memberlinghuchong15-Dec-00 0:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 14 Nov 2000
Article Copyright 2000 by Mukesh Gupta
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid