A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Need Entry Point 18 Help On Access Executable File



 
 
Thread Tools Display Modes
  #1  
Old July 4th, 2004, 06:16 AM
Jeff Conrad
external usenet poster
 
Posts: n/a
Default Need Entry Point 18 Help On Access Executable File

Hi,

Using Access 97 at the moment.
This is the last piece of the puzzle to complete a personal project.
Everything else checks out except for this problem. I'm using some Access 97
wizard code and trying to make it compatible with 2000, 2002, and 2003. The
97 code references entry point 18 for something which cannot be found in the
later versions. Ok fine, but I'm just going bonkers trying to figure out
what *exactly* it is doing!

In the declaration area of one of the modules there is this one line:

Declare Function wlib_HscrOpenEx Lib "msaccess.exe" Alias "#18" (ByVal
lpszScript As String, ByVal lpszLabel As Any, ByVal smode As Long, pgrfExtra
As Long, psmv As Long) As Long

One of the functions in the same module starts off like this:

Public Function wlib_CGetExecutableMacros(db As DAO.Database,
rgstExeMacros() As String) As Integer

Inside this function is a line like this:

hscr = wlib_HscrOpenEx(stMacroName, 0&, 0&, grfExtra, lMacVersion)

I believe this function is getting a list of all the macros, but are there
different "types" of macros??
The very last line of the above mentioned function has this:

wlib_CGetExecutableMacros = iMac - 1

Stepping through the code reveals a count of the macros in the current
database just before the function exits. Now I'm pretty sure I can make some
code to get a list of all the macros as well as one to get a count, but my
problem is getting this to work *within* the confines of the other existing
functions! I've stepped ALL over this code and I'm just getting more
confused.

I realize this is a difficult concept to grasp, but if anyone sees something
obvious I'd be most interested in hearing your thoughts. I can point you to
a Microsoft download file for 97 which illustrates everything as well.

Thanks for any help,

--
Jeff Conrad
Access Junkie
Bend, Oregon


  #2  
Old July 4th, 2004, 07:35 AM
M.L. Sco Scofield
external usenet poster
 
Posts: n/a
Default Need Entry Point 18 Help On Access Executable File

Happy belated b'day Jeff.

Don't you ever sleep?

Last piece? Sure...

I just made copies of all of the "viewable" code and am taking them home.

I'm walking out the door for the rest of the weekend and won't be back until
Tuesday morning.

I'll take a look at it when I get board watching TV, making some updates to
my web site, and working on a couple of new ASP pages this weekend.

If someone doesn't get back to you sooner, I should have something for you
on Tuesday. Maybe.

Go to bed.

Have a safe 4th.

Later...

Sco

"Jeff Conrad" wrote in message
...
Hi,

Using Access 97 at the moment.
This is the last piece of the puzzle to complete a personal project.
Everything else checks out except for this problem. I'm using some Access

97
wizard code and trying to make it compatible with 2000, 2002, and 2003.

The
97 code references entry point 18 for something which cannot be found in

the
later versions. Ok fine, but I'm just going bonkers trying to figure out
what *exactly* it is doing!

In the declaration area of one of the modules there is this one line:

Declare Function wlib_HscrOpenEx Lib "msaccess.exe" Alias "#18" (ByVal
lpszScript As String, ByVal lpszLabel As Any, ByVal smode As Long,

pgrfExtra
As Long, psmv As Long) As Long

One of the functions in the same module starts off like this:

Public Function wlib_CGetExecutableMacros(db As DAO.Database,
rgstExeMacros() As String) As Integer

Inside this function is a line like this:

hscr = wlib_HscrOpenEx(stMacroName, 0&, 0&, grfExtra, lMacVersion)

I believe this function is getting a list of all the macros, but are there
different "types" of macros??
The very last line of the above mentioned function has this:

wlib_CGetExecutableMacros = iMac - 1

Stepping through the code reveals a count of the macros in the current
database just before the function exits. Now I'm pretty sure I can make

some
code to get a list of all the macros as well as one to get a count, but my
problem is getting this to work *within* the confines of the other

existing
functions! I've stepped ALL over this code and I'm just getting more
confused.

I realize this is a difficult concept to grasp, but if anyone sees

something
obvious I'd be most interested in hearing your thoughts. I can point you

to
a Microsoft download file for 97 which illustrates everything as well.

Thanks for any help,

--
Jeff Conrad
Access Junkie
Bend, Oregon




  #3  
Old July 4th, 2004, 02:30 PM
Fred Boer
external usenet poster
 
Posts: n/a
Default Need Entry Point 18 Help On Access Executable File

Haven't got a cluewhat the heck you are talking about, but I hope you (and
all your fellow Americans...) have a great 4th of July!

Fred


"Jeff Conrad" wrote in message
...
Hi,

Using Access 97 at the moment.
This is the last piece of the puzzle to complete a personal project.
Everything else checks out except for this problem. I'm using some Access

97
wizard code and trying to make it compatible with 2000, 2002, and 2003.

The
97 code references entry point 18 for something which cannot be found in

the
later versions. Ok fine, but I'm just going bonkers trying to figure out
what *exactly* it is doing!

In the declaration area of one of the modules there is this one line:

Declare Function wlib_HscrOpenEx Lib "msaccess.exe" Alias "#18" (ByVal
lpszScript As String, ByVal lpszLabel As Any, ByVal smode As Long,

pgrfExtra
As Long, psmv As Long) As Long

One of the functions in the same module starts off like this:

Public Function wlib_CGetExecutableMacros(db As DAO.Database,
rgstExeMacros() As String) As Integer

Inside this function is a line like this:

hscr = wlib_HscrOpenEx(stMacroName, 0&, 0&, grfExtra, lMacVersion)

I believe this function is getting a list of all the macros, but are there
different "types" of macros??
The very last line of the above mentioned function has this:

wlib_CGetExecutableMacros = iMac - 1

Stepping through the code reveals a count of the macros in the current
database just before the function exits. Now I'm pretty sure I can make

some
code to get a list of all the macros as well as one to get a count, but my
problem is getting this to work *within* the confines of the other

existing
functions! I've stepped ALL over this code and I'm just getting more
confused.

I realize this is a difficult concept to grasp, but if anyone sees

something
obvious I'd be most interested in hearing your thoughts. I can point you

to
a Microsoft download file for 97 which illustrates everything as well.

Thanks for any help,

--
Jeff Conrad
Access Junkie
Bend, Oregon




  #4  
Old July 4th, 2004, 07:46 PM
Jeff Conrad
external usenet poster
 
Posts: n/a
Default Need Entry Point 18 Help On Access Executable File

"M.L. Sco Scofield"

Hi Sco,

Happy belated b'day Jeff.


Thanks.

Don't you ever sleep?


Yes, but remember I'm a couple of hours behind you so it wasn't too late.
Now if I look at your posted time, who is the one not sleeping?
g

Last piece? Sure...


Trust me, it is. I'm 99% sure. Everything else seems to be just fine under
2000, 2002, and 2003. Naturally I was quite disappointed by discovering this
problem since everything else was just clicking away.
:-(
If there is one thing I'm good at, it's testing things!

I just made copies of all of the "viewable" code and am taking them home.


The only one you actually need is the Wzmain80.mde file found he

http://support.microsoft.com/?id=151196

Here are the things to look for:
1. Look in the wlib_Util2 module for the entry point 18 reference in the
Declarations area.

2. Then find the function called wlib_CGetExecutableMacros in the same
module. Put a breakpoint right at the beginning of this function. This is
the ONLY spot this entry point is used.

3. The function gets called from the following form:
sbm_frmEditSbItem
It only happens when you select "Run Macro" from the Command combo box. The
Argument combo box will then fill with a list of all macro names. If you
step through the code it goes all over the place! So the trouble I'm having
is devising a custom function that will do the same thing, but within the
confines of all the over stuff going on! If I can get this to work under
Access 2000, 2002, and 2003 then the project will be finally finished.

I'm walking out the door for the rest of the weekend and won't be back

until Tuesday morning.

I'll take a look at it when I get bored watching TV, making some updates

to
my web site, and working on a couple of new ASP pages this weekend.


If someone doesn't get back to you sooner, I should have something for you
on Tuesday. Maybe.


No problem, I would be most gracious for any help you could provide.

Go to bed.


Yes, Dad.
;-)

Have a safe 4th.


Thanks, you too.

--
Jeff Conrad
Access Junkie
Bend, Oregon

"Jeff Conrad" wrote in message
...
Hi,

Using Access 97 at the moment.
This is the last piece of the puzzle to complete a personal project.
Everything else checks out except for this problem. I'm using some

Access
97
wizard code and trying to make it compatible with 2000, 2002, and 2003.

The
97 code references entry point 18 for something which cannot be found in

the
later versions. Ok fine, but I'm just going bonkers trying to figure out
what *exactly* it is doing!

In the declaration area of one of the modules there is this one line:

Declare Function wlib_HscrOpenEx Lib "msaccess.exe" Alias "#18" (ByVal
lpszScript As String, ByVal lpszLabel As Any, ByVal smode As Long,

pgrfExtra
As Long, psmv As Long) As Long

One of the functions in the same module starts off like this:

Public Function wlib_CGetExecutableMacros(db As DAO.Database,
rgstExeMacros() As String) As Integer

Inside this function is a line like this:

hscr = wlib_HscrOpenEx(stMacroName, 0&, 0&, grfExtra, lMacVersion)

I believe this function is getting a list of all the macros, but are

there
different "types" of macros??
The very last line of the above mentioned function has this:

wlib_CGetExecutableMacros = iMac - 1

Stepping through the code reveals a count of the macros in the current
database just before the function exits. Now I'm pretty sure I can make

some
code to get a list of all the macros as well as one to get a count, but

my
problem is getting this to work *within* the confines of the other

existing
functions! I've stepped ALL over this code and I'm just getting more
confused.

I realize this is a difficult concept to grasp, but if anyone sees

something
obvious I'd be most interested in hearing your thoughts. I can point you

to
a Microsoft download file for 97 which illustrates everything as well.

Thanks for any help,

--
Jeff Conrad
Access Junkie
Bend, Oregon






  #5  
Old July 4th, 2004, 07:52 PM
Jeff Conrad
external usenet poster
 
Posts: n/a
Default Need Entry Point 18 Help On Access Executable File

"Fred Boer" wrote

Hi Fred,

Haven't got a clue what the heck you are talking about,


You can follow along if you wish by reviewing my response to Sco.
:-)

but I hope you (and all your fellow Americans...) have a great 4th of July!


Thanks.

--
Jeff Conrad
Access Junkie
Bend, Oregon

"Jeff Conrad" wrote in message
...
Hi,

Using Access 97 at the moment.
This is the last piece of the puzzle to complete a personal project.
Everything else checks out except for this problem. I'm using some

Access
97
wizard code and trying to make it compatible with 2000, 2002, and 2003.

The
97 code references entry point 18 for something which cannot be found in

the
later versions. Ok fine, but I'm just going bonkers trying to figure out
what *exactly* it is doing!

In the declaration area of one of the modules there is this one line:

Declare Function wlib_HscrOpenEx Lib "msaccess.exe" Alias "#18" (ByVal
lpszScript As String, ByVal lpszLabel As Any, ByVal smode As Long,

pgrfExtra
As Long, psmv As Long) As Long

One of the functions in the same module starts off like this:

Public Function wlib_CGetExecutableMacros(db As DAO.Database,
rgstExeMacros() As String) As Integer

Inside this function is a line like this:

hscr = wlib_HscrOpenEx(stMacroName, 0&, 0&, grfExtra, lMacVersion)

I believe this function is getting a list of all the macros, but are

there
different "types" of macros??
The very last line of the above mentioned function has this:

wlib_CGetExecutableMacros = iMac - 1

Stepping through the code reveals a count of the macros in the current
database just before the function exits. Now I'm pretty sure I can make

some
code to get a list of all the macros as well as one to get a count, but

my
problem is getting this to work *within* the confines of the other

existing
functions! I've stepped ALL over this code and I'm just getting more
confused.

I realize this is a difficult concept to grasp, but if anyone sees

something
obvious I'd be most interested in hearing your thoughts. I can point you

to
a Microsoft download file for 97 which illustrates everything as well.

Thanks for any help,

--
Jeff Conrad
Access Junkie
Bend, Oregon



  #6  
Old July 6th, 2004, 09:33 AM
Terry Kreft
external usenet poster
 
Posts: n/a
Default Need Entry Point 18 Help On Access Executable File

Jeff,
I think that all your interested in from the point of view of this function
is that it returns a count of macros.

You can get this in a number of ways such as
currentdb.Containers("scripts").Documents.Count

or running a query against MSysObjects (Select count * from MsysObjects
Where type = -32766)

There is a slight problem in that when objects are deleted their
documents.count doesn't refresh properly nor does MsysObjects drop it's
record until the database is closed and reopened, but then all this means is
that the combo may have a blank line or two at the bottom.



--
Terry Kreft
MVP Microsoft Access



"Jeff Conrad" wrote in message
...
Hi,

Using Access 97 at the moment.
This is the last piece of the puzzle to complete a personal project.
Everything else checks out except for this problem. I'm using some Access

97
wizard code and trying to make it compatible with 2000, 2002, and 2003.

The
97 code references entry point 18 for something which cannot be found in

the
later versions. Ok fine, but I'm just going bonkers trying to figure out
what *exactly* it is doing!

In the declaration area of one of the modules there is this one line:

Declare Function wlib_HscrOpenEx Lib "msaccess.exe" Alias "#18" (ByVal
lpszScript As String, ByVal lpszLabel As Any, ByVal smode As Long,

pgrfExtra
As Long, psmv As Long) As Long

One of the functions in the same module starts off like this:

Public Function wlib_CGetExecutableMacros(db As DAO.Database,
rgstExeMacros() As String) As Integer

Inside this function is a line like this:

hscr = wlib_HscrOpenEx(stMacroName, 0&, 0&, grfExtra, lMacVersion)

I believe this function is getting a list of all the macros, but are there
different "types" of macros??
The very last line of the above mentioned function has this:

wlib_CGetExecutableMacros = iMac - 1

Stepping through the code reveals a count of the macros in the current
database just before the function exits. Now I'm pretty sure I can make

some
code to get a list of all the macros as well as one to get a count, but my
problem is getting this to work *within* the confines of the other

existing
functions! I've stepped ALL over this code and I'm just getting more
confused.

I realize this is a difficult concept to grasp, but if anyone sees

something
obvious I'd be most interested in hearing your thoughts. I can point you

to
a Microsoft download file for 97 which illustrates everything as well.

Thanks for any help,

--
Jeff Conrad
Access Junkie
Bend, Oregon




  #7  
Old July 6th, 2004, 09:01 PM
M.L. Sco Scofield
external usenet poster
 
Posts: n/a
Default Need Entry Point 18 Help On Access Executable File

Inline...

Sco

"Jeff Conrad" wrote in message
...
"M.L. Sco Scofield"

Hi Sco,

Happy belated b'day Jeff.


Thanks.

Don't you ever sleep?


Yes, but remember I'm a couple of hours behind you so it wasn't too late.


Where are you?


Now if I look at your posted time, who is the one not sleeping?
g


I'm noctornal. It was the middle of my day. :-)


Last piece? Sure...


Trust me, it is. I'm 99% sure. Everything else seems to be just fine under
2000, 2002, and 2003. Naturally I was quite disappointed by discovering

this
problem since everything else was just clicking away.
:-(


Well, I found the 1%. :-)


If there is one thing I'm good at, it's testing things!


Good!


I just made copies of all of the "viewable" code and am taking them

home.

The only one you actually need is the Wzmain80.mde file found he


I knew that. After I got them all home.


http://support.microsoft.com/?id=151196

Here are the things to look for:
1. Look in the wlib_Util2 module for the entry point 18 reference in the
Declarations area.

2. Then find the function called wlib_CGetExecutableMacros in the same
module. Put a breakpoint right at the beginning of this function. This is
the ONLY spot this entry point is used.


Yup.


3. The function gets called from the following form:
sbm_frmEditSbItem
It only happens when you select "Run Macro" from the Command combo box.

The
Argument combo box will then fill with a list of all macro names.


Yup.


If you
step through the code it goes all over the place!


Not really. :-) It only went 3 or 4 routines deep. I write stuff that goes
deeper than that.


So the trouble I'm having
is devising a custom function that will do the same thing, but within the
confines of all the over stuff going on! If I can get this to work under
Access 2000, 2002, and 2003 then the project will be finally finished.


Details in another posting.


I'm walking out the door for the rest of the weekend and won't be back

until Tuesday morning.

I'll take a look at it when I get bored watching TV, making some updates

to
my web site, and working on a couple of new ASP pages this weekend.


If someone doesn't get back to you sooner, I should have something for

you
on Tuesday. Maybe.


No problem, I would be most gracious for any help you could provide.


Wait until you read my novel. :-)


Go to bed.


Yes, Dad.
;-)


LOL!


Have a safe 4th.


Thanks, you too.


Thanks. I did.

--
Jeff Conrad
Access Junkie
Bend, Oregon

snip


  #8  
Old July 6th, 2004, 09:02 PM
M.L. Sco Scofield
external usenet poster
 
Posts: n/a
Default Need Entry Point 18 Help On Access Executable File

Thank you Fred.

Sco

"Fred Boer" wrote in message
...
Haven't got a cluewhat the heck you are talking about, but I hope you (and
all your fellow Americans...) have a great 4th of July!

Fred

snip


  #9  
Old July 6th, 2004, 09:05 PM
M.L. Sco Scofield
external usenet poster
 
Posts: n/a
Default Need Entry Point 18 Help On Access Executable File

Inline...

Sco

"Terry Kreft" wrote in message
...
Jeff,
I think that all your interested in from the point of view of this

function
is that it returns a count of macros.


Sorry Terry. It actually does much more. For the details, see the novel I
posted back to Jeff.


You can get this in a number of ways such as
currentdb.Containers("scripts").Documents.Count

or running a query against MSysObjects (Select count * from MsysObjects
Where type = -32766)

There is a slight problem in that when objects are deleted their
documents.count doesn't refresh properly nor does MsysObjects drop it's
record until the database is closed and reopened, but then all this means

is
that the combo may have a blank line or two at the bottom.



--
Terry Kreft
MVP Microsoft Access

snip


  #10  
Old July 6th, 2004, 09:13 PM
M.L. Sco Scofield
external usenet poster
 
Posts: n/a
Default Need Entry Point 18 Help On Access Executable File - The Novel

Jeff,

Below is the "novel" that I wrote over the weekend before I saw your post to
me on the 4th.

You already know some of the things I described, but for time's sake, I'm
leaving it the way I wrote it.

I wish you were closer. I think sitting in one of my VBA classes might help
you hone your tracing skills. :-)

Sco

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Jeff,

Are you sure #18 is the last one? :-)

wlib_CGetExecutableMacros (and routines it calls,) also uses:

#20 - wlib_CloseHscr
#22 - wlib_FNextHscr
#23 - wlib_FGetStringHscrIscc

Before I get started, I just want to say that Me.InstructorMode = True. :-)
From your posts I get the feeling that you are very versed in a lot of
areas, however, a couple of comments you have made makes me also believe
that you have a few deep holes scattered about. Not knowing exactly where
those holes are, I may over explain a few things. I mean no offense. Just
playing teacher. :-) With that said...

What they mean by "excitable macros" is not "executable" vs.
"non-executable." They are referring to all of the individual, "named"
macros inside of a macro group which are also executable.

wlib_CGetExecutableMacros not only gets all of the macro object names, which
could be groups, but also all of the named macros inside of any groups.

It is used in places like the switchboard manager. When you select Run Macro
from the Command dropdown, the Macro dropdown lists "all" executable macros,
not just the macro object names you see in the database container. (Just
like the list in the dropdown for an event in the property box.)

Getting a list of all of the macro objects, which could be groups, is easy.
Getting the internal names is the trick and this is what all of this code is
all about.

You are correct that wlib_CGetExecutableMacros returns the number of macros.
But not just the number of macro objects you see in the database container.
It is the number of all of the "executable" macros.

Part of the magic of wlib_CGetExecutableMacros is that only one of its two
arguments, the database, is a "normal" input argument. The second argument
is actually used for output. One of the two ways an argument can be passed,
(the default,) is by reference. The second argument needs to be a reference
to a dynamic string array. wlib_CGetExecutableMacros loads up the array with
all of the "executable" macro names.

Here's a little piece of code that puts wlib_CGetExecutableMacros through
its paces. To see what it does, make sure that you have at least one macro
with at least one internal name.

CodeSample
Sub TestGetMacroNames()

Dim db As DAO.Database
Dim astrMacronames() As String
Dim intCount As Integer
Dim intLoop As Integer

Set db = CurrentDb

intCount = wlib_CGetExecutableMacros(db, astrMacronames())

Debug.Print intCount

For intLoop = LBound(astrMacronames()) To intCount
Debug.Print astrMacronames(intLoop)
Next

Set db = Nothing

End Sub
/CodeSample

So that's what wlib_CGetExecutableMacros does. It gets all of the
"executable" macro names loaded into a string array and it returns how many
there are.

What do all of the Access API calls do? Here are my best guesses:

#18 - wlib_HscrOpenEx
Loads a macro specified by name into memory (without executing it) and
returns a 32 bit "handle"

#20 - wlib_CloseHscr
Unloads a loaded macro specified by a handle from memory

#22 - wlib_FNextHscr
Gets a handle to a line in a macro

#23 - wlib_FGetStringHscrIscc
Gets the text from the name column of the macro line specified by a handle

To help understand how some of this code works, you need to understand a
little bit of "API calls 101." The APIs are written in C++ and it is very
common in C++ (and C and assembler) to return information in what VBA people
would normally think of as input parameters. Because arguments can be passed
by reference, the procedure code can change the value of the arguments and
the calling code can see the new values. (Be aware that when passing
references to strings between VBA and C++, the ByValue keyword is actually
used, but that's a topic for another day. :-)

This is what is happening between wlib_FNextHscr and wlib_StOfHscrIscc.
wlib_FNextHscr is getting a handle and putting it in hscr and then
wlib_StOfHscrIscc is using the handle already loaded in hscr. This is also
how wlib_CGetExecutableMacros is returning the array with all of the names.

If you single step my code and examine the variables as it calls the various
procedures, you should start to get a feel for what is going on.

Now, with all of that said, as you already mentioned, it is easy to get the
macro object names. The tricky part is getting the internal names in a
group. I did a "quick" search and didn't find any easy way. But hey, this is
your project. (Which, by the way, you won't tell any of us what it does.)

To help you with your research, be aware that some of the folks at MS call
Access macros scripts. This is why you see "scr" in the API names. (Hscr in
the names means "script handle.")

So, until you hit some more brick walls, you're on your own again! :-)

Sco


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing bmp file in Access database Dave New Users 1 June 23rd, 2004 11:33 PM
Need help with Access decision aualias General Discussion 23 June 21st, 2004 02:04 AM
Unsafe Attachments Ron Installation & Setup 2 June 9th, 2004 01:55 AM
Opening MS Works Data Base file with Access wfm100 New Users 2 June 8th, 2004 06:57 AM
Default File Location Derek Ruesch Setting up and Configuration 6 January 30th, 2004 03:03 AM


All times are GMT +1. The time now is 03:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.