Image and Multimedia handling (None Specified)
At 30 AUG 1999 08:20:04AM Jo Peoples wrote:
I am transferring an AREV app to OI and want to make some extensions to take advantage of the graphic interface. Sorry for the rather long posting: I am a first-timer (and not much of a code writer).
I have a table for 'Items'. Such an item sometimes is a 'set of photographs'. In the OI form for 'Items' there is a two column edit table in which can number each photograph in the set A, B, C, etc in the first column and provide a description of it in the second. In other words, each photograph in a set is identified by the item number (key) and an appended letter. Alongside each line of the edit table is a button which is called "Image A", "Image B", etc. The idea is that pressing this button produces the scanned image of the photograph.
Currently I have the buttons linked to another form (and table) along the lines described in "Storing Images in Linear Hash Tables" which I found in the knowledge-base. At the moment I have to enter the correct 'Item number' and append the letter to it (ie 62788A or 62788B, etc), then enter the correct path to the picture file. Obviously this is not very efficient or reliable. So my questions are:
1. How could I get automatically entered into the key field of the Image form a concatenation of the key value in the 'Item' form and the letter denoting the specific photograph (which together form the key of the image in the image table)? Ie: if I'm working on a record with the key 62788 and I click on the button "Image A", I want 62788A to appear in the key field of the image form.
2. To enter the path to the scanned image file I want to use the Open Dialog Box. I have applied the code as outlined in "Storing Images in Linear Hash Tables" in the knowledge base and this works fine. However, when I open the dialog box (by mistake, say) and then press 'cancel', the already existing entry gets wiped. Can I put in a line of code, that if I press Cancel, the entry in the "path to file" prompt gets left alone?
3. While OI can now deal with image formats other than only BMP (which is fine when calling an image as listed above) can you also turn other file formats into entities? When creating an image entity, the only choices still seem to be BMP or ICO.
4. Finally, is there a reasonably easy way to call other programs from within OI to play other multimedia? For instance, if an item is a video tape or an audio tape, could I set it up that by pressing a button in the 'Item' form I could load and play a (pre-processed, short) clip from that tape?
If all of the above seems like a long way to go around things and there are better ways to this, I'm all ears.
At 31 AUG 1999 10:37AM Stephen S. Revelation wrote:
Jo,
1) You could use the the following logic. Let's say you click on the 'A' image button of your key(#). On the Click event of the button you could do something such as the following:
declare subroutine set_property, char
declare function get_property
text=get_property(CtrlEntId,'TEXT')
length=len(text)
letter=textlength,1 *gets the last character of text on button (the letter)
wholevalue=@id:letter
set_property(@window:'.NAME','TEXT',wholevalue) *appends NAME/key field
RETURN 0
2) For this you put something like this on the CLICK event of a button calling the Open Dialog Box:
Declare Function Utility
oldBmpFile=get_property(@window:'.PICTURE','TEXT')
CFOpt="
CFOpt=0 ;* Open Mode
CFOpt=Bitmaps (*.bmp)/*.bmp/All Files (*.*)/*.*/"
getBmpFile=Utility("CHOOSEFILE" , @WINDOW , CFOpt)
set=Set_Property(@WINDOW : ".PICTURE" , "TEXT" , getBmpFile)
if getBmpFile=' then
set=Set_Property(@WINDOW : ".PICTURE" , "TEXT" , oldBmpFile)end
RETURN 0
3) I would refer to this posting for this question. Basically many types of image files are supported, only they are to be referenced through BITMAP entity types.
4) I would look at using the utility('RUNWIN', path) function to do something like this. There are a vast amount of references to this type of functionality on our website if you do a search for "utility and runwin".
Good Luck,
Stephen
At 31 AUG 1999 04:39PM Richard Bright wrote:
I have extracted some info from my knowledgebase:
Using utility function you can use following:
Media Player
Media Player (both the 16-bit MPLAYER.EXE and the 32-bit MPLAY32.EXE)
supports the following command-line syntax:
MPLAYER /play /close /embedding fileAll of the command-line switches and the file name are optional. Their
meanings are as follows:
/play play file right away/close close after playing (only valid with /play)/embedding run as an OLE serverfile file or device to openThis information was inadvertently omitted from the Windows
documentation.
Code to play .WAV files
* DLL Declaration in SYSPROCS MMSYSTEM SHORT PASCAL sndPlaySound(LPCHAR, SHORT) DECLARE FUNCTION sndPlaySound EQU SND_SYNC$ TO 0 EQU SND_ASYNC$ TO 2 EQU SND_NODEFAULT$ TO 2 EQU SND_LOOP$ TO 8 EQU SND_NONSTOP$ TO 16 MyPath=' WavFile=MyPath:'LAUGH.WAV':CHAR(0) ;* note that LPCHAR parameter value ;* is a null terminated ASCII string Picks up .WAV files from your default windows directory RetVal =sndPlaySound(Wavfile, SND_SYNCH$) * Return 0 void= Utility("RUNWIN","C:\WINDOWS\MMPLAYER.EXE C:\PATH\File.AVI" If the extension is registered. void= Utility("RUNWIN"," C:\PATH\File.AVI") though it also brings up the MMPlayer as well.
WinExec does take an nCmdShow parameter, set to 0 and that means hide. It should be available through RUNWIN.
Using Utility(RUNWIN',…… This method is the simplist using high level MPLAYER.EXE commands (which according to MS were inadvertantly left out of windows docs) Media Player (both the 16-bit MPLAYER.EXE and the 32-bit MPLAY32.EXE) supports the following command-line syntax: MPLAYER /play /close /embedding file All of the command-line switches and the file name are optional. Their meanings are as follows: /play play file right away /close close after playing (only valid with /play) /embedding run as an OLE server file file or device to open So in OI can be used as follows: RBasic code segment say a CLICK event off a Button Declare function Utility Location = 'D:\VIDPATH\" MM.Detail = 'DEMO.AVI' MPlayerSwitch = ' /PLAY /CLOSE ' ; * /play - starts video on loading; /close - closes player automatically after modality = -1 test= Utility ("RUNWIN","C:\WINDOWS\MPLAYER.EXE":MPlayerSwitch:Location:MM.Detail,modality,0,0) * Return 0
Note that the /play switch can be used by it's self or together as /play /close (in any order). With play switch the video is loaded (into MPLAYER) and plays immediately. With modality -1 the MPLAYER is not visible but control is available by dragging the cursor along the bottom of screen. /Close switch will cause the video to automatically close with controll returning to OI.
Two Dll methods Communicating with MCI Devices using MMSYSTEM.dl (please provide correction to get fully working…) You can communicate with MCI devices using messages or command strings. Messages are used directly by MCI; MCI converts command strings into messages that it then sends to the device handler. Use these functions to send messages or command strings to MCI, to get the ID assigned to a device, and to get a textual description of an MCI error: ie (.. an extract from a number of mci functions follows…) A. Using mciSendString —] Sends a command string to MCI. possible use (from MS help file) - mciSendString(?open file.avi?,0,0,0) mciSendString(?play file.avi?,0,0,0) mciSendString(?close file.avi?,0,0,0) JumpID(?Title.mvb]main?,?table_of_contents?) DLL_MMSYSTEM declarations
MMSYSTEM
SHORT PASCAL sndPlaySound(LPCHAR, SHORT)
LPCHAR PASCAL mciSendString(LPCHAR,LPCHAR,USHORT,USHORT) = 'DEMO.AVI'
Testing=mciSendString("OPEN ":Location:MM.Detail,0,0,0)
Testing=mciSendString("PLAY ":Location:MM.Detail,0,0,0)
Testing=mciSendString("CLOSE ":Location:MM.Detail,0,0,0)
*
Return 0
mciSendString
Syntax
DWORD mciSendString(lpstrCommand, lpstrReturnString, wReturnLength, hCallback)
This function sends a command string to an MCI device. The device that the command is sent to is specified in the command string.
Parameters
LPCSTR lpstrCommand
Specifies an MCI command string.
LPSTR lpstrReturnString
Specifies a buffer for return information. If no return information is needed, you can specify NULL for this parameter.
UINT wReturnLength
Specifies the size of the return buffer specified by lpstrReturnString.
HANDLE hCallback
Specifies a handle to a window to call back if "notify" was specified in the command string.
Return Value
Returns zero if the function was successful. Otherwise, it returns error information. The low-order word of the returned DWORD contains the error return value.
To get a textual description of mciSendString return values, pass the return value to mciGetErrorString.
B Using mciSendCommand –] Sends a command message to MCI. (this method offers more direct control)
(details are in MCI help file for WIN3.1 SDK). Functionality much same as above)
At 03 SEP 1999 09:39AM Jo Peoples wrote:
Stephen (and Richard)
I managed to solve 3 of the four problems, but am still stuck on this one. I can open another (MM) app by using Utility(RUNWIN) okay, but what I want to do (of course) is to pass different files to the apps. I found on your site the simple code below, but try as I might, I can't get it to work. If I leave "/play/close" out, as well as :avi,1 and replace the latter with ,"", everything works fine, except the file name does get passed to the app. which kind of defeats the purpose.
Declare subroutine Utility
param="
param=0;*open mode
param=AVI Files(*.avi)/*.avi/"
avi=utility("CHOOSEFILE",@WINDOW,param)
Utility("RUNWIN","mplayer.exe/play/close":avi,1)
(*Utility("RUNWIN",mplayer.exe","") works, but doesn't do the job I am after*)
RETURN 0
Any suggestions?
Jo
At 03 SEP 1999 09:54AM Oystein Reigem wrote:
Jo,
Utility("RUNWIN","mplayer.exe/play/close":avi,1)
Put a space after /close so the avi file name doesn't get glued to the /close option:
Utility("RUNWIN","mplayer.exe/play/close ":avi,1)
- Oystein -
At 06 SEP 1999 01:42AM Jo Peoples wrote:
Oystein
Thanks! And yes, putting a space behind 'close' fixed that problem, but I found out you also have to put a space between exe and /play and between /play and /close. I think it is not usually necessary in DOS to put a space between the command and the switch or between switches, but it is the only way I could get it to work. Ie:
]Utility("RUNWIN","mplayer.exe /play /close ":avi,1)
Jo