|
|
LboxDlg *Dlg;
LboxTool *Tool;
LRESULT CALLBACK About( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
switch( message ) {
case WM_INITDIALOG:
Dlg = new LboxDlg( hDlg );
Tool = new LboxTool( );
return TRUE;
case WM_COMMAND:
if( LOWORD(wParam) == IDCANCEL ) {
Dlg->End( LOWORD(wParam) );
delete Tool;
delete Dlg;
}
break;
}
return FALSE;
}
| |
|
|
|
|
// *********************************************************
// 外部プログラムの実行
// 戻り値 : true 成功, false 失敗
// szCurDirectory が必要無い場合は NULL を指定する
// *********************************************************
BOOL LboxTool::Execute( LPTSTR szCommand, LPTSTR szCurDirectory )
{
return LboxExecute(
szCommand,
szCurDirectory
);
}
BOOL LboxTool::Execute( LboxString *LstrCommand, LboxString *LstrCurDir )
{
if ( LstrCurDir == NULL ) {
return LboxExecute(
LstrCommand->szLboxString,
NULL
);
}
else {
return LboxExecute(
LstrCommand->szLboxString,
LstrCurDir->szLboxString
);
}
}
| |
|
LboxExecute
|
|
|
// *********************************************************
// 実行中のプログラムが存在するディレクトリ
// 戻り値 : 無し
// パスは二重引用符で挟まれません
// *********************************************************
void LboxTool::ProgramDirectory( LPTSTR szDirectory )
{
LboxGetProgramDirectory( szDirectory );
}
| |
|
LboxGetProgramDirectory
|
|
|
// *********************************************************
// WM_CREATE に書くダイアログのみのアプリケーション用
// 戻り値 : -1
// *********************************************************
LRESULT LboxTool::OnlyDialog( HWND hWnd, LPCTSTR lpTemplate, DLGPROC lpFunc )
{
return LboxOnlyDialog( hWnd, lpTemplate, lpFunc );
}
| |
|
LboxOnlyDialog
|
|
|
// *********************************************************
// デスクトップのウインドウハンドルの取得
// 戻り値 : デスクトップのウインドウハンドル
// *********************************************************
HWND LboxTool::Desktop( void )
{
return GetDesktopWindow( );
}
| |
|
|
|
|
// *********************************************************
// デスクトップの幅
// 戻り値 : デスクトップの幅
// *********************************************************
int LboxTool::DesktopWidth( void )
{
RECT rt;
HWND hWnd;
hWnd = GetDesktopWindow( );
GetWindowRect( hWnd, &rt );
return rt.right;
}
| |
|
|
|
|
// *********************************************************
// デスクトップの高さ
// 戻り値 : デスクトップの高さ
// *********************************************************
int LboxTool::DesktopHeight( void )
{
RECT rt;
HWND hWnd;
hWnd = GetDesktopWindow( );
GetWindowRect( hWnd, &rt );
return rt.bottom;
}
| |
|
|
|
|
// *********************************************************
// クリップボードへテキストをコピー
// 戻り値 : 成功 true, 失敗 false
// *********************************************************
BOOL LboxTool::CopyClipboard( LPTSTR szData )
{
return LboxCopyClipboard( szData );
}
| |
|
LboxCopyClipboard
|
|
|
// *********************************************************
// 実行中のプログラムのフルパスを取得する
// 戻り値 : 無し
// パスは二重引用符で挟まれません
// *********************************************************
void LboxTool::ProgramPath( LPTSTR szPath )
{
LboxGetProgramPath( szPath );
}
| |
|
LboxGetProgramPath
|
|
|
// *********************************************************
// 実行中のプログラムファイル名( パス無し )
// 戻り値 : 無し
// パスは二重引用符で挟まれません
// *********************************************************
void LboxTool::ProgramFileName( LPTSTR szFileName )
{
LboxGetProgramFileName( szFileName );
}
| |
|
LboxGetProgramFileName
|
|
|
// *********************************************************
// TABキーを押した事にする
// 戻り値 : 無し
// *********************************************************
void LboxTool::TabKey( void )
{
keybd_event( VK_TAB, 0, 0, 0 );
}
| |
|
|
|
|
// *********************************************************
// PrintScreenキーを押した事にする
// 戻り値 : 無し
// *********************************************************
void LboxTool::PrintScreenKey( BOOL bActive )
{
if ( bActive ) {
keybd_event( VK_SNAPSHOT, 1, 0, 0 );
}
else {
keybd_event( VK_SNAPSHOT, 0, 0, 0 );
}
}
| |
|
|
|
|
// *********************************************************
// シフトキーの状態
// 戻り値 : true 押されている, false 押されていない
// *********************************************************
BOOL LboxTool::IsShift( void )
{
WORD nRet;
nRet = (WORD)GetKeyState( VK_SHIFT );
if( nRet & 0x1000 ) {
return true;
}
return false;
}
| |
|
|
|
|
// *********************************************************
// CTRLキーの状態
// 戻り値 : true 押されている, false 押されていない
// *********************************************************
BOOL LboxTool::IsCtrl( void )
{
WORD nRet;
nRet = (WORD)GetKeyState( VK_CONTROL );
if( nRet & 0x1000 ) {
return true;
}
return false;
}
| |
|
|
|
|
// *********************************************************
// ALTキーの状態
// 戻り値 : true 押されている, false 押されていない
// *********************************************************
BOOL LboxTool::IsAlt( void )
{
WORD nRet;
nRet = (WORD)GetKeyState( VK_MENU );
if( nRet & 0x1000 ) {
return true;
}
return false;
}
| |
|
|
|
|
// *********************************************************
// 砂時計カーソルの設定
// 戻り値 : 無し
// *********************************************************
void LboxTool::WaitCursor( BOOL bFlg )
{
if ( bFlg ) {
SetCursor( LoadCursor( NULL, IDC_WAIT ) );
}
else {
SetCursor( LoadCursor( NULL, IDC_ARROW ) );
}
}
| |
|
|
|
|
DWORD LboxTool::ExecuteAndWaitInputIdle(
LPTSTR szCommand, LPTSTR szCurDirectory
)
{
return LboxExecuteAndWaitInputIdle(
szCommand,
szCurDirectory
);
}
DWORD LboxTool::ExecuteAndWaitInputIdle(
LboxString *LstrCommand, LboxString *LstrCurDir
)
{
if ( LstrCurDir == NULL ) {
return LboxExecuteAndWaitInputIdle(
LstrCommand->szLboxString,
NULL
);
}
else {
return LboxExecuteAndWaitInputIdle(
LstrCommand->szLboxString,
LstrCurDir->szLboxString
);
}
}
| |
|
|
|
|
// *********************************************************
// 実行中断
// 戻り値 : 無し
// *********************************************************
void LboxTool::Sleep( DWORD dwMilliseconds )
{
::Sleep( dwMilliseconds );
}
| |
|
|
ExecuteAndGetWindowHandle |
|
|
HWND LboxTool::ExecuteAndGetWindowHandle(
LPTSTR szCommand, LPTSTR szClassName, LPTSTR szCurDirectory
)
{
return LboxExecuteAndGetWindowHandle(
szCommand,
szClassName,
szCurDirectory
);
}
| |
|
|
|
|
// *********************************************************
// Shell 再起動
// 戻り値 : 無し
// *********************************************************
void LboxTool::ShellReboot( void )
{
HWND hShell;
hShell = FindWindow( "Progman", NULL );
if ( hShell != NULL ) {
PostMessage( hShell, WM_QUIT, 0L, 0L );
WinExec( "Explorer.exe", SW_SHOW );
}
}
| |
|
|
|
|
// *********************************************************
// インターネットファイルのダウンロード
// 戻り値 : 無し
// *********************************************************
BOOL LboxTool::URLDownload( LboxString *LUrl, LboxString *LPath )
{
return LboxTool::URLDownload(
LUrl->szLboxString,
LPath->szLboxString
);
}
typedef HRESULT (__stdcall *LPFUNC)(
LPUNKNOWN,
LPCSTR,
LPCSTR,
DWORD,
LPBINDSTATUSCALLBACK
);
BOOL LboxTool::URLDownload( LPTSTR lpUrl, LPTSTR lpPath )
{
HINSTANCE lib;
lib = LoadLibrary( "urlmon.dll" );
if ( lib == NULL ) {
return false;
}
LPFUNC DllURLDownloadToFile;
DllURLDownloadToFile = (LPFUNC)GetProcAddress( lib, "URLDownloadToFileA" );
if ( DllURLDownloadToFile == NULL ) {
FreeLibrary( lib );
return false;
}
HRESULT hRet;
hRet = DllURLDownloadToFile(
NULL,
lpUrl,
lpPath,
0,
NULL
);
FreeLibrary( lib );
if ( hRet == S_OK ) {
return true;
}
return false;
}
| |
|
|
|