Re: make general windows module
From: Ralph (nt_consulting32_at_hotmail.com)
Date: 03/11/04
- Next message: Nick Cranham: "Re: "Russian doll" class"
- Previous message: Rick Rothstein: "Re: mouse wheel"
- In reply to: Eitan: "Re: make general windows module"
- Next in thread: Eitan: "Re: make general windows module"
- Reply: Eitan: "Re: make general windows module"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 10 Mar 2004 20:21:59 -0600
"Eitan" <nobody@nospam_please.com> wrote in message
news:OuOE9atBEHA.2628@TK2MSFTNGP11.phx.gbl...
> Specifically I want a solution for how can I do "windows.h" in VB ?
>
> Thanks :)
>
Eitan,
You got your solution - twice.
Perhaps you are unaware of what the Windows.h file is? It is a header file
(actually multiple header files since it includes other headers) that
contains declarations of API calls, typedefs, structs, enums, etc. These
declarations are used by the C/C++ compiler to resolve references during the
compile and link to the correct libraries.
The VB version of these declarations is the "Declare Statement".
Unfortunately, while the C/C++ compiler only uses the header to resolve
references during the compile/link and the finished product does not include
the entire Windows.h declarations (only the items used), in VB every Declare
Statement remains in the executable/DLL. Each Declare statement takes at
least 16 bytes of memory whether used or not. A complete duplication of
Windows.h would be huge and an unnecessary burden on your application. That
is the primary reason Window API Declare statements are usually a cut 'n
paste operation.
There are also several "API Viewers" available - a simple program or addin
that allows you to look up the Windows API call (C signature) and then
provides a Declare statement to include in your code.
Mr. Bob Butler suggested that you can create a .bas file with Declare
statements. In fact VB use to ship with a text file that included quite a
few Window APIs.
The other alternative is to use a typelib. I provided an example of one of
them and where you could get it. A type library would come the closest to
mimicing the behavior of a "windows.h" header file for VB.
Note: not all Windows API calls can be called from VB as some use reference
pointers, data types, or structures not available to VB, so a complete
duplication of Windows.h is not possible. Also many single signature API
calls, e.g. those that take void*, can have several different VB Declare
statements in order to support different VB data types.
So there are your choices.
-ralph
- Next message: Nick Cranham: "Re: "Russian doll" class"
- Previous message: Rick Rothstein: "Re: mouse wheel"
- In reply to: Eitan: "Re: make general windows module"
- Next in thread: Eitan: "Re: make general windows module"
- Reply: Eitan: "Re: make general windows module"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|