How to use pointer and the pointer of pointedness pointer in vb
Author |
Message |
Santa Yan #1 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
I are doing a call center project with some devices ,API functions and header files(.h files) supplied by a company.But I use VB as my development tool, I wonder how I can include the header files ,especially pointer and the pointer of pointedness pointer defined in header files, in my VB source code? I can convert the structures,funtion calls,and constants of vc to vb,but I can't use pointer and the pointer of pointedness pointer in vb. For example The definitions in vc as follows: /* * Define handle to DX data */ typedef void* DX_DATA_HANDLE_TYPE; DX_STATUS_TYPE DX_GetEvent(DX_OPERATION_MODE_TYPE mode, DX_DATA_HANDLE_TYPE *hdata); DX_MESSAGE_TYPE DX_getMessageType(DX_DATA_HANDLE_TYPE); In this example,I can't declare the function correctly in vb,because there is pointer and the pointer of pointedness pointer.How to declare the API function in vb? Please help me Thanks!
|
Thu, 08 Nov 2001 03:00:00 GMT |
|
 |
Utan #2 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
You'll need to convert the header to something VB can use. If the pointers are 32bit then VB will use a long for that data type. If it's 16bit use an integer. A void pointer is a pointer that can point anywhere (as opposed to a reference which points to a specific something). In your example: typedef void* DX_DATA_HANDLE_TYPE; You are simply saying that a DX_DATA_HANDLE_TYPE is a void pointer (long in vb). -- Utana's VB Algorithm Lab http://www.utana.com
Quote: > I are doing a call center project with some devices ,API functions > and header files(.h files) supplied by a company.But I use VB as my > development tool, I wonder how I can include the header files ,especially > pointer and the pointer of pointedness pointer defined in header files, in > my VB source code? > I can convert the structures,funtion calls,and constants of vc to vb,but I > can't use pointer and the pointer of pointedness pointer in vb. > For example > The definitions in vc as follows: > /* > * Define handle to DX data > */ > typedef void* DX_DATA_HANDLE_TYPE; > DX_STATUS_TYPE DX_GetEvent(DX_OPERATION_MODE_TYPE mode, > DX_DATA_HANDLE_TYPE *hdata); > DX_MESSAGE_TYPE DX_getMessageType(DX_DATA_HANDLE_TYPE); > In this example,I can't declare the function correctly in vb,because there > is pointer and the pointer of pointedness pointer.How to declare the API > function in vb? > Please help me > Thanks!
|
Thu, 08 Nov 2001 03:00:00 GMT |
|
 |
Eduardo Morcill #3 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
Hi, Quote: > If the pointers > are 32bit then VB will use a long for that data type. If it's 16bit use an > integer
That's wrong, Utana. Pointers are always 32bits, no matter if the program is 32 or 16bits. -- Eduardo Morcillo Free ActiveX Controls: http://www.geocities.com/SiliconValley/Foothills/9940 NEW TypeLibs section.
|
Fri, 09 Nov 2001 03:00:00 GMT |
|
 |
Michael Kapla #4 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
I think he was referring to "near" pointers (as opposed to far pointers), an old 16-bit thing.... -- Michael ------------------------------- random junk of dubious value is at: http://www.trigeminal.com
Quote: > Hi, > > If the pointers > > are 32bit then VB will use a long for that data type. If it's 16bit use > an > > integer > That's wrong, Utana. Pointers are always 32bits, no matter if the program is > 32 or 16bits. > -- > Eduardo Morcillo > Free ActiveX Controls:
http://www.geocities.com/SiliconValley/Foothills/9940 Quote: > NEW TypeLibs section.
|
Fri, 09 Nov 2001 03:00:00 GMT |
|
 |
Eduardo Morcill #5 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
But pointer passed to a dll are always passed as far pointers. Or i'm wrong? -- Eduardo Morcillo Free ActiveX Controls: http://www.geocities.com/SiliconValley/Foothills/9940 NEW TypeLibs section.
Quote: > I think he was referring to "near" pointers (as opposed to > far pointers), an old 16-bit thing.... > -- > Michael > ------------------------------- > random junk of dubious value is at: > http://www.trigeminal.com
> > Hi, > > > If the pointers > > > are 32bit then VB will use a long for that data type. > If it's 16bit use > > an > > > integer > > That's wrong, Utana. Pointers are always 32bits, no matter > if the program is > > 32 or 16bits. > > -- > > Eduardo Morcillo > > Free ActiveX Controls: > http://www.geocities.com/SiliconValley/Foothills/9940 > > NEW TypeLibs section.
|
Fri, 09 Nov 2001 03:00:00 GMT |
|
 |
Klaus H. Probs #6 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
There are no FAR or NEAR pointers any more. That doesn't exist in Win32. Even in Win16 the great majority of pointers was FAR, anyway. ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Please post/reply to the newsgroup(s) so that everyone can benefit from the discussion. Regards, Klaus H. Probst, MCP
ICQ: 22454937 The VB Box: http://members.xoom.com/kprobst/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quote: > But pointer passed to a dll are always passed as far pointers. Or i'm wrong? > -- > Eduardo Morcillo > Free ActiveX Controls:
http://www.geocities.com/SiliconValley/Foothills/9940 Quote: > NEW TypeLibs section.
> > I think he was referring to "near" pointers (as opposed to > > far pointers), an old 16-bit thing.... > > -- > > Michael > > ------------------------------- > > random junk of dubious value is at: > > http://www.trigeminal.com
> > > Hi, > > > > If the pointers > > > > are 32bit then VB will use a long for that data type. > > If it's 16bit use > > > an > > > > integer > > > That's wrong, Utana. Pointers are always 32bits, no matter > > if the program is > > > 32 or 16bits. > > > -- > > > Eduardo Morcillo > > > Free ActiveX Controls: > > http://www.geocities.com/SiliconValley/Foothills/9940 > > > NEW TypeLibs section.
|
Fri, 09 Nov 2001 03:00:00 GMT |
|
 |
Michael Kapla #7 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
Near pointers are occasionally used in Win16 programs. The point was that utana's post is wrong most of the time, and I was clarifying what it looks like they meant. -- Michael ------------------------------- random junk of dubious value is at: http://www.trigeminal.com
Quote: > > There are no FAR or NEAR pointers any more. That doesn't exist in Win32. > Yes, i know. I was talking about 16bits programs. > -- > Eduardo Morcillo > Free ActiveX Controls:
http://www.geocities.com/SiliconValley/Foothills/9940 Quote: > NEW TypeLibs section.
|
Fri, 09 Nov 2001 03:00:00 GMT |
|
 |
Eduardo Morcill #8 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
Quote: > There are no FAR or NEAR pointers any more. That doesn't exist in Win32.
Yes, i know. I was talking about 16bits programs. -- Eduardo Morcillo Free ActiveX Controls: http://www.geocities.com/SiliconValley/Foothills/9940 NEW TypeLibs section.
|
Sat, 10 Nov 2001 03:00:00 GMT |
|
 |
Utan #9 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
Sorry for the confusion on this my friend, I was referring to the platform. If you are developing in win16 you have to use 16bit pointers. If you are developing in win32 you have to use 32bit pointers. -- Utana's VB Algorithm Lab http://www.utana.com
Quote: > Hi, > > If the pointers > > are 32bit then VB will use a long for that data type. If it's 16bit use > an > > integer > That's wrong, Utana. Pointers are always 32bits, no matter if the program is > 32 or 16bits. > -- > Eduardo Morcillo > Free ActiveX Controls:
http://www.geocities.com/SiliconValley/Foothills/9940 Quote: > NEW TypeLibs section.
|
Mon, 12 Nov 2001 03:00:00 GMT |
|
 |
Michael Kapla #10 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
Utana, as was pointed out, even under Win16 most pointers are still "FAR" pointers rather than near pointers and thus are still 32bit. -- Michael ------------------------------- random junk of dubious value is at: http://www.trigeminal.com
Quote: > Sorry for the confusion on this my friend, I was referring to the platform. > If you are developing in win16 you have to use 16bit
pointers. If you are Quote: > developing in win32 you have to use 32bit pointers. > -- > Utana's VB Algorithm Lab > http://www.utana.com
> > Hi, > > > If the pointers > > > are 32bit then VB will use a long for that data type. If it's 16bit use > > an > > > integer > > That's wrong, Utana. Pointers are always 32bits, no
matter if the program Quote: > is > > 32 or 16bits. > > -- > > Eduardo Morcillo > > Free ActiveX Controls: > http://www.geocities.com/SiliconValley/Foothills/9940 > > NEW TypeLibs section.
|
Mon, 12 Nov 2001 03:00:00 GMT |
|
 |
Utan #11 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
Let me educate you on memory. An integer is two bytes wide or 16bits. A long is 4 bytes wide or 32 bits. 16bit memory addressing is performed with a segment offset address in the notation SSSS:OOOO. The segment address (held in CS, DS, SS, ES) holds a 4k base. the offset address is the offset within the segment to access the memory. the offset can be in registers (ax, bx, cx, dx, si, di, bp, sp, ip). the processor gets the physical address by taking the segment register (lets assume our ds = 0x0100) and multiplies by 0x10 giving us 0x01000. the processor then adds the offset address to the result (lets assume our ax register holds 0x300) we would get a physical address of 0x01300. (we are still in 16bit at this point) But a problem arrises because we have a need for more than 1 meg of memory with new apps. So intel came up with PROTECTED MODE. our segment registers hold an offset into a table now, not a 4k base address. this table holds a map of protection schems granularity, priveleg levels, etc. in order to complensate for the loss of the segment register intel extended the general purpose registers which are 32 bits wide [eax, ebx, ecx, edx, edi, esi ,ebp, esp] by extending the registers we now get 32BITS of memory addressing capability. where before we had only 16bits. How does Utana know? I've been writing an opperating system for about a year now. And most of it is in assembler. -- Utana's VB Algorithm Lab http://www.utana.com
Quote: > But pointer passed to a dll are always passed as far pointers. Or i'm wrong? > -- > Eduardo Morcillo > Free ActiveX Controls:
http://www.geocities.com/SiliconValley/Foothills/9940 Quote: > NEW TypeLibs section.
> > I think he was referring to "near" pointers (as opposed to > > far pointers), an old 16-bit thing.... > > -- > > Michael > > ------------------------------- > > random junk of dubious value is at: > > http://www.trigeminal.com
> > > Hi, > > > > If the pointers > > > > are 32bit then VB will use a long for that data type. > > If it's 16bit use > > > an > > > > integer > > > That's wrong, Utana. Pointers are always 32bits, no matter > > if the program is > > > 32 or 16bits. > > > -- > > > Eduardo Morcillo > > > Free ActiveX Controls: > > http://www.geocities.com/SiliconValley/Foothills/9940 > > > NEW TypeLibs section.
|
Mon, 12 Nov 2001 03:00:00 GMT |
|
 |
David Mot #12 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
Let me educate you on memory. An integer is two bytes wide or 16bits. A long is 4 bytes wide or 32 bits. 16bit memory addressing is performed with a segment offset address in the notation SSSS:OOOO. The segment address (held in CS, DS, SS, ES) holds a 4k base. the offset address is the offset within the segment to access the memory. the offset can be in registers (ax, bx, cx, dx, si, di, bp, sp, ip). the processor gets the physical address by taking the segment register (lets assume our ds = 0x0100) and multiplies by 0x10 giving us 0x01000. the processor then adds the offset address to the result (lets assume our ax register holds 0x300) we would get a physical address of 0x01300. (we are still in 16bit at this point) But a problem arrises because we have a need for more than 1 meg of memory with new apps. So intel came up with PROTECTED MODE. our segment registers hold an offset into a table now, not a 4k base address. this table holds a map of protection schems granularity, priveleg levels, etc. in order to complensate for the loss of the segment register intel extended the general purpose registers which are 32 bits wide [eax, ebx, ecx, edx, edi, esi ,ebp, esp] by extending the registers we now get 32BITS of memory addressing capability. where before we had only 16bits. How does Utana know? I've been writing an opperating system for about a year now. And most of it is in assembler. You can get more info on my web site under the faqs section: http://www.utana.com/faqs.asp?name=stack
Quote: > Utana, as was pointed out, even under Win16 most pointers > are still "FAR" pointers rather than near pointers and thus > are still 32bit. > -- > Michael > ------------------------------- > random junk of dubious value is at: > http://www.trigeminal.com
> > Sorry for the confusion on this my friend, I was referring > to the platform. > > If you are developing in win16 you have to use 16bit > pointers. If you are > > developing in win32 you have to use 32bit pointers. > > -- > > Utana's VB Algorithm Lab > > http://www.utana.com
> > > Hi, > > > > If the pointers > > > > are 32bit then VB will use a long for that data type. > If it's 16bit use > > > an > > > > integer > > > That's wrong, Utana. Pointers are always 32bits, no > matter if the program > > is > > > 32 or 16bits. > > > -- > > > Eduardo Morcillo > > > Free ActiveX Controls: > > http://www.geocities.com/SiliconValley/Foothills/9940 > > > NEW TypeLibs section.
-- ------------------------------------------------------------ See Utana's Visual Basic Algorithm Lab. http://www.utana.com --== Sent via Deja.com http://www.deja.com/ ==-- ---Share what you know. Learn what you don't.---
|
Mon, 12 Nov 2001 03:00:00 GMT |
|
 |
Eduardo Morcill #13 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
Quote: > a segment offset address in the notation SSSS:OOOO.
Then FAR pointers are 16Bits:16Bits = 32Bits = Long. -- Eduardo Morcillo Free ActiveX Controls: http://www.geocities.com/SiliconValley/Foothills/9940 NEW TypeLibs section.
|
Mon, 12 Nov 2001 03:00:00 GMT |
|
 |
Michael Kapla #14 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
Thank you Eduardo, I had just about decided to give up on trying to explain what I meant here. :-) -- Michael ------------------------------- random junk of dubious value is at: http://www.trigeminal.com
Quote: > > a segment offset address in the notation SSSS:OOOO. > Then FAR pointers are 16Bits:16Bits = 32Bits = Long. > -- > Eduardo Morcillo > Free ActiveX Controls:
http://www.geocities.com/SiliconValley/Foothills/9940 Quote: > NEW TypeLibs section.
|
Mon, 12 Nov 2001 03:00:00 GMT |
|
 |
Utan #15 / 25
|
 How to use pointer and the pointer of pointedness pointer in vb
No, Windows applications use a FLAT memory model. Windows sets the data segment registers to the global descriptor tables base address of the code segment (but in a different selector of course.) I re-read my post and seems I forgot to include this info. The data segments are never passed. They are constant. You'll notice that in every API (that I'm aware of) you never read data in the windows data area. Rather windows populates your data area and variables when data is to be passed to your application. This is because the segment registers are never passed only offsets. Offsets in win16 are 2 bytes wide or 16bits win32 offsets are 4 bytes or 32bits. -- Utana's VB Algorithm Lab http://www.utana.com
Quote: > > a segment offset address in the notation SSSS:OOOO. > Then FAR pointers are 16Bits:16Bits = 32Bits = Long. > -- > Eduardo Morcillo > Free ActiveX Controls:
http://www.geocities.com/SiliconValley/Foothills/9940 Quote: > NEW TypeLibs section.
|
Mon, 12 Nov 2001 03:00:00 GMT |
|
|
Page 1 of 2
|
[ 25 post ] |
|
Go to page:
[1]
[2] |
|