home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
vp21beta.zip
/
OEXMPSRC.RAR
/
OBJCLASS
/
NEWOBJ.PAS
< prev
Wrap
Pascal/Delphi Source File
|
2000-08-15
|
2KB
|
70 lines
{█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█}
{█ █}
{█ Virtual Pascal Examples Version 2.1 █}
{█ NEWOBJ example █}
{█ ─────────────────────────────────────────────────█}
{█ Copyright (C) 1995-2000 vpascal.com █}
{█ █}
{▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀}
{$I-,D-,Use32+}
{ Attempts to creates a new object on the desktop, fails, }
{ and tries again. }
Program NewObj;
Uses
Os2Def, Os2PmApi;
{$PMTYPE VIO}
Const
Parameters = 'EXENAME=E.EXE;STARTUPDIR=C:\;PARAMETERS=CONFIG.SYS';
Var
hObj : HObject;
Anchor : hAB;
ErrId : ErrorID;
begin
{ Get Anchor handle of this process to get error information }
Anchor := WinInitialize(0);
{ Try to create a program object on the desktop }
hObj := WinCreateObject( 'WPPROGRAM', { Object Type }
'VP Test Object', { Object Name }
Parameters, { Parameters }
'On the OS/2 desktop', { Invalid Location }
CO_ReplaceIfExists ); { Options }
{ If hObj is 0, an error occurred }
If hObj = 0 then
begin
{ Get the error id and severity }
ErrId := WinGetLastError( Anchor );
{ Write error message }
Writeln( 'Error creating new object on desktop!' );
Writeln( ' Error Severity is ', ErrId shr 16 );
Writeln( ' Error Code is ', ErrId and $FFFF );
Writeln;
{ Try again }
Writeln( 'Retrying...');
hObj := WinCreateObject( 'WPPROGRAM', { Object Type }
'VP Test Object', { Object Name }
Parameters, { Parameters }
'<WP_DESKTOP>', { Location }
CO_ReplaceIfExists ); { Options }
{ If hObj is 0, an error occurred }
If hObj = 0 then
Writeln( 'Another error occurred.' )
else
Writeln( 'VP Test Object created succesfully!' );
end
else
Writeln( 'VP Test Object created succesfully...?' );
end.