Free Advertising Forums | Free Advertising Board | Post Free Ads Forum | Free Advertising Forums Directory | Best Free Advertising Methods | Advertising Forums

Free Advertising Forums | Free Advertising Board | Post Free Ads Forum | Free Advertising Forums Directory | Best Free Advertising Methods | Advertising Forums (http://www.freeadvertisingzone.com/index.php)
-   Small Business Opportunities: (http://www.freeadvertisingzone.com/forumdisplay.php?f=43)
-   -   Buy Office 2010 Formatting numbers into hexadecima (http://www.freeadvertisingzone.com/showthread.php?t=1026029)

04-05-2011 07:37 AM

Buy Office 2010 Formatting numbers into hexadecima
 
Even though class modules in VBA are not as powerful as their brethren in C++, C#, or VB.NET, I'm still a fan. Some time ago,Windows 7 X86, I wrote an application which contained a class called ISearch and then subclasses which implemented this class using the Implements keyword. For debugging, I thought it would be cool to print the address of the ISearch implementation object using the ObjPtr function. The ObjPtr function returns a Long that represents the memory address of an object variable. These numbers were a bit long for my liking, so to make them easier to read and understand,Windows 7 Home Basic, I wrote this function called FormatHex. This function wraps the Hex function in VBA but applies some formatting to it.
' -------------------------------------------------------------------------
' Function : FormatHex
' Purpose : Formats a number in hexadecimal format
' Arguments: lngValue - numeric value to format
' : nLength - returned length of the string
' : strPrefix - hex prefix for the number - defaults to 0x
' -------------------------------------------------------------------------
Public Function FormatHex(lngValue As Long,Office 2007 Activation, _
Optional nLength As Byte = 8, _
Optional strPrefix As String = "0x") As String
FormatHex = Trim(strPrefix & Replace(Format(Hex(lngValue),Cheap Windows 7, String(nLength, "@")), " ",Buy Office 2010, "0"))
End Function
<div


All times are GMT. The time now is 08:39 AM.

Powered by vBulletin Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Free Advertising Forums | Free Advertising Message Boards | Post Free Ads Forum