BTW, the API declarations are only for reference to compare to the RBase declaration STDCALL. The segment in braces (comments) can be removed.
----- Original Message ----- From: "MikeB" <[EMAIL PROTECTED]> To: "RBASE-L Mailing List" <[email protected]> Sent: Wednesday, August 06, 2008 2:53 PM Subject: [RBASE-L] - Re: Silent LAUNCH command. > Alastair, > I am sorry I was late to the dance and didn't see what you were trying to do. > There are two APIs, both callable from RBase using The DLCALL function that > will likely be less troublesome. So we should just do it directly using the > following Win32 declarations as a guide: > > This one is going to return a BOOL, which will likely match up with an RBase > INTEGER as zero (FALSE) or non zero (TRUE). > > *(BEGIN CODE) > { > > http://msdn.microsoft.com/en-us/library/aa365535(VS.85).aspx > > BOOL WINAPI SetFileAttributes( > __in LPCTSTR lpFileName, > __in DWORD dwFileAttributes > ); > > http://msdn.microsoft.com/en-us/library/aa364944(VS.85).aspx > DWORD WINAPI GetFileAttributes( > __in LPCTSTR lpFileName > ); > > Attrib Values: > FILE_ATTRIBUTE_ARCHIVE = 32 > FILE_ATTRIBUTE_COMPRESSED = 2048 > FILE_ATTRIBUTE_DEVICE = 64 > FILE_ATTRIBUTE_DIRECTORY = 16 > FILE_ATTRIBUTE_ENCRYPTED = 16384 > FILE_ATTRIBUTE_HIDDEN = 2 > FILE_ATTRIBUTE_NORMAL = 128 > FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 8192 > FILE_ATTRIBUTE_OFFLINE = 4096 > FILE_ATTRIBUTE_READONLY = 1 > FILE_ATTRIBUTE_REPARSE_POINT = 1024 > FILE_ATTRIBUTE_SPARSE_FILE = 512 > FILE_ATTRIBUTE_SYSTEM = 4 > FILE_ATTRIBUTE_TEMPORARY = 256 > FILE_ATTRIBUTE_VIRTUAL = 65536 > } > > IF (chkfunc('SetFileAttributes')) = 0 THEN > STDCALL function 'SetFileAttributesA' ALIAS 'SetFileAttributes' + > (Integer, ptr TEXT (256)) : Integer > ENDIF > > IF (chkfunc('GetFileAttributes')) = 0 THEN > STDCALL function 'GetFileAttributesA' ALIAS 'GetFileAttributes' + > (ptr TEXT (256)) : Integer > ENDIF > SET VAR v1 Integer = NULL > SET VAR v2 Integer = NULL > SET VAR sfilename TEXT = 'F:\Rb76\DLProj\hold.txt' > > -- Set To FILE_ATTRIBUTE_NORMAL to REMOVE AlL ATTRIBUTES > SET VAR vattrib Integer = 128 > -- After setting to FILE_ATTRIBUTE_NORMAL you then APPLY the Attribute > -- Combination you desire using the combinations from the list above > > SET VAR v1 = (dlcall('Kernel32', 'GetFileAttributes', sfilename)) > { > example, if vi has a value of 35 this would mean the attributes are a > combination of the values listed above that equal 35 total which would be: > FILE_ATTRIBUTE_ARCHIVE + FILE_ATTRIBUTE_HIDDEN + FILE_ATTRIBUTE_READONLY > } > > SET VAR v2 = (dlcall('Kernel32', 'SetFileAttributes', vattrib, sfilename)) > > SET VAR v1 = (dlcall('Kernel32', 'GetFileAttributes', sfilename)) > RETURN > > > *(END CODE) > ----- Original Message ----- > From: "Alastair Burr" <[EMAIL PROTECTED]> > To: "RBASE-L Mailing List" <[email protected]> > Sent: Wednesday, August 06, 2008 11:28 AM > Subject: [RBASE-L] - Re: Silent LAUNCH command. > > > ----------------------------Mike - success and failure! > > My RMD file runs fine in R:Base and with no errors in trace but nothing > happens. > > I have copied and pasted my version of what you posted along with the BAT > file > that is supposed to be run. You'll notice some comments of mine which I added > as I was working through. I've left them as they are since they seem as good > a > way of any of explaining where I've got to and gone wrong. > > Any further help will be muchly appreciated. > > *( FileName: AttribChange.RMD ... ... Date of last amendment: 06/08/2008 ) > *( Run a batch file with parameters in silent mode ) > { > ShellExecute.rmd example by Mike Byerley > The Windows API declaration of Shellexecute: > HINSTANCE ShellExecute( HWND hwnd, > LPCTSTR lpOperation, > LPCTSTR lpFile, > LPCTSTR lpParameters, > LPCTSTR lpDirectory, > INT nShowCmd > ); > Syntax located at: > http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx > } > -- --------------------------------------------------------------------------- > -- Pre-define all variable types to null: > -- --------------------------------------------------------------------------- > SET VAR nShowCmd INTEGER = NULL > SET VAR lpDirectory TEXT = NULL > SET VAR lpParameters TEXT = NULL > SET VAR lpFile TEXT = NULL > SET VAR lpOperation TEXT = NULL > SET VAR HWND INTEGER = NULL > SET VAR vRetVal INTEGER = NULL -- not used? > -- SET VAR vi INTEGER = NULL ?? > > -- --------------------------------------------------------------------------- > -- Set variable values: > -- --------------------------------------------------------------------------- > SET VAR vTestParams TEXT = 'D: -H -R' -- Variable parameters to be passed in > later... > SET VAR nShowCmd = 0 -- SW_HIDE > SET VAR lpDirectory = NULL -- Full path in lpFile (Repeated - DELETE?) > SET VAR lpFile = 'C:\DosPrograms\Attrib.BAT' > SET VAR lpParameters = .vTestParams > SET VAR lpOperation = 'open' > SET VAR HWND = 0 -- since it runs hidden, pass HWND as null > SET VAR vRetVal = NULL -- (Repeated - vi ??) > > -- --------------------------------------------------------------------------- > -- Process: > -- --------------------------------------------------------------------------- > IF (chkfunc('ShellExecuteA')) = 0 THEN > STDCALL function 'ShellExecuteA' ALIAS 'ShellExecute' + > (Integer, ptr TEXT (256), ptr TEXT (128), + > ptr TEXT (128), ptr TEXT (32), Integer) : Integer > ENDIF > > -- STDCALL part of DLCALL (DLLCALL in help link from CHKFUNC!)?? > SET VAR vi = (dlcall('shell32.dll', 'ShellExecuteA', + > nShowCmd, lpDirectory, lpParameters, lpFile, lpOperation, HWND)) > -- consistantly returns 42 - implying success (>32) Should this be vRetVal? > > -- --------------------------------------------------------------------------- > -- Tidy-up and return/exit: > -- --------------------------------------------------------------------------- > LABEL lEnd > CLEAR VAR nShowCmd, lpDirectory, lpParameters, lpFile, lpOperation, HWND, > vRetVal, vi > RETURN > *( End of program ) > > > Attrib.BAT: > > rem @ECHO OFF > rem Parameters: > rem First = DriveColon - C: D: etc > rem Second = +H or -H > rem Third = +R or -R > rem > rem eg: C:\DosPrograms\Attrib.BAT D: +H +R > rem > rem CLS > rem ECHO. > rem ECHO. > rem ECHO Re-Setting attributes... > rem the above are a bit pointless if it's invisible anyway! > > %1 > CD \ALMANAC > ATTRIB %2 *.* /S > CD _VIEWER > ATTRIB %3 *.* > C: > EXIT > > > > > Regards, > Alastair > > ---------------------------- > Alastair Burr > St. Albans, UK. > [EMAIL PROTECTED] > ----------------------------- > > >

