Next: , Previous: Standard, Up: Extensions


1.8 Windows

— Constant: HKEY_CLASSES_ROOT
— Constant: HKEY_CURRENT_CONFIG
— Constant: HKEY_CURRENT_USER
— Constant: HKEY_DYN_DATA
— Constant: HKEY_LOCAL_MACHINE
— Constant: HKEY_USERS
— Constant: IDABORT
— Constant: IDCANCEL
— Constant: IDIGNORE
— Constant: IDNO
— Constant: IDOK
— Constant: IDRETRY
— Constant: IDYES
— Constant: MB_ABORTRETRYIGNORE
— Constant: MB_APPLMODAL
— Constant: MB_DEFBUTTON1
— Constant: MB_DEFBUTTON2
— Constant: MB_DEFBUTTON3
— Constant: MB_DEFBUTTON4
— Constant: MB_ICONASTERISK
— Constant: MB_ICONERROR
— Constant: MB_ICONEXCLAMATION
— Constant: MB_ICONHAND
— Constant: MB_ICONINFORMATION
— Constant: MB_ICONQUESTION
— Constant: MB_ICONSTOP
— Constant: MB_ICONWARNING
— Constant: MB_OK
— Constant: MB_OKCANCEL
— Constant: MB_RETRYCANCEL
— Constant: MB_SYSTEMMODAL
— Constant: MB_TASKMODAL
— Constant: MB_YESNO
— Constant: MB_YESNOCANCEL
— Constant: SW_HIDE
— Constant: SW_MAXIMIZE
— Constant: SW_MINIMIZE
— Constant: SW_RESTORE
— Constant: SW_SHOW
— Constant: SW_SHOWDEFAULT
— Constant: SW_SHOWMAXIMIZED
— Constant: SW_SHOWMINIMIZED
— Constant: SW_SHOWMINNOACTIVE
— Constant: SW_SHOWNA
— Constant: SW_SHOWNOACTIVATE
— Constant: SW_SHOWNORMAL
— Function: win_get_registry_key ($key,$subkey,[$entry=""])

Retrieve entry from the system registry entry pointed to by key, subkey

Parameters

key [constant]
One of the predefined HKEY_* constants.
subkey [string]
A string specifying the path of the key.
entry [string]
The specific entry to retrieve. If it is not specified, the default entry is used.

Return Value [mixed]

The specified key, or false if not found.

Example

          $wallpaper = win_get_registry_key(HKEY_CURRENT_USER, "Control Panel\\Desktop", "Wallpaper");
     
— Function: win_getlasterror ()

Return a string from the operating system containing a description of the last error that occured.

Return Value [string]

String containing the error message.

Example

          $msg = win_getlasterror();
          echo "Windows said: $msg";
     
— Function: win_messagebox ($text,$caption,[$type=NULL])

Display a popup message box to the user.

Parameters

text [string]
The text to show in the popup window.
caption [string]
The caption of the popup window.
type [int]
Flags that affect the type of message box shown. This argument should be created from the MB_ constants, binary OR'd together.

Return Value [int]

The return value will depend on the type flags passed to the message box. The value will match one of the ID_* constants, depending on which button the user clicked on to close the message box.

Example

          $ret = win_messagebox('This is the test of the messagebox','Box Caption',MB_YESNOCANCEL|MB_ICONINFORMATION);
          echo "ret was $ret
          ";
          switch ($ret) {
              case IDYES:
                  win_messagebox('You pressed Yes','Good');
                  break;
              case IDNO:
                  win_messagebox('You pressed No', 'Bad');
                  break;
              case IDCANCEL:
                  win_messagebox('You pressed Cancel', 'Indifferent');
                  break;
          }
     
— Function: win_set_registry_key ($key,$subkey,[$entry=""],[$value=""])

Set entry in system key key, subkey in the system registry.

Parameters

key [constant]
One of the predefined HKEY_* constants
subkey [string]
A string specifying the path of the key
entry [string]
The specific entry to write to. If it is not specified, the default entry is used
value [string]
The new value for the specified registry key. If it is not passed, the specified key will be removed.

Return Value [bool]

true on success or false on failure

Example

          win_set_registry_key(HKEY_LOCAL_MACHINE,
                               "SOFTWARE\Super Software Company\ActiveProduct\".
                               "1.0"
                               "my-integer",
                               25);
     
— Function: win_shellexecute ($operation,$file,[$params=NULL],[$workdir=NULL],[$showcmd=NULL])

Perform an operation on the specified file, such as opening a web browser to a URL or opening Notepad on a text file.

Parameters

operation [string]
The action to be performed. It may be any of the following strings:
'edit'
Launches an editor and opens the document for editing.
'explore'
Explores the folder specified by file.
'find'
Initiates a search starting from the specified directory.
'open'
Opens the file specified by file. The file can be an executable file, a document file, or a folder.
'print'
Prints the document file specified by file. If file is not a document file, the function will fail.

file [string]
The file on which to execute the verb.
params [string]
If file is an executable file, params will be passed as parameters when the file is executed.
workdir [string]
The default working directory.
showcmd [constant]
Flags that specify how the application is displayed when it is opened. These should be one or more of the SW_* constants binary OR'd together.

Return Value [int]

A value greater than 32 if successful, or an error value that is less than or equal to 32 otherwise.

Example

          // launch a web browser
          $ret = win_shellexecute('open','http://www.google.com', '', '', SW_SHOWMAXIMIZED);
          echo "return: $ret\n";
     

For more information, see the Microsoft API.