R:Folks,
What a wonderful way to unveil an un-documented feature of R:BASE 7.6, C/S:I
7.6 and Turbo V-8 for Windows.
Mike, thanks for your perseverance, and your untiring and countless efforts,
to work with the members of R:Dream Team to implement this very cool feature
in R:BASE.
I sincerely appreciate all you do for R:BASE Technologies and the R:BASE
Community.
May every current user of R:BASE find this useful!
Very Best R:egards,
Razzak.
P.S.
Now that the cat is out of the bag, more technical documents and sample
applications will be available soon.
================================================================================
Originally posted by Mike Byerley on RBG7-L list 06:49 PM 12/17/2007
================================================================================
Razzak is giving you this Christmas present a little early. I did a
demonstration of this at the Conference and some of the code is on the Zip
Drive everyone got, but in the short time (I know Bill, I ran over a little
bit) available, l was not able to get into the meat of what RBTI has done to
expand the power of RBase even further.
There are hundreds of times the things come up just as Jeffrey and Javier had
today.
Even though they seemed like desparate issues, they had a commonality
in how to
get from RBase to another source in a seamless fashion.
Just for simplicity here, I am going to show Jeffrey how to solve his issue
easily and painlessly, as RBTI has done the pain part already by bearing with
me for the past year to make this kind of stuff a reality.
There is a Windows API function GetEnvironmentVariable that returns the value
of the variable requested. If you work in Windows, you will use the
definitive
resource on the planet for Windows, the MSDN Library.
http://msdn2.microsoft.com/en-us/library/default.aspx
so here is the Code for this issue only. It will require a longer technical
paper to describe exactly what and how a bit protracted for an email. When
that is ready, we'll first put it up at RBTI DEV resources, then the help
files. In a nutshell, we can Load external DLLs once in code and then call
functions from them after declaring them just ONCE in the session, just as if
they were a part of RBase. That part will be in the technical paper. If the
function is a part of the Windows API, and the arguments and return values are
of the same structure (byte) as RBase datatypes, the API can be used without
Loading, since ALL the Windows API is already running as part of the OS. We
only need to DECLARE it once in the RBase Session. The only caveat
is that the
ORDER of the arguments to a function are REVERSED because the technology
employed reads the arguments off the STACK in a LastInFirstOut order So the
Declaration for the function mentioned above will look like this:
STDCALL function 'GetEnvironmentVariableA' alias 'GetEnvironmentVariable' +
(integer, ptr text, ptr text) : integer
and the standard C++ declaration looks like this:
DWORD WINAPI GetEnvironmentVariable(
__in_opt LPCTSTR lpName,
__out_opt LPTSTR lpBuffer,
__in DWORD nSize
);
This declaration should be in a Startup location as is appropriate to your
application. You can declare as many as you like, but don't declare any you
are not going to use.
I'm not going to explain the "ALIAS" or the PTR or any of that stuff in this
missive. That will be in the technical paper. This is just to show you what
you have available to you in 7.6 and 8.0 TODAY...
Then in the application do the following:
SET VAR vret INTEGER = 0
SET VAR vin TEXT = 'path'
SET VAR vout TEXT = ''
SET VAR vsize INTEGER = 1499
SET VAR vret = (dlcall('Kernel32', 'GetEnvironmentVariableA', vsize, vout,
vin))
the vOUT variable will now contain the value of the enironment variable
described in vIN and vRet has the length of the string. We have to set vSize
to some size great enough to hold the returned string. It hurts
nothing to set
it to the RBase max size for TEXT.
Notice that the Calling Keyword "DLCall" is the new RBase function to make it
work and further that the order of the arguments is reversed from the C++
example above.
Also, ANY of these functions that are declared this way can be used in
expressions and in database commands INLINE just like normal RBase functions.
There is no penalty like RBGUDF.exe.
I thank RBTI, Razzak, Alex, and Alexsey for tolerating me to help
bring this to
reality.
That's all for Today.. Merry Christmas to Jeffrey and of course to
all. I have
a little time available so it won't be too long for an in depth
examination and
explanation of this along with examples.
In the examples, I will try to show how I accidentally stumbled onto how to do
Ole Automation Line By Line with one little helper DLL.
================================================================================
--- RBASE-L
================================================
TO POST A MESSAGE TO ALL MEMBERS:
Send a plain text email to [email protected]
(Don't use any of these words as your Subject:
INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: INTRO
================================================
TO UNSUBSCRIBE:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: UNSUBSCRIBE
================================================
TO SEARCH ARCHIVES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: SEARCH-n
(where n is the number of days). In the message body,
place any
text to search for.
================================================