Last active
August 29, 2015 14:01
-
-
Save kumatti1/92c693c046eebf52f2d8 to your computer and use it in GitHub Desktop.
文字列連結
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <windows.h> | |
BOOL WINAPI DllMain( | |
_In_ HINSTANCE hinstDLL, | |
_In_ DWORD fdwReason, | |
_In_ LPVOID lpvReserved | |
) | |
{ | |
return TRUE; | |
} | |
BOOL WINAPI CRTfunc(LPWSTR *Buf,size_t cnt,BSTR arg1,BSTR arg2,BSTR arg3,BSTR arg4,BSTR arg5) | |
{ | |
UINT len = SysStringByteLen( arg1 ); | |
memcpy(*Buf, arg1, len); | |
LPWSTR p = *Buf+ SysStringLen ( arg1 ); | |
len = SysStringByteLen( arg2 ); | |
memcpy(p, arg2, len); | |
p = p+ SysStringLen ( arg2 ); | |
len = SysStringByteLen( arg3 ); | |
memcpy(p, arg3, len); | |
p = p+ SysStringLen ( arg3 ); | |
len = SysStringByteLen( arg4 ); | |
memcpy(p, arg4, len); | |
p = p+ SysStringLen ( arg4 ); | |
len = SysStringByteLen( arg5 ); | |
memcpy(p, arg5, len); | |
return TRUE; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LIBRARY CRT | |
EXPORTS | |
CRTfunc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Declare PtrSafe Function timeGetTime Lib "winmm.dll" () As Long | |
Private Declare PtrSafe Function CRTfunc Lib "CRT.DLL" ( _ | |
Buf As LongPtr, _ | |
ByVal cnt As LongPtr, _ | |
ByVal arg1 As LongPtr, _ | |
ByVal arg2 As LongPtr, _ | |
ByVal arg3 As LongPtr, _ | |
ByVal arg4 As LongPtr, _ | |
ByVal arg5 As LongPtr) As Long | |
Private Const s1 As String = "あいうえお" | |
Private Const s2 As String = "かきくけこ" | |
Private Const s3 As String = "さしすせそ" | |
Private Const s4 As String = "たちつてと" | |
Private Const s5 As String = "なにぬねの" | |
Private Const MAX_COUNT& = 1000000 | |
Sub hoge() | |
Dim t& | |
t = timeGetTime() | |
ChDrive ThisWorkbook.Path | |
ChDir ThisWorkbook.Path | |
Dim s$ | |
s = String$(255, 0) | |
Dim pp& | |
pp = StrPtr(s) | |
Dim cnt& | |
cnt = Len(s) | |
For i = 1 To MAX_COUNT | |
CRTfunc pp, cnt, StrPtr(s1), _ | |
StrPtr(s2), _ | |
StrPtr(s3), _ | |
StrPtr(s4), _ | |
StrPtr(s5) | |
Next | |
Debug.Print "(8)"; timeGetTime() - t | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment