Home All Groups Group Topic Archive Search About
Author
25 Feb 2007 5:17 AM
Draco Merest
part two:
---------

I've searched google for a long time. The term 'inline asm vb6' turned up a
link to www.persistentrealities.com.
This site linked me to planet-source-code (where most who are reading this
would have visited).
The submission contains some examples using 'inlineAsm' plug-in. I
downloaded the submission.
There is very little explanation. n the largest document file (html) I get
stuck at the following line:
"Now, open the VbInline add-in interface and goto the "Change Settings" page."
What does that mean? I go back to the download page and see other people
have asked the same question.
Eventually it was answered and a link to download it from
persistentrealities.com. Give me a break!
I have downloaded the inlineAsm plug-in from persistentrealities.com and
now, well WTF do I do with it?
There is a nice detailed looking form with buttons and gizmo's all over it.
Run from within VB6 and nothing appears.
After using 'make' I see a file 'VbInLineASM.dll' which is 248k. Another
damn library.
Examples show no sign of importing any funtions in a VB project. I just do
not know what to do with thing even though it would suit my need.
After going back to the planet-source-code page for a fifth read, I take
more note of the following line:
"No preprocessing of the ASM code is necessary unlike the CallWindowProc
method."
That sounds about what I want; allocate some memory, dunp sone binary into
it and execute it!
CallWindowProc in MSDN library goes on about this being a callback function
used with SetWindowsHookEx.
I do not want to install a hook procedure to monitor the system for certain
types of events... blah blah blah.

Previously I've used CreateThread to execute some raw asm bytes which call
WNetOpenEnumA to monitor a network.
The program progresses with other realtime graphical tasks and periodically
checks the return code of the thread.
This is all well and fine for that application but here I am investigating
an unpredictable complex system.
My need to step through the assembly line by line with W32DSM98 is quite
necessary but a new thread is almost impossible to latch onto.

It looks like I may be forced to create a dummy set of VB instructions,
locate them in the executable with a hex editor, replace the binary with my
asm bytes and hope that everything lines up and behaves.
locating the VarPtr to a double dimention array may be tricky.

Oh where have the easy times gone? What has happened to the explanations and
read me files? Once they were 10 times longer than the item they were
describing. And they made sense, hardly referred to anything outside the
scope of the item in question. If there was an external reference, there was
never a reference to the item you were trying to understand.

Please someone point me in the right direction and, for the sake of my
sanity, make clear understandable statements.

Draco Merest.

Author
25 Feb 2007 5:37 AM
mayayana
I don't know whether this will help, but if
you have access to a copy of Matthew
Curland's book, Advanced Visual Basic 6,
there's a section in there about generating
your own inline assembly.
Author
25 Feb 2007 6:09 AM
Draco Merest
Thank you very much. Adding that name to the google search has reduced the
results. Still no simple answer though.

The book is available in Australia but I cannot locate a nearby bookstore
which lists it as being currently available. The online sites of some stores
are never quite up to date so I'll try phoning them tomorrow.

But at AUD$85, I am wondering if I would want to purchase this book for a
one line solution to my problem. Or any of the several problems I have
encountered. Especially since all that is needed is some clear and simple
instructions.

I think I'll just go play Need For Speed Most Wanted and smash up some
police vehicles for a while.

Thanks again.

Draco Merest.

Show quoteHide quote
"mayayana" wrote:

>   I don't know whether this will help, but if
> you have access to a copy of Matthew
> Curland's book, Advanced Visual Basic 6,
> there's a section in there about generating
> your own inline assembly.
>
>
>
Author
25 Feb 2007 11:49 PM
Michael C
Show quote Hide quote
"Draco Merest" <DracoMer***@discussions.microsoft.com> wrote in message
news:AB0EFECC-EBCA-4FCB-B491-74C8852D913C@microsoft.com...
> Thank you very much. Adding that name to the google search has reduced the
> results. Still no simple answer though.
>
> The book is available in Australia but I cannot locate a nearby bookstore
> which lists it as being currently available. The online sites of some
> stores
> are never quite up to date so I'll try phoning them tomorrow.
>
> But at AUD$85, I am wondering if I would want to purchase this book for a
> one line solution to my problem. Or any of the several problems I have
> encountered. Especially since all that is needed is some clear and simple
> instructions.

If the book is anything like Matt's online advice I'd recommend avoid it. It
seems to all about finding the most complicated solution possible with more
a bent on showing how smart you are than actually solving a problem.

For inline assembly I just put the code in a byte array and call it using
CallWindowsProc.

Michael
Author
26 Feb 2007 5:05 PM
Ken Halter
"Michael C" <nospam@nospam.com> wrote in message
news:OGoKVbTWHHA.1120@TK2MSFTNGP02.phx.gbl...
>
> If the book is anything like Matt's online advice I'd recommend avoid it.
> It seems to all about finding the most complicated solution possible with
> more a bent on showing how smart you are than actually solving a problem.

Funny.... Matt's one of the last ex MS employees that actually knows VB. He
was also on the VB team and is directly responsible for little niceties like
intellisense.... so, avoid his advice if you want, the rest of us consider
it valuable.

VB6 Easter Egg
http://groups.google.com.my/group/microsoft.public.vb.general.discussion/browse_thread/thread/73b2f54ab806be52/fec8405c4b89b5d9?lnk=st&q=&rnum=2#fec8405c4b89b5d9

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm
Author
26 Feb 2007 10:52 PM
Michael C
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:eX$ehjcWHHA.1200@TK2MSFTNGP02.phx.gbl...
> Funny.... Matt's one of the last ex MS employees that actually knows VB.
> He was also on the VB team and is directly responsible for little niceties
> like intellisense.... so, avoid his advice if you want, the rest of us
> consider it valuable.

I'm sure he's a very smart bloke but his advice on these newsgroups is
usually over complicated and not very practicle.

Michael
Author
27 Feb 2007 12:15 AM
alpine
Show quote Hide quote
On Tue, 27 Feb 2007 09:52:06 +1100, "Michael C" <nospam@nospam.com>
wrote:

>"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
>news:eX$ehjcWHHA.1200@TK2MSFTNGP02.phx.gbl...
>> Funny.... Matt's one of the last ex MS employees that actually knows VB.
>> He was also on the VB team and is directly responsible for little niceties
>> like intellisense.... so, avoid his advice if you want, the rest of us
>> consider it valuable.
>
>I'm sure he's a very smart bloke but his advice on these newsgroups is
>usually over complicated and not very practicle.
>
>Michael

Or you're too dense to understand it....

Bryan
_________________________________________________________
Bryan Stafford                        "Don't need no more lies"
New Vision Software        - Neil Young -
www.mvps.org/vbvision    Living With War : The Restless Consumer
alpineDon'tSpam@mvps.org
Author
27 Feb 2007 12:20 AM
Michael C
"alpine" <alpine_don'tsendspam@mvps.org> wrote in message
news:ivt6u25mhlcnf3nooedcni4ra7ir0kaf8f@4ax.com...
> Or you're too dense to understand it....

Hardly. 2 people in this world came up with seperate methods of subclassing
in vb4 when people like Dan Appleman said it was impossible. Those 2 were me
and matt. I just can't be bothered going into the depths of his examples.
Most of the time they are so overcomplicated it would be simpler to do it
all in C.

Michael
Author
27 Feb 2007 1:12 AM
mayayana
> Hardly. 2 people in this world came up with seperate methods of
subclassing
> in vb4 when people like Dan Appleman said it was impossible. Those 2 were
me
> and matt. I just can't be bothered going into the depths of his examples.
> Most of the time they are so overcomplicated it would be simpler to do it
> all in C.
>

    I don't know enough about assembly to assess
your opinion, but I have found quite a bit useful
in his book - not least of which is his subclassing
method for userControls, using inline assembly. I use
dozens of custom and owner-drawn controls now
with no hassles.

   And actually I really enjoy the book. There's a sense
right from the start that Matthew Curland is a true
intellect: Someone who takes pleasure in understanding
something for the sheer pleasure of the understanding
itself. That interest and curiosity - and the desire to
share it - comes across in his writing. I feel like I'm hanging
around with a more experienced craftsman who's just making
conversation about the fine points of the craft. I can't always
follow all of it, but what I can follow I don't find to be
overcomplicated. To the contrary, I find it very pithy.
Author
27 Feb 2007 7:43 PM
Dick Grier
Actually, I have been to dense to understand some of it, too.  But, Matt
hasn't been around (to kick around) for quite a while.

That having been said, he did publish some "meaty" code.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
Author
25 Feb 2007 8:21 AM
Donald Lessau
You find several working examples on VBspeed. For example this:
http://www.xbeat.net/vbspeed/c_ShiftRight.htm#ShiftRight07

I ended up disallowing the use of inline-assembly in the speed contest
because it is not really Visual Basic and the site is called *VB*speed, so
there are not too many examples. But you still see the timing results in the
tables: fast fast fast!!!

Don
Author
25 Feb 2007 3:59 PM
Robert Morley
Interesting code.  Violates a whole lot of "best practices" for Windows, but
it's certainly interesting.  I'm not sure I'd suggest it as a method for
inline coding, though, since you're not really coding "inline"--you have to
know the hex values of the code.  Back on the 6502-based machines, I knew a
few of the op codes' hex values by heart ($A9, $A0, $A2 or $20, $60 ring any
bells for people?  Dear gods, I can't believe I still remember those!), but
I think for most people, especially with modern processors, that would
require going to an outside assembler to generate the code in the first
place, which kind of defeats the purpose.



Rob

Show quoteHide quote
"Donald Lessau" <d**@oflex.com> wrote in message
news:errhge$q3$1@newsreader3.netcologne.de...
> You find several working examples on VBspeed. For example this:
> http://www.xbeat.net/vbspeed/c_ShiftRight.htm#ShiftRight07
>
> I ended up disallowing the use of inline-assembly in the speed contest
> because it is not really Visual Basic and the site is called *VB*speed, so
> there are not too many examples. But you still see the timing results in
> the tables: fast fast fast!!!
>
> Don
Author
25 Feb 2007 5:37 PM
Mike Williams
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:Oxu5pYPWHHA.4188@TK2MSFTNGP06.phx.gbl...

> Back on the 6502-based machines, I knew a few of the
> op codes' hex values by heart ($A9, $A0, $A2 or $20,
> $60 ring any bells for people?

Yep. Certainly do. And the 6510 as well (6502 with some built in ports). I
used to know them all. In fact before I managed to write a simple Assembler
in Basic (I could never afford to buy one at that time) I used to write
simple machine code programs just by scribbling down the hex values on a
scrap of paper, including the values required for the various forward and
backward offsets for my relative branches. Even knew off the top of my head
the addresses of the screen and the sound chips and stuff! I've forgotten
almost all of it now of course (it was a long time ago!) but as I recall
there were not much more than about 150 legitimate opcodes. I had an OricI
(6502) and a Commodore64 (6510) and I could work wonder with them! Those
were the days ;-)

Mike
Author
25 Feb 2007 6:08 PM
Robert Morley
Hehehe...yup, those were the days.  I wrote my own compiler in VB as well,
only to be eclipsed by a friend of mine who was a programmer extraordinaire
(i.e., the kind who actually applied to MIT after high school...dunno if he
actually got in or not).  About the best thing I ended up doing was writing
a fast loader for the 1581 drive that kicked the butt of all the others out
there, but the 1581 was never exactly common, so it never made it outside of
a few friends before everyone moved on to the Amiga.  Oh well.  As you say,
those were the days. :)


Rob

Show quoteHide quote
"Mike Williams" <M***@WhiskyAndCoke.com> wrote in message
news:OYpTgOQWHHA.5068@TK2MSFTNGP03.phx.gbl...
> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> news:Oxu5pYPWHHA.4188@TK2MSFTNGP06.phx.gbl...
>
>> Back on the 6502-based machines, I knew a few of the
>> op codes' hex values by heart ($A9, $A0, $A2 or $20,
>> $60 ring any bells for people?
>
> Yep. Certainly do. And the 6510 as well (6502 with some built in ports). I
> used to know them all. In fact before I managed to write a simple
> Assembler in Basic (I could never afford to buy one at that time) I used
> to write simple machine code programs just by scribbling down the hex
> values on a scrap of paper, including the values required for the various
> forward and backward offsets for my relative branches. Even knew off the
> top of my head the addresses of the screen and the sound chips and stuff!
> I've forgotten almost all of it now of course (it was a long time ago!)
> but as I recall there were not much more than about 150 legitimate
> opcodes. I had an OricI (6502) and a Commodore64 (6510) and I could work
> wonder with them! Those were the days ;-)
>
> Mike
>
>
>
>
Author
25 Feb 2007 8:19 PM
Mike Williams
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:%23rZdggQWHHA.3500@TK2MSFTNGP05.phx.gbl...

> so it never made it outside of a few friends before
> everyone moved on to the Amiga.  Oh well.  As
> you say, those were the days. :)

Amiga. Yes. Those were they days indeed. I moved on from the OricI and the
C64 to the Amiga A500. Superb beast, that one. 7 Mhz Motorola 68000 and 512K
of RAM! Whoever heard of such power! The control you got over the graphics
chip was nothing short of miraculous! You could tell all the time what scan
line it was on, and even what pixel! And you could actually arrange for code
to be executed when the video card was displaying any desired specific
screen pixel position. I used to be able to write machine code to perform
all sorts of tricks with the Copper and the Blitter! Lovely stuff.

In fact my first taste of a "really useful" Basic was gained on the Amiga
500. It almost dragged me away from my beloved machine code completely. Amos
Basic. Superb stuff. Could teach VB a thing or two!

Mike