English help on website



Hidemaru_GetTotalTextUnicode(Ver9.24対応版)
目次DLL側から秀丸エディタの関数呼び出し− Hidemaru_GetTotalTextUnicode
Hidemaru_GetTotalTextUnicode関数
HGLOBAL WINAPI Hidemaru_GetTotalTextUnicode( void );

テキスト全体のメモリ確保して返します。
HGLOBALのハンドルはGlobalFreeで解放する必要があります。
メモリ確保に失敗したときはNULLを返します。


例:マクロ側
loaddll @"C:\Folder\Test.dll";
#a = dllfunc("DllFuncTest",hidemaruhandle(0));
endmacro;

例:DLL側
#include <windows.h>

extern "C" __declspec( dllexport )
INT_PTR _cdecl DllFuncTest( INT_PTR nHwnd ) {
    HINSTANCE hinstExe = GetModuleHandle( NULL );
    HGLOBAL (WINAPI* pfnHidemaru_GetTotalTextUnicode)( void );
    (FARPROC&)pfnHidemaru_GetTotalTextUnicode = GetProcAddress( hinstExe, "Hidemaru_GetTotalTextUnicode" );
    
    if( pfnHidemaru_GetTotalTextUnicode ) {
        HGLOBAL hGlobal = pfnHidemaru_GetTotalTextUnicode();
        if( hGlobal ) {
            WCHAR* pwsz = (WCHAR*)GlobalLock( hGlobal );
            if( wcslen( pwsz ) >= 500 ) {
                pwsz[500] = '\0';
            }
            MessageBoxW( (HWND)nHwnd, pwsz, L"全体のテキスト(500文字上限)", MB_OK );
            GlobalUnlock( hGlobal );
            GlobalFree( hGlobal );
        }
    }
    
    return 0;
}

参照:
Hidemaru_GetTotalTextUnicode
hidemaru.getTotalText
gettotaltext