* Name.........: SHLABOUT.PRG * Compil.......: MKRAD SHLABOUT * Aim..........: Shows how to wrap and reach the Win32 API SHellAbout() function * directly from NTK's embedded dll call commands * Date.........: 10.03.2006 * Author(s)....: Jn Dechereux * Copyright : (c) 2006 - Jn DECHEREUX. Tous droits r‚serv‚s/All Rights Reserved. ******************************************************************************** // Usage: // ShellAbout( hWnd, cTitleBarText, cInboxText, hIncon ) -> nRet ( 1=Success OR 0=fail ) // // Have look to Win32 SDK HLP file // OR // MSDN WebSite at : // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp // // -- Manifest Windows XP //#define ISOLATION_AWARE_ENABLED 1 // remove remarks if you want fancy XP Theme buttons. #include "windows.ch" #include "ntkcctrl.ch" #include "ntkgdi.ch" #include "ntkmsg.ch" #include "ntkacc.ch" #include "ntkcmd.ch" #include "wNtk.ch" #include "wNtkKeys.ch" #include "ntkbtn.ch" #include "ntkimg.ch" #include "ntkdll.ch" #define ID_BTN0 8000 #define ID_BTN1 8001 #define CR CHR(13) FUNCTION MAIN() LOCAL hWndDemo LOCAL cWinTitle := "NTK Demo of Win32 ShellAbout() function..." PRIVATE aBtnList := {} // Do not forget it! CREATE WINDOW hWndDemo ; TITLE cWinTitle ; // Minimum declaration AT 0,0 SIZE 550,300 ; Style WS_SYSMENU ; // We just want the close Btn ON PAINT DoRePaint() ; ON EXIT DoExit() @ 180,150 BUTTON "Click &Here (F1)" SIZE 40,250 ; ID ID_BTN1 ; SUPER ACCEL KEY K_F1 ; ACTION DoShAbout(hWndDemo) ; STATE NTK_BT_ENABLE ; FONT NTK_GetStockObject(SYSTEM_FONT) ; MESSAGE "Click here or press F1 key to see the ShellAbout dialog box..." ; OF hWndDemo ACTIVATE WINDOW hWndDemo NORMAL // Display window AUTO HANDLE EVENTS OF WINDOW hWndDemo USING ; // Start background processing BUTTON LIST aBtnList CLOSE WINDOW hWndDemo RETURN ****** ****** ****** FUNCTION DoExit(hWnd, message, nwParam, nlParam) IF NTK_MsgBox( hWnd,; "Do you really want to quit ?",; "ShellAbout Demo",; MB_OKCANCEL+MB_ICONQUESTION ) == IDOK //NTK_PostQuitMessage(0) // tell OS to terminate the application. Do not forget! //RETURN(.T.) // Quit RETURN( NTK_SendQuitEvent() ) // Same as both to previous lines : Terminate current app. ENDIF RETURN(.F.) // Do not quit, keep on current task ****** ****** ****** FUNCTION DOREPAINT(hWnd, message, nwParam, nlParam, hDC) //------ Old Style/fashion way to code ... more xBase-console like // Note that we can also use/mix Windows enhanced capabilities if // more power is needed... SET COLOR TO R+/W+ @ 080,050 SAY "How to reach Win32 ShellAbout() function using NTK's DLL commands..." ; INTO CONTEXT hDC ; SIZE 30,450 ; STYLE DT_CENTER+DT_VCENTER RETURN Nil ****** ****** ****** FUNCTION DOSHABOUT(hWnd) local nShellAbout nShellAbout := ShellAbout( hWnd,; "FIRST PART (Title bar Text)#SECOND PART (String to be placed after M$ TradeMark)",; "THIS IS THE INBOX TEXT."+CR+; "Note: Only about 2 lines of text can be inserted....",; NTK_LoadIcon(Nil, IDI_EXCLAMATION) ) IF nShellAbout != 1 NTK_MsgBox( hWnd, NTK_GetLastError(), "ERROR" ) ELSE NTK_MsgBox( hWnd, STR(nShellAbout), "The call to ShellAbout() returns :" ) ENDIF RETURN(Nil) ****** ****** ****** ****** ****** ShellAbout() WRAPPER. ****** Usage : ShellAbout( hWnd, cTitleBarText, cInboxText, hIcon ) -> nRet ( 1=Success OR 0=fail ) ****** Inluded: In Shell32.DLL ****** // --------- NTK declaration style... Declare function ShellAbout Lib Shell32.ShellAboutA ; ( hWnd As HWND, cApp As string, cOtherStuff As string, hIcon As HICON ) AS int // The folowing syntaxe works same as the above. Do not hesitate to try it ! // It has been created for NTK's backward compatibility with 16 bit Clip4Win apps. // Just Look at NTKDLL.CH for further details... // --------- C4W like declaration style... // _DLL function ShellAbout(hWnd AS HWND ,; // cApp AS string,; // cOtherStuff AS string,; // hIcon AS HICON) AS int Pascal:Shell32.ShellAboutA ****** ****** ******