Function SelUnite(ByVal nID1 As HWND, ByVal nID2 As HWND, ByRef AfterUnion As String) As Long
Dim ByteLen1 As DWord
Dim ByteLen2 As DWord
Dim buffer1 As BytePtr
Dim buffer2 As BytePtr
Dim Data As String
ByteLen1=GetWindowTextLength(nID1)
ByteLen2=GetWindowTextLength(nID2)
buffer1=malloc(ByteLen1+1)
buffer2=malloc(ByteLen2+1)
GetWindowText(nID1,buffer1,ByteLen1+1)
GetWindowText(nID2,buffer2,ByteLen2+1)
Data=lstrcat(buffer1,buffer2)
free(buffer1)
free(buffer2)
If Data="" Then
SelUnite=0
Exit Function
End If
SelUnite=1
AfterUnion=Data
End Function
Function StringUnion(ByVal hDlg1 As DWord, ByVal nID1 As Long, ByVal hDlg2 As DWord, ByVal nID2 As Long, ByRef Union As String) As Long
StringUnion=SelUnite(GetDlgItem(hDlg1,nID1),GetDlgItem(hDlg2,nID2),Union) As Long
End Function
Sub MainWnd_CommandButton1_Click()
Dim hEdit1 As HWND
Dim hEdit2 As HWND
Dim StringData As String
hEdit1=GetDlgItem(hMainWnd,EditBox1)
hEdit2=GetDlgItem(hMainWnd,EditBox2)
SelUnite(hEdit1,hEdit2,StringData)
MessageBox(hMainWnd,StringData,"結果",0)
End Sub
Function SelUnite(ByVal nDlgItem1 As HWND,ByVal nDlgItem2 As HWND,ByRef AfterUnion As String) As BOOL
Dim lpStr[2] As LPSTR
Dim length[1] As Long
length[0]=GetWindowTextLength(nDlgItem1)
length[1]=GetWindowTextLength(nDlgItem2)
lpStr[0]=calloc(length[0]+1)
lpStr[1]=calloc(length[1]+1)
lpStr[2]=calloc(length[0]+length[1]+1)
GetWindowText(nDlgItem1,lpStr[0],length[0]+1)
GetWindowText(nDlgItem2,lpStr[1],length[1]+1)
memcpy(lpStr[2],lpStr[0],length[0])
memcpy(lpStr[2]+length[0],lpStr[1],length[1])
If lpStr[2][0]=0 Then
SelUnite=FALSE
Else
SelUnite=TRUE
AfterUnion=MakeStr(lpStr[2])
End If
free(lpStr[0])
free(lpStr[1])
free(lpStr[2])
End Function
Function SelUnite(ByVal nID1 As HWND, ByVal nID2 As HWND, ByRef AfterUnion As String) As Long
Dim ByteLen1 As DWord
Dim ByteLen2 As DWord
Dim buffer1 As BytePtr
Dim buffer2 As BytePtr
Dim Data As String
ByteLen1=GetWindowTextLength(nID1)
ByteLen2=GetWindowTextLength(nID2)
buffer1=malloc(ByteLen1+1)
buffer2=malloc(ByteLen2+1)
GetWindowText(nID1,buffer1,ByteLen1+1)
GetWindowText(nID2,buffer2,ByteLen2+1)
Data=lstrcat(buffer1,buffer2)
free(buffer1)
free(buffer2)
If Data="" Then
SelUnite=0
Exit Function
End If
SelUnite=1
AfterUnion=Data
End Function
Function SelUnite(ByVal nID1 As HWND, ByVal nID2 As HWND, ByRef AfterUnion As String) As Long
Dim ByteLen1 As DWord
Dim ByteLen2 As DWord
Dim buffer1 As BytePtr
Dim buffer2 As BytePtr
Dim Data As String
ByteLen1=GetWindowTextLength(nID1)
ByteLen2=GetWindowTextLength(nID2)
buffer1=malloc(ByteLen1+1)
buffer2=malloc(ByteLen2+1)
GetWindowText(nID1,buffer1,ByteLen1+1)
GetWindowText(nID2,buffer2,ByteLen2+1)
Data=lstrcat(buffer1,buffer2)
free(buffer1)
free(buffer2)
If Data="" Then
SelUnite=0
Exit Function
End If
SelUnite=1
AfterUnion=Data
End Function