Private Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" (Dest As Any, _
Source As Any, ByVal Length As Long)
Private Sub CopyArray()
Dim lngbytes As Long
Dim lngSrc(1 To 600000) As Long
Dim lngDest(1 To 600000) As Long
'
' Number of bytes equals number of array
' elements times the element length.
'
lngbytes = (UBound(lngSrc) - LBound(lngSrc) + 1) * Len(lngSrc(1))
'
' Copy the array passing the address of the start to
' the destination and source arrays and the length
' of the arrays.
'
Call CopyMemory(lngDest(LBound(lngDest)), lngSrc(LBound(lngSrc)), lngbytes)
End Sub
Thursday, June 7, 2012
VB6 Code - Meng-copy Array Secara Cepat
Labels:
Array
VB6 Code - Mengevaluasi XPath dengan XPath Checker
Berikut adalah kode VB6 yang digunakan untuk mengevaluasi XPath yang digunakan untuk melakukan query terhadap file XML:
READ MORE - VB6 Code - Mengevaluasi XPath dengan XPath Checker
Option Explicit
Private Sub cmdEvaluate_Click()
On Error GoTo ErrHandler
txtErrorXpath.Text = ""
Dim doc As MSXML2.DOMDocument60
Dim nlist As MSXML2.IXMLDOMNodeList
Dim node As MSXML2.IXMLDOMNode
Set doc = New MSXML2.DOMDocument60
doc.setProperty "SelectionLanguage", "XPath"
doc.loadXML txtXMLSource.Text
Set nlist = doc.selectNodes(txtXPath.Text)
lblMathcing.Caption = "Matching Nodes : " & nlist.length
lstMatchingFound.Clear
For Each node In nlist
lstMatchingFound.AddItem node.nodeName & " : " & node.Text
Next
Exit Sub
ErrHandler:
lstMatchingFound.Clear
txtErrorXpath.Text = "Error: " & Err.Description
End Sub
Labels:
XML-VB6
Saturday, June 2, 2012
Manipulasi ShowInTaskBar Pada Form
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_APPWINDOW = &H40000
Private Function ShowInTheTaskbar(frm As Form, b As Boolean)
Dim l As Long
frm.Hide
l = IIf(b, Not WS_EX_APPWINDOW, WS_EX_APPWINDOW)
SetWindowLong frm.hWnd, GWL_EXSTYLE, (GetWindowLong(hWnd, GWL_EXSTYLE) And l)
frm.Show
End Function
Private Sub Check1_Click()
ShowInTheTaskbar Me, Check1.Value = 1 'toggle
End Sub
READ MORE - Manipulasi ShowInTaskBar Pada Form
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_APPWINDOW = &H40000
Private Function ShowInTheTaskbar(frm As Form, b As Boolean)
Dim l As Long
frm.Hide
l = IIf(b, Not WS_EX_APPWINDOW, WS_EX_APPWINDOW)
SetWindowLong frm.hWnd, GWL_EXSTYLE, (GetWindowLong(hWnd, GWL_EXSTYLE) And l)
frm.Show
End Function
Private Sub Check1_Click()
ShowInTheTaskbar Me, Check1.Value = 1 'toggle
End Sub
Labels:
Form
XML Pretty Print - Merapikan Format File XML
Private Sub PrettyPrint(Parent As IXMLDOMNode, Optional Level As Integer)
Dim Node As IXMLDOMNode
Dim Indent As IXMLDOMText
If Not Parent.ParentNode Is Nothing And Parent.ChildNodes.Length > 0 Then
For Each Node In Parent.ChildNodes
Set Indent = Node.OwnerDocument.createTextNode(vbNewLine & String(Level, vbTab))
If Node.NodeType = NODE_TEXT Then
If Trim(Node.Text) = "" Then
Parent.RemoveChild Node
End If
ElseIf Node.PreviousSibling Is Nothing Then
Parent.InsertBefore Indent, Node
ElseIf Node.PreviousSibling.NodeType <> NODE_TEXT Then
Parent.InsertBefore Indent, Node
End If
Next Node
End If
If Parent.ChildNodes.Length > 0 Then
For Each Node In Parent.ChildNodes
If Node.NodeType <> NODE_TEXT Then PrettyPrint Node, Level + 1
Next Node
End If
End Sub
READ MORE - XML Pretty Print - Merapikan Format File XML
Dim Node As IXMLDOMNode
Dim Indent As IXMLDOMText
If Not Parent.ParentNode Is Nothing And Parent.ChildNodes.Length > 0 Then
For Each Node In Parent.ChildNodes
Set Indent = Node.OwnerDocument.createTextNode(vbNewLine & String(Level, vbTab))
If Node.NodeType = NODE_TEXT Then
If Trim(Node.Text) = "" Then
Parent.RemoveChild Node
End If
ElseIf Node.PreviousSibling Is Nothing Then
Parent.InsertBefore Indent, Node
ElseIf Node.PreviousSibling.NodeType <> NODE_TEXT Then
Parent.InsertBefore Indent, Node
End If
Next Node
End If
If Parent.ChildNodes.Length > 0 Then
For Each Node In Parent.ChildNodes
If Node.NodeType <> NODE_TEXT Then PrettyPrint Node, Level + 1
Next Node
End If
End Sub
Labels:
XML-VB6
Subscribe to:
Posts
(
Atom
)