Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • Last Modified:

Undocumented functions

I saw mention of the VarPtr and StrPtr here. Anyone got a list of other hidden functions. Especially a function to tell vb where a variable is.
0
chris_a
Asked:
chris_a
  • 11
  • 8
1 Solution
 
ESICommented:
VarAdr, AddressOf, ProcPtr, aso
0
 
chris_aAuthor Commented:
ESI,

Are these guesses, none of these (except addressof which is not hidden) do anything in VB5.0 SP3. Is 'aso' a typo for also?

If they do something on your VB please post an small eg.
0
 
zsiCommented:
chris,

ESI's answer is, in fact, a guess.  The only "undocumented" functions in VB5 are VarPtr, StrPtr, and ObjPtr.  AddressOf is a documented function.  A quick look through the VB documentation or help file illustrates this.

Please let me know if you have any other questions.

Hope this helps!
zsi
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
chris_aAuthor Commented:
How do you know there are no other functions, I will keep this open a bit longer and I will try out the ObjPtr function.

If the programmers of VB put in a function to get a pointer, then there may be functions to set the address of a function, maybe peek and poke work also.


0
 
zsiCommented:
I know that there are no other functions for three reasons:

First, I have personally examined the exported function list of VB and VBA;

Second, there have been several articles on undocumented functions and these are the only ones that have been cited;

Third, I know one of the people who wrote VB.

You cannot set the address of a function (why would you want to?) and there is no such thing as peek and poke.  You can only work within the memory space of your own application as doing otherwise would cause a General Protection Fault, an intentional feature of the Windows operating system.

Is there any reason that you are tyring to relocate functions within VB?
0
 
zsiCommented:
If your mind is really set on trying to move functions around, you can use AddressOf to determine the address of a function, and then try using the RtlMoveMemory API function in Kernel32.

I don't recommend it, tho.
0
 
zsiCommented:
If your mind is really set on trying to move functions around, you can use AddressOf to determine the address of a function, and then try using the RtlMoveMemory API function in Kernel32.

I don't recommend it, tho.
0
 
zsiCommented:
As I spend more time thinking about this (and taking a peek at your bio), I think I might have an idea of what you are looking for.

By any chance, are you considering trying virtual-functions or redirection in VB?  If so, I can tell you where to look for information on it.

zsi
0
 
chris_aAuthor Commented:
Well thats not quite right, there are other functions yet to be found, for instance what does the 'MacScript' function do?

I have no particular aim in this question, except I like to get under the hood a little.

I use the Move/Fill mem functions all over the place, they are reliable and fast (so long as you remember to use byval with strings). Most of the programming I do is where VB is the front end to C modules that pass binary structures around sockets and pipes.

Your missing the point a little trying to 'answer' this, i'll pass the point on to you later if you like.
0
 
zsiCommented:
MacScript executes an AppleScript script.  The following information is from the Visual Basic Language Reference:

---------------------------------------------------------------------------------------
MacScript Function

Description

Executes an AppleScript script and returns a value returned by the script, if any.

Syntax

MacScript script

The script argument is a String expression. The String expression either can be a series of AppleScript commands or can specify the name of an AppleScript script or a script file.

Remarks

Multiline scripts can be created by embedding carriage-return characters (Chr(13)).

See Also

Chr Function.

Example

This example uses the MacScript function to open the Choose File dialog box (the Macintosh standard-file dialog). The full path of the file chosen by the user is returned. If appropriate, the path specification is preceded by the type of the file.

ThePath$ = Macscript("ChooseFile")
0
 
zsiCommented:
As far as Peeking and Poking, you can check out SoftCircuit's VB-ASM. http://www.beadsandbaubles.com/coolvb/download/vbasm.zip

It is a DLL that provides some of the low-level functionality that you are looking for.  In addition to reading/writing memory, it will allow you to get to some of the internal structures in VB, conduct bit-level operations, call interrupts, create controls and more.

The library is free.
0
 
chris_aAuthor Commented:
Any more suggestions anybody

(PS why is everyone so obsessed with the points, what can you do with them?)
0
 
zsiCommented:
Well, for one thing, the points encourage people to spend time that would otherwise be spent on more enjoyable things (such as root canal) answering questions such as this one.

Additionally, the points assist us in our neverending pursuit for world domination, high-fashion, chicks seem to dig them, wealth, fame, power, the knowledge that we are helping people and the satisfaction of a job well done.

It also permits us to guage our progress and to assert our claims that, perhaps, we do know what we are talking about.

Mostly, however, the points are a reward for our volunteering our time.

Abe Froeman


0
 
chris_aAuthor Commented:
So thats what the points are for, shame they dont seem to transfer into points you can use to ask questions.

ZSI, the redirection and virtual functions sound good.

I would like to have the option to allocate a chunk of memory and put what I want where I want in it. When passing a struct to C I would like to be sure that the alignments are correct (like pragma pack in MSVC).

I know VB has collections now, but they are no match for a hand crafted ring buffer. I know this stuff is best done in C, but I hate typing all the spaghetti (or wading thru wizard code) before you can write any code.

0
 
zsiCommented:
There are trade-offs with any language.  VB gives you the ability to develop an application at a very (abnormally) quick rate.  You sacrifice certain functionality for that ability, however.  For the most part, memory management is left to the VB run-time.

Using the Windows API, you do have some measure of control (see VirtualAlloc and HeapAlloc), but the API cannot really be considered part of VB.  

Another trade-off is control over the execution of your application.  Yes, you can now use the AddressOf operator to control your own application, but you are still limited in what you can do with it.  And you can forget about subclassing other applications using native VB.

Still, 98% of the time, a business application does not need this advanced functionality.  My experience has been that VB is a good language for business application development.

Given the mindset of most business users (I want it yesterday) who don't understand the issues involved in developing an application of any size, I am more than willing to trade flexibility for decreased development time.

However, I still use C for my graphical programming (though I am leaning towards Symantec's Native Java more and more).
0
 
chris_aAuthor Commented:
ZSI Post another answer, and i'll grade it a pass
0
 
zsiCommented:
The best way to determine what (if any) hidden functions might exist in VB, use the Object Browser to examine the run-time library.  Just remember to set the option to Show Hidden members.

zsi
0
 
chris_aAuthor Commented:
Never found the hidden fx option in browser before, I shall hack some more now, TA
0
 
zsiCommented:
It's in the context menu.
0
 
chris_aAuthor Commented:
Found it, TA.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 11
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now