Hi,

I have an extension that includes code to use the common dialog boxes
provided by Win32, explicitly a call to GetOpenFileName().
This is intended for use in command line PHP scripts for selecting files to
work on etc.

Under PHP 4.1.1 this worked fine, the open file dialog boxes would work
perfectly.  Since upgrading to 4.3.3, it has now stopped working.

The basic function which shows this problem is as follows:

ZEND_FUNCTION(test_open_file_box)
{
 OPENFILENAME ofn;

 char *filename = new char[3000];
 filename[0] = '\0';
 char *filter = new char[2000];
 filter[0] = '\0';
 char *title = new char[2000];
 title[0] = '\0';

 ofn.lStructSize = sizeof(ofn);
 ofn.hwndOwner = NULL;
 ofn.hInstance = NULL;
 ofn.lpstrFilter = filter;
 ofn.lpstrCustomFilter = NULL;
 ofn.nMaxCustFilter = 0;
 ofn.nFilterIndex = 0;
 ofn.lpstrFile = filename;
 ofn.nMaxFile = 2999;
 ofn.lpstrFileTitle = NULL;
 ofn.nMaxFileTitle = 0;
 ofn.lpstrInitialDir = NULL;
 ofn.lpstrTitle = title;
 ofn.Flags = OFN_FILEMUSTEXIST;
 ofn.nFileOffset = 0;
 ofn.nFileExtension = 0;
 ofn.lpstrDefExt = NULL;
 ofn.lCustData = NULL;
 ofn.lpfnHook = NULL;
 ofn.lpTemplateName = NULL;

 BOOL bResult = ::GetOpenFileName(&ofn);

 DWORD dwLastError = CommDlgExtendedError();

 if (bResult)
 {
  RETURN_TRUE;
 }
 else
 {
  RETURN_LONG(dwLastError);
 }
}


This has been stripped down to the bare essentials that show this problem.
If a script is then written to call this function, under PHP 4.1.1 a Win32
dialog box appears.  Under PHP 4.3.3 nothing appears but you do see an icon
for the dialog box in the task list you get when pressing ALT-TAB, you then
have to kill php to do anything else.

This occurs when running the script using either the CLI or CGI executables.
However the strange thing is when I run the script through Apache using PHP
as a module (and the Apache service set to 'Allow interaction with the
Desktop') the dialog box appears correctly.

I've been struggling with this for a few days now, if anybody knows why this
would have stopped working please help!


Thanks
Pete Dishman

PS. (It's a C++ PHP extension, and I'm running on Win2000)

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to