Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBscript convert to Javascript.

Status
Not open for further replies.

tempoman

Programmer
May 9, 2000
41
AU
Could someone please help to with the skeleton code for implementing some a Visual Basic Code into Visual Basic Script or Javascript. Is it is possible to do such a thing?<br>Here is the code. PLEASE PLEASE HELP<br><br>Thanks heaps<br><br>Private Declare Function GetDesktopWindow Lib &quot;user32&quot; () As Long<br>Private Declare Function GetWindowDC Lib &quot;user32&quot; (ByVal hwnd As Long) As Long<br>Private Declare Function GetTextMetrics Lib &quot;gdi32&quot; Alias &quot;GetTextMetricsA&quot; (ByVal hdc As Long, lpMetrics As TEXTMETRIC) As Long<br>Private Declare Function SetMapMode Lib &quot;gdi32&quot; (ByVal hdc As Long, ByVal nMapMode As Long) As Long<br>Private Declare Function ReleaseDC Lib &quot;user32&quot; (ByVal hwnd As Long, ByVal hdc As Long) As Long<br>Private Const MM_TEXT = 1<br>Private Type TEXTMETRIC<br>&nbsp;&nbsp;&nbsp;tmHeight As Integer<br>&nbsp;&nbsp;&nbsp;tmAscent As Integer<br>&nbsp;&nbsp;&nbsp;tmDescent As Integer<br>&nbsp;&nbsp;&nbsp;tmInternalLeading As Integer<br>&nbsp;&nbsp;&nbsp;tmExternalLeading As Integer<br>&nbsp;&nbsp;&nbsp;tmAveCharWidth As Integer<br>&nbsp;&nbsp;&nbsp;tmMaxCharWidth As Integer<br>&nbsp;&nbsp;&nbsp;tmWeight As Integer<br>&nbsp;&nbsp;&nbsp;tmItalic As String * 1<br>&nbsp;&nbsp;&nbsp;tmUnderlined As String * 1<br>&nbsp;&nbsp;&nbsp;tmStruckOut As String * 1<br>&nbsp;&nbsp;&nbsp;tmFirstChar As String * 1<br>&nbsp;&nbsp;&nbsp;tmLastChar As String * 1<br>&nbsp;&nbsp;&nbsp;tmDefaultChar As String * 1<br>&nbsp;&nbsp;&nbsp;tmBreakChar As String * 1<br>&nbsp;&nbsp;&nbsp;tmPitchAndFamily As String * 1<br>&nbsp;&nbsp;&nbsp;tmCharSet As String * 1<br>&nbsp;&nbsp;&nbsp;tmOverhang As Integer<br>&nbsp;&nbsp;&nbsp;tmDigitizedAspectX As Integer<br>&nbsp;&nbsp;&nbsp;tmDigitizedAspectY As Integer<br>End Type<br><br>'&nbsp;&nbsp;Returns true if the system is using small fonts,<br>'&nbsp;&nbsp;false if using large fonts<br>'<br>'&nbsp;&nbsp;Source: the MS knowlege base article Q152136.<br>'<br>Public Function SmallFonts() As Boolean<br>&nbsp;&nbsp;&nbsp;Dim hdc As Long<br>&nbsp;&nbsp;&nbsp;Dim hwnd As Long<br>&nbsp;&nbsp;&nbsp;Dim PrevMapMode As Long<br>&nbsp;&nbsp;&nbsp;Dim tm As TEXTMETRIC<br><br>&nbsp;&nbsp;&nbsp;' Set the default return value to small fonts<br>&nbsp;&nbsp;&nbsp;SmallFonts = True<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;' Get the handle of the desktop window<br>&nbsp;&nbsp;&nbsp;hwnd = GetDesktopWindow()<br><br>&nbsp;&nbsp;&nbsp;' Get the device context for the desktop<br>&nbsp;&nbsp;&nbsp;hdc = GetWindowDC(hwnd)<br>&nbsp;&nbsp;&nbsp;If hdc Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Set the mapping mode to pixels<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrevMapMode = SetMapMode(hdc, MM_TEXT)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Get the size of the system font<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GetTextMetrics hdc, tm<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Set the mapping mode back to what it was<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrevMapMode = SetMapMode(hdc, PrevMapMode)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Release the device context<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ReleaseDC hwnd, hdc<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' If the system font is more than 16 pixels high,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' then large fonts are being used<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If tm.tmHeight &gt; 16 Then SmallFonts = False<br>&nbsp;&nbsp;&nbsp;End If<br><br>End Function
 
if it uses API then no you cant. some of the basic stuff does work, but not anything that would require being compiled. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top