NotePad 函数系列之二

Public Sub TampNotePad(ByVal sTxtFile As String, Optional ByVal bTrimRow As Variant = True) ‘对文本文件消除空行, bTrimRow 为真, 则行 ” ” 视为空行 “”
On Error Resume Next
Dim I As Integer, J As Integer
Dim Lines() As String
Dim LineContent As String
Dim iLineCount As Integer
Dim TxtFileNumber As Integer
TxtFileNumber = FreeFile
If Not FileExist(sTxtFile) Then Exit Sub
Open sTxtFile For Input As TxtFileNumber
Do While Not EOF(TxtFileNumber) ‘把文本读至数组
Line Input #TxtFileNumber, LineContent
iLineCount = iLineCount + 1
ReDim Preserve Lines(1 To iLineCount)
Lines(iLineCount) = LineContent
Loop
Close TxtFileNumber
Open sTxtFile For Output As TxtFileNumber
For I = 1 To iLineCount ‘把数组写入文本
If bTrimRow Then Lines(I) = Trim(Lines(I))
If Not Lines(I) = “” Then Print #TxtFileNumber, Lines(I)
Next I
Close TxtFileNumber
If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Sub


Public Sub TrimNotePad(ByVal sTxtFile As String, Optional ByVal bTrimRow As Variant = True) ‘对文本文件消除前后空行, 中间空行不管, bTrimRow 为真, 则行 ” ” 视为空行 “”
On Error Resume Next
Dim I As Integer, J As Integer
Dim Lines() As String
Dim LineContent As String
Dim iLineCount As Integer
Dim TxtFileNumber As Integer
TxtFileNumber = FreeFile
If Not FileExist(sTxtFile) Then Exit Sub
Open sTxtFile For Input As TxtFileNumber
Do While Not EOF(TxtFileNumber) ‘把文本读至数组
Line Input #TxtFileNumber, LineContent
iLineCount = iLineCount + 1
ReDim Preserve Lines(1 To iLineCount)
Lines(iLineCount) = LineContent
Loop
Close TxtFileNumber
Dim iBegin As Integer, iEnd As Integer
For I = 1 To iLineCount
If bTrimRow Then Lines(I) = Trim(Lines(I))
If Not Lines(I) = “” Then
iBegin = I
Exit For
End If
Next I
For I = iLineCount To 1 Step -1
If bTrimRow Then Lines(I) = Trim(Lines(I))
If Not Lines(I) = “” Then
iEnd = I
Exit For
End If
Next I
Open sTxtFile For Output As TxtFileNumber
For I = iBegin To iEnd ‘把数组写入文本
Print #TxtFileNumber, Lines(I)
Next I
Close TxtFileNumber
If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Sub


Public Sub CleanNotePad(ByVal sTxtFile As String) ‘对文本文件消除重复行
On Error Resume Next
Dim I As Integer, J As Integer
Dim Lines() As String
Dim LineContent As String
Dim iLineCount As Integer
Dim TxtFileNumber As Integer
TxtFileNumber = FreeFile
If Not FileExist(sTxtFile) Then Exit Sub
Open sTxtFile For Input As TxtFileNumber
Do While Not EOF(TxtFileNumber) ‘把文本读至数组
Line Input #TxtFileNumber, LineContent
iLineCount = iLineCount + 1
ReDim Preserve Lines(1 To iLineCount)
Lines(iLineCount) = LineContent
Loop
Close TxtFileNumber
Call CleanUpArray(Lines) ‘去除重复元素
iLineCount = UBound(Lines) – LBound(Lines) + 1
Open sTxtFile For Output As TxtFileNumber
For I = 1 To iLineCount
Print #TxtFileNumber, Lines(I)
Next I
Close TxtFileNumber
If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Sub


Public Sub SortNotePad(ByVal sTxtFile As String, ByVal bAscending As Boolean) ‘对文本文件按行排序
On Error Resume Next
Dim I As Integer, J As Integer
Dim Lines() As String
Dim LineContent As String
Dim iLineCount As Integer
Dim TxtFileNumber As Integer
TxtFileNumber = FreeFile
If Not FileExist(sTxtFile) Then Exit Sub
Open sTxtFile For Input As TxtFileNumber
Do While Not EOF(TxtFileNumber) ‘把文本读至数组
Line Input #TxtFileNumber, LineContent
iLineCount = iLineCount + 1
ReDim Preserve Lines(1 To iLineCount)
Lines(iLineCount) = LineContent
Loop
Close TxtFileNumber
If iLineCount = 0 Then Exit Sub ‘LBound 会出错
Dim iBest As Integer
Dim sBest As String
For I = 1 To iLineCount – 1 ‘对数组进行有序处理
iBest = I
sBest = Lines(I)
For J = I + 1 To iLineCount
If StrComp(Lines(J), sBest, vbTextCompare) < 0 Then sBest = Lines(J) iBest = J End If Next J Lines(iBest) = Lines(I) Lines(I) = sBest Next I Open sTxtFile For Output As TxtFileNumber If bAscending = True Then ‘把数组写入文本 ‘Ascending order For I = 1 To iLineCount Print #TxtFileNumber, Lines(I) Next I Else ‘Descending order For I = iLineCount To 1 Step -1 Print #TxtFileNumber, Lines(I) Next I End If Close TxtFileNumber If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Sub


Public Sub ClearNotePad(ByVal sTxtFile As String) ‘保留文本文件但清空其内容
On Error Resume Next
Dim I As Integer, J As Integer
Dim Lines() As String
Dim TxtFileNumber As Integer
TxtFileNumber = FreeFile
Open sTxtFile For Output As TxtFileNumber
For I = LBound(Lines) To UBound(Lines) ‘把数组写入文本
Print #TxtFileNumber, Lines(I)
Next I
Close TxtFileNumber
If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Sub

NotePad 函数系列之一

Public Function FindNotePadText(ByVal sTxtFile As String, ByVal sData As String) As Boolean
FindNotePadText = False
On Error Resume Next
Dim TxtFileNumber As Integer
Dim LineContent As String
TxtFileNumber = FreeFile
If Not FileExist(sTxtFile) Then Exit Function
Open sTxtFile For Input As TxtFileNumber
Do While Not EOF(TxtFileNumber) ‘把文本读至数组
Line Input #TxtFileNumber, LineContent
If InStr(1, LineContent, sData, vbTextCompare) > 0 Then
FindNotePadText = True
Exit Do
End If
Loop
Close TxtFileNumber
If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Function


Public Function GetNotePadRowNo(ByVal sTxtFile As String, ByVal sData As String, Optional ByVal bFirst As Boolean = False) As Integer
‘sData 出现在 sTxtFile 的行号,无 sData 为 0,bFirst = True 取第一次,bFirst = False 取最后一次
On Error Resume Next
GetNotePadRowNo = 0
If Not FileExist(sTxtFile) Then Exit Function
Dim TxtFileNumber As Integer
Dim LineContent As String
Dim LineArray() As Integer
Dim LineCount As Integer
Dim LineNumber As Integer
LineCount = 0
LineNumber = 0
TxtFileNumber = FreeFile
Open sTxtFile For Input As TxtFileNumber
Do While Not EOF(TxtFileNumber) ‘读文本
Line Input #TxtFileNumber, LineContent
LineNumber = LineNumber + 1
If InStr(1, LineContent, sData, vbTextCompare) > 0 Then ‘出现
LineCount = LineCount + 1
ReDim Preserve LineArray(1 To LineCount)
LineArray(LineCount) = LineNumber
End If
Loop
Close TxtFileNumber
If IsEmptyArray(LineArray) Then Exit Function ‘0
If bFirst Then
GetNotePadRowNo = LineArray(LBound(LineArray))
Else
GetNotePadRowNo = LineArray(UBound(LineArray))
End If
If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Function


Public Sub ReplaceNotePadText(ByVal sTxtFile As String, ByVal sOld As String, ByVal sNew As String)
On Error Resume Next
Dim I As Integer, J As Integer
Dim Lines() As String
Dim LineContent As String
Dim iLineCount As Integer
Dim TxtFileNumber As Integer
TxtFileNumber = FreeFile
If Not FileExist(sTxtFile) Then Exit Sub
Open sTxtFile For Input As TxtFileNumber
Do While Not EOF(TxtFileNumber) ‘把文本读至数组
Line Input #TxtFileNumber, LineContent
LineContent = Replace(LineContent, sOld, sNew, 1, -1, vbTextCompare)
iLineCount = iLineCount + 1
ReDim Preserve Lines(1 To iLineCount)
Lines(iLineCount) = LineContent
Loop
Close TxtFileNumber
If iLineCount = 0 Then Exit Sub ‘LBound 会出错
Open sTxtFile For Output As TxtFileNumber
For I = 1 To iLineCount
Print #TxtFileNumber, Lines(I)
Next I
Close TxtFileNumber
If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Sub


Public Sub TurnNotePadCursor(ByVal sTxtFile As String, ByVal iRow As Integer, Optional ByVal iColumn As Integer = 1, Optional bOpen As Boolean = False) ‘把文本文件光标移到某行某列
On Error Resume Next
Dim I As Integer, J As Integer
Dim oShell As Object
Set oShell = CreateObject(“WScript.Shell”)
If bOpen Then
‘新打开文件
Dim lPid As Long
lPid = Shell(“notepad.exe ” & sTxtFile, vbNormalFocus)
AppActivate (lPid)
Else
‘须紧跟 OpenFile 之后,以保证 sTxtFile 为当前窗体
‘Debug.Print sTxtFile
‘Debug.Print GetShortName(sTxtFile)
For I = 1 To GetNotePadRowCount(sTxtFile, False)
DoEvents
oShell.SendKeys “{UP}” ‘回到首行
Next I
For J = 1 To GetNotePadColumnCount(sTxtFile, False)
DoEvents
oShell.SendKeys “{LEFT}” ‘回到首列
Next J
End If
For I = 1 To iRow – 1
oShell.SendKeys “{DOWN}”
Next I
For J = 1 To iColumn – 1
oShell.SendKeys “{RIGHT}”
Next J
ERR_NORUNNING:
If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Sub


Public Function GetNotePadRowCount(ByVal sTxtFile As String, Optional ByVal bTrimRow As Variant = True) As Integer ‘获取 txt 文件行数, bTrimRow 为真, 则空行 “” 及空格行 ” ” 不计
On Error Resume Next
GetNotePadRowCount = 0
Dim TxtFileNumber As String
TxtFileNumber = FreeFile
If bTrimRow Then
Dim LineContent As String
Open sTxtFile For Input As TxtFileNumber
Do While Not EOF(TxtFileNumber) ‘把文本读至数组
Line Input #TxtFileNumber, LineContent
LineContent = Trim(LineContent)
If Not LineContent = “” Then GetNotePadRowCount = GetNotePadRowCount + 1
Loop
Close TxtFileNumber
Else
Open sTxtFile For Binary As #TxtFileNumber
GetNotePadRowCount = UBound(Split(Input(LOF(1), #1), vbCrLf)) + 1
Close #TxtFileNumber
End If
If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Function


Public Function GetNotePadColumnCount(ByVal sTxtFile As String, Optional ByVal bTrimRow As Variant = True) As Integer ‘获取 txt 文件列数(最大列数)), bTrimRow 为真, 则每行两端的 ” ” 不计
On Error Resume Next
Dim I As Integer, J As Integer
GetNotePadColumnCount = 0
Dim LineContent As String
Dim TxtFileNumber As Integer
TxtFileNumber = FreeFile
If Not FileExist(sTxtFile) Then Exit Function
Open sTxtFile For Input As TxtFileNumber
Do While Not EOF(TxtFileNumber)
Line Input #TxtFileNumber, LineContent
If bTrimRow Then LineContent = Trim(LineContent)
If Len(LineContent) > GetNotePadColumnCount Then GetNotePadColumnCount = Len(LineContent)
Loop
Close TxtFileNumber
If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Function
Public Function GetNotePadColumnCountAtRow(ByVal sTxtFile As String, ByVal iRow As Integer, Optional ByVal bTrimRow As Variant = True) As Integer ‘获取 txt 文件某行列数, bTrimRow 为真, 则行两端的 ” ” 不计
On Error Resume Next
Dim I As Integer, J As Integer
GetNotePadColumnCountAtRow = 0
Dim LineContent As String
Dim TxtFileNumber As Integer
Dim iCount As Integer
TxtFileNumber = FreeFile
If Not FileExist(sTxtFile) Then Exit Function
Open sTxtFile For Input As TxtFileNumber
Do While Not EOF(TxtFileNumber)
Line Input #TxtFileNumber, LineContent
iCount = iCount + 1
If bTrimRow Then LineContent = Trim(LineContent)
If iCount = iRow Then
GetNotePadColumnCountAtRow = Len(LineContent)
Exit Do
End If
Loop
Close TxtFileNumber
If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Function


Public Function GetNotePadRowText(ByVal sTxtFile As String, ByVal iLineNumber As Integer) As String ‘获取 txt 文件某行内容
On Error Resume Next
Dim I As Integer, J As Integer
GetNotePadRowText = “”
If iLineNumber > GetNotePadRowCount(sTxtFile, False) Then Exit Function
Dim oFSO As Object, oFile As Object, oStream As Object
Set oFSO = CreateObject(“Scripting.FileSystemObject”)
Set oFile = oFSO.GetFile(sTxtFile)
Set oStream = oFile.OpenAsTextStream(1, 0)
‘ 读取指定行
For I = 1 To iLineNumber
GetNotePadRowText = oStream.ReadLine
Next
oStream.Close
Set oStream = Nothing
Set oFile = Nothing
Set oFSO = Nothing
If Err.Number <> 0 Then Err.Clear
On Error GoTo 0
End Function

Word 的回车

word里有软回车和硬回车两种回车,其实中间还有个“薛定谔换行”。

软回车是按Shift+Enter产生的,当在word里打开显示所有标记,就会发现一个向下箭头,可以达到换行的效果,但是上下文还是同一个段落,在设置样式的时候上下还是一个整体。软回车在word里的符号是^l,它的ASCII编码是chr(11)。

在word的“查找”和“替换”窗口无论是否勾选“使用通配符”,既可以用^l也可以用^11,注意,是(1)查找和(2)替换时无论(3)勾选通配符和(4)取消使用通配符,这几种情况分别都可以用^l或^11,这很重要,因为不是所有符号都支持。

硬回车是按下回车键产生的,同时作为段落标记和回车,可以把上下文分为两个段落(Paragraph),可以设置不同的样式(大纲级别、行距之类的),它在ASCII里的编码是chr(13),在word里的符号是^p。

和软回车不同的是,查找、替换、使用通配符这几种情况下,^13和^P不是都支持的,简单的说,只有在“查找+使用通配符”这一种情况下才能使用^13。

为什么会这样?^13和^p有什么区别?

这就要提到下边“薛定谔换行”。

当需要把软回车替换为硬回车时,通过替换框中将^11替换为^13,发现向下箭头变成了普通的硬回车符号,但是,这个回车符和普通回车符不同,光标可以放在回车符后边,这本来是不可能的。

这时如果改变上下段落的样式,会发现相邻的段落样式也改变了,为什么呢?

因为它是个假的段落标记“薛定谔换行”,也就是^13和^p的差别。

^13和^p既有区别又有联系,它们在VBA中的VBA.ASC值都是13,word会把^13自动转换为^p,但是当从文本文件等其他地方把包含^13的文字直接复制进word,它就出现了,在排版过程中尤其是通过VBA操作word文档时候可能掉进这个陷阱,包括上边提到的把^11替换为^13时,这时候需要通过复制、选择性粘贴,word才会把^13转换为正常的^p。

TextBox 函数系列之一

Public Declare Function SendMessage Lib “user32” Alias “SendMessageA” (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const EM_GETSEL = &HB0
Public Const EM_LINEFROMCHAR = &HC9
Public Const EM_LINEINDEX = &HBB

Public Function GetTextBoxRowText(ByVal oTextBox As TextBox, ByVal iLine As Integer) As String ‘获取 TextBox 某行文字
On Error Resume Next
Dim TempArray As Variant
TempArray = Split(oTextBox.Text, vbCrLf, -1, vbTextCompare)
GetTextBoxRowText = TempArray(iLine – 1)
On Error GoTo 0
End Function

Public Function GetTextBoxRowCount(ByVal oTextBox As TextBox) As Integer ‘获取 TextBox 文字行数
On Error Resume Next
GetTextBoxRowCount = 0
Dim TempArray As Variant
TempArray = Split(oTextBox.Text, vbCrLf, -1, vbTextCompare)
GetTextBoxRowCount = UBound(TempArray) – LBound(TempArray) + 1
On Error GoTo 0
End Function

Public Function GetTextBoxColumnCount(ByVal oTextBox As TextBox) As Integer ‘获取 TextBox 文字最大列数
On Error Resume Next
Dim I As Integer, J As Integer
GetTextBoxColumnCount = 0
Dim TempArray As Variant
TempArray = Split(oTextBox.Text, vbCrLf, -1, vbTextCompare)
For I = LBound(TempArray) To UBound(TempArray)
‘Debug.Print Len(TempArray(I)); I
If GetTextBoxColumnCount < Len(TempArray(I)) Then GetTextBoxColumnCount = Len(TempArray(I))
Next I
On Error GoTo 0
End Function

Public Function GetTextBoxColumnCountAtRow(ByVal oTextBox As TextBox, ByVal iRow As Integer) As Integer ‘获取 TextBox 某行文字最大列数
On Error Resume Next
Dim I As Integer, J As Integer
GetTextBoxColumnCountAtRow = 0
Dim TempArray As Variant
TempArray = Split(oTextBox.Text, vbCrLf, -1, vbTextCompare)
Dim iCount As Integer
For I = LBound(TempArray) To UBound(TempArray)
‘Debug.Print Len(TempArray(I)); I
iCount = iCount + 1
If iCount = iRow Then
GetTextBoxColumnCountAtRow = Len(TempArray(I))
Exit For
End If
Next I
On Error GoTo 0
End Function

Public Function GetTextBoxCharCount(ByVal oTextBox As TextBox) As Long’获取 TextBox 文字数
On Error Resume Next
GetTextBoxCharCount = 0
Dim lCount As Long, lRow As Long, lCol As Long
Dim lParam As Long, wParam As Long
‘首先向文本框传递EM_GETSEL消息以获取从起始位置到光标所在位置的字符数
lRet = SendMessage(oTextBox.hwnd, EM_GETSEL, wParam, lParam)
lCount = lRet / 2 ^ 16
‘再向文本框传递EM_LINEFROMCHAR消息根据获得的字符数确定光标以获取所在行数
lRow = SendMessage(oTextBox.hwnd, EM_LINEFROMCHAR, lCount, 0)
lRow = lRow + 1
‘扣除 VbCrlf
GetTextBoxCharCount = lCount – (lRow – 1) * 2
‘向文本框传递EM_LINEINDEX消息以获取所在列数
‘lRet = SendMessage(oTextBox.hWnd, EM_LINEINDEX, -1, 0)
‘lCol = lCount – lRet + 1
On Error GoTo 0
End Function

Public Function GetTextBoxCursorRow(ByVal oTextBox As TextBox) As Long’获取 TextBox 光标所在行
On Error Resume Next
GetTextBoxCursorRow = 0
Dim lCount As Long, lRow As Long, lCol As Long
Dim lParam As Long, wParam As Long
‘首先向文本框传递EM_GETSEL消息以获取从起始位置到光标所在位置的字符数
lRet = SendMessage(oTextBox.hwnd, EM_GETSEL, wParam, lParam)
lCount = lRet / 2 ^ 16
‘再向文本框传递EM_LINEFROMCHAR消息根据获得的字符数确定光标以获取所在行数
lRow = SendMessage(oTextBox.hwnd, EM_LINEFROMCHAR, lCount, 0)
lRow = lRow + 1
GetTextBoxCursorRow = lRow
‘向文本框传递EM_LINEINDEX消息以获取所在列数
‘lRet = SendMessage(oTextBox.hWnd, EM_LINEINDEX, -1, 0)
‘lCol = lCount – lRet + 1
On Error GoTo 0
End Function

Public Function GetTextBoxCursorColumn(ByVal oTextBox As TextBox) As Long’获取 TextBox 光标所在列
On Error Resume Next
GetTextBoxCursorColumn = 0
Dim lCount As Long, lRow As Long, lCol As Long
Dim lParam As Long, wParam As Long
‘首先向文本框传递EM_GETSEL消息以获取从起始位置到光标所在位置的字符数
lRet = SendMessage(oTextBox.hwnd, EM_GETSEL, wParam, lParam)
lCount = lRet / 2 ^ 16
‘再向文本框传递EM_LINEFROMCHAR消息根据获得的字符数确定光标以获取所在行数
lRow = SendMessage(oTextBox.hwnd, EM_LINEFROMCHAR, lCount, 0)
lRow = lRow + 1
‘向文本框传递EM_LINEINDEX消息以获取所在列数
lRet = SendMessage(oTextBox.hwnd, EM_LINEINDEX, -1, 0)
lCol = lCount – lRet + 1
GetTextBoxCursorColumn = lCol
On Error GoTo 0
End Function

Public Sub TurnTextBoxCursor(ByVal oTextBox As TextBox, ByVal iRow As Integer, Optional ByVal iColumn As Integer = 1) ‘把文本文件光标移到某行某列
On Error Resume Next
Dim I As Integer, J As Integer
Dim oShell As Object
Set oShell = CreateObject(“WScript.Shell”)
oTextBox.SetFocus
Dim iCurRow As Integer, iCurColumn As Integer
iCurRow = GetTextBoxCursorRow(oTextBox) ‘当前行
iCurColumn = GetTextBoxCursorColumn(oTextBox) ‘当前列
‘Debug.Print iCurRow; iCurColumn
If iCurRow < iRow Then
For I = iCurRow To iRow – 1
oShell.SendKeys “{DOWN}”
Next I
Else
For I = iRow To iCurRow – 1
oShell.SendKeys “{UP}”
Next I
End If
Wait 50
iCurRow = GetTextBoxCursorRow(oTextBox) ‘当前行
iCurColumn = GetTextBoxCursorColumn(oTextBox) ‘目标行的当前列
‘Debug.Print iCurRow; iCurColumn
If iCurColumn < iColumn Then
For J = iCurColumn To iColumn – 1
oShell.SendKeys “{RIGHT}”
Next J
Else
For J = iColumn To iCurColumn – 1
oShell.SendKeys “{LEFT}”
Next J
End If
Wait 50
iCurRow = GetTextBoxCursorRow(oTextBox) ‘当前行
iCurColumn = GetTextBoxCursorColumn(oTextBox) ‘目标行的当前列
‘Debug.Print iCurRow; iCurColumn
ERR_NORUNNING:
On Error GoTo 0
End Sub

设置窗体形状

Option Explicit
Public Declare Function CreateEllipticRgn Lib “GDI32” (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function SetWindowRgn Lib “user32” (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Public Declare Function CreatePolygonRgn Lib “GDI32” (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long

Public Type POINTAPI
X As Long
Y As Long
End Type

Public Sub RoundForm()
Dim hRgn As Long, lRes As Long
‘圆形窗体
hRgn = CreateEllipticRgn(30, 24, 456, 450)
lRes = SetWindowRgn(Me.hWnd, hRgn, True)
End Sub
Public Sub CrossForm()
Dim hRgn As Long, lRes As Long
Dim pNode() As POINTAPI
ReDim pNode(11) As POINTAPI
‘十字窗体
pNode(0).X = 156
pNode(0).Y = 42
pNode(1).X = 329
pNode(1).Y = 42
pNode(2).X = 329
pNode(2).Y = 154
pNode(3).X = 439
pNode(3).Y = 154
pNode(4).X = 439
pNode(4).Y = 317
pNode(5).X = 329
pNode(5).Y = 317
pNode(6).X = 329
pNode(6).Y = 429
pNode(7).X = 156
pNode(7).Y = 429
pNode(8).X = 156
pNode(8).Y = 317
pNode(9).X = 46
pNode(9).Y = 317
pNode(10).X = 46
pNode(10).Y = 154
pNode(11).X = 156
pNode(11).Y = 154
hRgn = CreatePolygonRgn(pNode(0), 12, 2)
lRes = SetWindowRgn(Me.hWnd, hRgn, True)
End Sub