サンプル(Ver8.91対応版)
目次DLL側から秀丸エディタの関数呼び出し− サンプル
#include <windows.h>

extern "C" __declspec( dllexport )
INT_PTR DllFuncTest( INT_PTR nHwnd ) {
	HINSTANCE hinstExe = GetModuleHandle( NULL );
	HGLOBAL (WINAPI* pfnHidemaru_GetTotalTextUnicode)( void );
	HGLOBAL (WINAPI* pfnHidemaru_GetLineTextUnicode)( int nLineNo );
	BOOL (WINAPI* pfnHidemaru_GetCursorPosUnicode)( int* pnLineNo, int* pnColumn );
	BOOL (WINAPI* pfnHidemaru_CheckQueueStatus)( void );
	*(FARPROC*)&pfnHidemaru_GetTotalTextUnicode = GetProcAddress( hinstExe, "Hidemaru_GetTotalTextUnicode" );
	*(FARPROC*)&pfnHidemaru_GetLineTextUnicode = GetProcAddress( hinstExe, "Hidemaru_GetLineTextUnicode" );
	*(FARPROC*)&pfnHidemaru_GetCursorPosUnicode = GetProcAddress( hinstExe, "Hidemaru_GetCursorPosUnicode" );
	*(FARPROC*)&pfnHidemaru_CheckQueueStatus = GetProcAddress( hinstExe, "Hidemaru_CheckQueueStatus" );
	
	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 );
		}
	}
	if( pfnHidemaru_GetLineTextUnicode
	 && pfnHidemaru_GetCursorPosUnicode
	 ) {
		int nLineNo = 0;
		int nColumn = 0;
		BOOL f = pfnHidemaru_GetCursorPosUnicode( &nLineNo, &nColumn );
		HGLOBAL hGlobal = pfnHidemaru_GetLineTextUnicode( nLineNo );
		if( hGlobal ) {
			WCHAR* pwsz = (WCHAR*)GlobalLock( hGlobal );
			MessageBoxW( (HWND)nHwnd, pwsz + nColumn, L"カーソル行のカーソル位置以降のテキスト", MB_OK );
			GlobalUnlock( hGlobal );
			GlobalFree( hGlobal );
		}
	}
	
	if( pfnHidemaru_CheckQueueStatus ) {
		if( MessageBoxW( (HWND)nHwnd, L"画面左上に中断状態を表示します", L"Hidemaru_CheckQueueStatus", MB_OKCANCEL ) == IDOK ) {
			DWORD dwTick = GetTickCount();
			HDC hdc = GetDC(0);
			BOOL fStop = FALSE;
			WCHAR* pwsz = L"○5秒待機中 ";
			TextOutW( hdc, 0, 0, pwsz, (int)wcslen( pwsz ) );
			while( GetTickCount() < (dwTick + 5000) ) {
				fStop = pfnHidemaru_CheckQueueStatus();
				if( fStop ) {
					break;
				}
				Sleep( 30 );
			}
			if( fStop ) {
				pwsz = L"●中断しました ";
			} else {
				pwsz = L"○中断せず終了 ";
			}
			TextOutW( hdc, 0, 0, pwsz, (int)wcslen( pwsz ) );
			ReleaseDC(0,hdc);
		}
	}
	
	return 0;
}