diff options
author | Siep Kroonenberg <siepo@cybercomm.nl> | 2011-05-15 19:22:45 +0000 |
---|---|---|
committer | Siep Kroonenberg <siepo@cybercomm.nl> | 2011-05-15 19:22:45 +0000 |
commit | abd1c463b3283d9822a1d7ff8da2f9ef169edb65 (patch) | |
tree | 80569dada1aac464c128b9efb50464f0ec27d5f0 /Build | |
parent | 0dc1831510c7e76deab33e5fd5eb97ec4651be5e (diff) |
Tl-tray-menu: example custom menu and message box to explain custom menu
git-svn-id: svn://tug.org/texlive/trunk@22484 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/texlive/w32_wrapper/tl-tray-menu.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/Build/source/texk/texlive/w32_wrapper/tl-tray-menu.c b/Build/source/texk/texlive/w32_wrapper/tl-tray-menu.c index 7aeef3e704d..b848b223898 100644 --- a/Build/source/texk/texlive/w32_wrapper/tl-tray-menu.c +++ b/Build/source/texk/texlive/w32_wrapper/tl-tray-menu.c @@ -49,6 +49,10 @@ char ExeList[5][MAX_PATH] = { "" }; +int CustomHowMessageBox() +{ +} + LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { switch ( msg ) @@ -66,6 +70,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) AppendMenu( hPopMenu, MF_STRING, MENU_COMSPEC, "&Command Prompt" ); if ( ExeList[MENU_CUSTOM][0] ) AppendMenu( hPopMenu, MF_STRING, MENU_CUSTOM, "Custom &Script" ); + else AppendMenu( hPopMenu, MF_SEPARATOR, 0, NULL ); AppendMenu( hPopMenu, MF_STRING, MENU_EXIT, "E&xit" ); } @@ -95,10 +100,23 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) case MENU_TEXDOC: case MENU_EDITOR: case MENU_COMSPEC: - case MENU_CUSTOM: if ( _spawnlp( _P_NOWAIT, ExeList[LOWORD(wParam)], NULL ) < 0 ) DIE( "Failed to start: %s", ExeList[LOWORD(wParam)] ); break; + case MENU_CUSTOM: + if ( GetFileAttributes( ExeList[LOWORD(wParam)] ) != INVALID_FILE_ATTRIBUTES ) + { + if ( _spawnlp( _P_NOWAIT, ExeList[LOWORD(wParam)], NULL ) < 0 ) + DIE( "Failed to start: %s", ExeList[LOWORD(wParam)] ); + } + else + MessageBox( + NULL, + "For a custom menu, create tl-tray-menu-custom.bat \nin the root of the installation.\nSee sample at tlpkg\\installer\\tl-tray-menu-custom.bat.", + "Custom menu", + MB_ICONINFORMATION + ); + break; case MENU_EXIT: Shell_NotifyIcon( NIM_DELETE, &nid ); @@ -129,7 +147,7 @@ int APIENTRY WinMain( if ( !nchars || ( nchars == MAX_PATH ) ) DIE( "cannot get own path" ); if ( s = strrchr( selfdir, '\\' ) ) *s = '\0'; // remove file name part - // prepend bin/win32 to PATH + // append bin/win32 to PATH static char buffer[MAX_CMD]; strcpy( buffer, selfdir ); @@ -155,7 +173,9 @@ int APIENTRY WinMain( strcpy( buffer, selfdir ); strcat( buffer, "\\tl-tray-menu-custom.bat" ); - if ( GetFileAttributes( buffer ) != INVALID_FILE_ATTRIBUTES ) + // if ( GetFileAttributes( buffer ) != INVALID_FILE_ATTRIBUTES ) + // At call time, we test for this file and display + // a message box if it is missing. strncpy( ExeList[4], buffer, MAX_PATH ); // create a hidden window for messaging |