PDA

View Full Version : سوال: compile error : User-defined type not defined



lmaghsoodi
پنج شنبه 23 خرداد 1392, 10:36 صبح
با سلام خدمت دوستان گرامی

من در برنامه ام از ApI استفاده کرده ام و برنامه چنین خطایی را می دهد:

compile error : User-defined type not defined

از خط Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
اشکال می گیرد .

خواهشمندم مرا سریعتر راهنمایی نمایید .

کد برنامه ام



[LEFT] 'The function used to actually send the request to shutdown windows. Set the 'shutdownTypes'
'parameter to whether you want windows to "shutdown, reboot, logOff, ect..."
Private Declare Function ExitWindowsEx Lib "user32" (ByVal shutdownType As Long, ByVal dwReserved As _
Long) As Long
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''
'
'Will get a handle to the process this function is called.
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
'
'
'The functions below are all used to give the application that the library is bound to the proper privilege so
'the OS will allow the app to Shutdown Windows.
'
'
Private Declare Function OpenProcessToken Lib "advapi32" (ByVal ProcessHandle As Long, ByVal _
DesiredAccess As Long, ByRef TokenHandle As Long) As Long
'
Private Declare Function LookupPrivilegeValue Lib "advapi32" Alias "LookupPrivilegeValueA" (ByVal _
lpSystemName As String, ByVal lpName As String, ByRef lpLuid As LUID) As Long
'
Private Declare Function AdjustTokenPrivileges Lib "advapi32" (ByVal TokenHandle As Long, ByVal _
DisableAllPrivileges As Boolean, ByRef NewState As TOKEN_PRIVILEGES, ByVal BufferLength As _
Long, ByRef PreviousState As TOKEN_PRIVILEGES, ByRef ReturnLength As Long) As Long
''''''''''''''''''''''''''''''''''''''''''''''''

''''''''''''''''''''''''''''''''''''''''''''''''

Private Type LUID

UsedPart As Long
IgnoredForNowHigh32BitPart As Long

End Type

Private Type TOKEN_PRIVILEGES

PrivilegeCount As Long
TheLuid As LUID
Attributes As Long

End Type

'
'
'
'This sub will do all of the work of setting up your apps process to get the proper privileges to
'shutdown the OS. I originally got this function from msdn and converted it from VB 6.0 to VB.Net
'and did a tweak here and there, nothing major was changed. This routine was actually made by
'Microsoft.
Private Sub AdjustToken()

Const TOKEN_ADJUST_PRIVILEGES = &H20
Const TOKEN_QUERY = &H8
Const SE_PRIVILEGE_ENABLED = &H2
Dim hdlProcessHandle As Long
Dim hdlTokenHandle As Long
Dim tmpLuid As LUID
Dim tkp As TOKEN_PRIVILEGES
Dim tkpNewButIgnored As TOKEN_PRIVILEGES
Dim lBufferNeeded As Long

hdlProcessHandle = GetCurrentProcess()
OpenProcessToken hdlProcessHandle, (TOKEN_ADJUST_PRIVILEGES Or _
TOKEN_QUERY), hdlTokenHandle

' Get the LUID for shutdown privilege.
LookupPrivilegeValue "", "SeShutdownPrivilege", tmpLuid

tkp.PrivilegeCount = 1 ' One privilege to set
tkp.TheLuid = tmpLuid
tkp.Attributes = SE_PRIVILEGE_ENABLED

' Enable the shutdown privilege in the access token of this process.
AdjustTokenPrivileges hdlTokenHandle, False, _
tkp, Len(tkpNewButIgnored), tkpNewButIgnored, lBufferNeeded

End Sub



Function shutdownWindowsOS(ByVal shutdownType As shutdownTypes) As Integer
'
'This function will call the ExitWindowsEx function to request the system to shutdown/reboot or
'whatever is specified in the "shutdownType" parameter. It of course, will call the "AdjustToken"
'sub to give your app the privilege to use that function first.
'
AdjustToken
'
'Calls the function to begin executing.
shutdownWindowsOS = ExitWindowsEx(shutdownType, 0)

End Function


'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''


Private Type POINTAPI
X As Long
Y As Long
End Type
Dim a As POINTAPI
Dim b As Long
Dim c As Long

Dim flag_image_mouseMove As Boolean
Dim flag_icon_mouseMove As Boolean
Dim OS_Icon_Visible As Boolean
'Dim preIndex As Integer
Dim feliIndex As Integer
Dim feliLargIndex As Integer
Dim feliOSIconIndex As Integer
Private Sub cloudImg_Click()

Unvisible_os_Buttoms
End Sub

:عصبانی++:

M.T.P
پنج شنبه 23 خرداد 1392, 11:59 صبح
سلام
تایپ POINTAPI رو قبل از اعلان تابع GetCursurPos تعریف کنید