TYPE command help 
Author Message
 TYPE command help

    Hi all
        Hope someone can help i am quite new to vb and i dont understand
where to use type definitions
this is what i am trying to do
i want to display the cursor position cordinates
so i declare this : Declare Function GetCursorPos Lib "user32.dll" (ByVal
lpPoint As POINTAPI) As Long
in my general declarations of my form.

but where do i use type to declare the POINTAPI type i use this
Type POINTAPI
  x As Long
  y As Long
End Type

But where in the code should it go? on the form in a bas module or what??

                        Thanks Andy



Mon, 27 Nov 2000 03:00:00 GMT  
 TYPE command help

Hi!
Put the following in a module:

Public Type POINTAPI
 x As Long
 y As Long
End Type

Public Declare Function GetCursorPos& Lib "user32" (lpPoint As POINTAPI)

Then add a timer control to the form and in the Timer event you can add the
following or something similar:

Dim CurPoint As POINTAPI
Dim Dummy&
Dummy& = GetCursorPos(CurPoint)
if Dummy& = 0 then
    'error handling
else
    Text1.text = str(CurPoint.x) & " " & str(CurPoint.y)    'textbox named
text1
end if

Having that said there is a much easier way, simply add code to the forms
MouseMove Event, it provides you with the x and y positions...


Quote:
>    Hi all
>        Hope someone can help i am quite new to vb and i dont understand
>where to use type definitions
>this is what i am trying to do
>i want to display the cursor position cordinates
>so i declare this : Declare Function GetCursorPos Lib "user32.dll" (ByVal
>lpPoint As POINTAPI) As Long
>in my general declarations of my form.

>but where do i use type to declare the POINTAPI type i use this
>Type POINTAPI
>  x As Long
>  y As Long
>End Type

>But where in the code should it go? on the form in a bas module or what??

>                        Thanks Andy




Mon, 27 Nov 2000 03:00:00 GMT  
 TYPE command help

The TYPE decleration must be put in the Decletations-section of a module (.bas or whatever)

Jens Vestergaard
http://www.railsoft.dk
http://www.jernbaner.dk


[snip}

Quote:
>but where do i use type to declare the POINTAPI type i use this
>Type POINTAPI
>  x As Long
>  y As Long
>End Type



Mon, 27 Nov 2000 03:00:00 GMT  
 TYPE command help

Type definitions must go in a Module.
Once defined, you should declare a variable of that
type, i.e.,

Type POINTAPI
        x as Long
        y as Long
End Type

Dim pointdata as POINTAPI
or
Global pointdata as POINTAPI



Quote:
>     Hi all
>         Hope someone can help i am quite new to vb and i dont understand
> where to use type definitions
> this is what i am trying to do
> i want to display the cursor position cordinates
> so i declare this : Declare Function GetCursorPos Lib "user32.dll" (ByVal
> lpPoint As POINTAPI) As Long
> in my general declarations of my form.

> but where do i use type to declare the POINTAPI type i use this
> Type POINTAPI
>   x As Long
>   y As Long
> End Type

> But where in the code should it go? on the form in a bas module or what??

>                         Thanks Andy




Tue, 28 Nov 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. TYPE command help

2. TYPE command help

3. Help! ADO Command - Cursor Type

4. Help! ADO Command - Cursor Type

5. Win32 Types To VB Types List (Help Needed)

6. HELP HELP command lines HELP HELP

7. Help with Win 95 screen saver command line - command line.zip [1/1]

8. ADODB.Command Output Params return null for GUID types

9. Need to run the DOS Type Command

10. Interpreting/parsing a command line type of argument

11. TYPE command program

12. create a file type for a virtual directory in IIS using a command line script

 

 
Powered by phpBB® Forum Software