Ошибка в Visual Basic.

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by mr. shokomen, 18 Sep 2010.

  1. mr. shokomen

    mr. shokomen New Member

    Joined:
    29 Jul 2010
    Messages:
    24
    Likes Received:
    0
    Reputations:
    0
    Писал программу на Viaual Basic и вот такая ошибка вылезла:

    Code:
    Слишком большое число аргументов у "Declare Ansi Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (hwndctory As String, nShowCmd As Long) As Long".
    
    Чем она может быть вызвана? :confused:
    Кто встречался с такой ошибкой помогите :)
    Сильно не ругаться :)
     
  2. napas_hd

    napas_hd Member

    Joined:
    29 Dec 2008
    Messages:
    61
    Likes Received:
    17
    Reputations:
    0
    Что-то подсказывает что, "Ansi" тут лишнее.
     
  3. mr. shokomen

    mr. shokomen New Member

    Joined:
    29 Jul 2010
    Messages:
    24
    Likes Received:
    0
    Reputations:
    0
    Сам код программы такой:

    Code:
    Public Class Form1
        Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwndctory As String, ByVal nShowCmd As Long) As Long
        Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
            Call ShellExecute(0&, "Open", "http://www.mail.ru/", "", "", 1)
        End Sub
    
    А в первом посте была написана ошибка которая выскакивает внизу :(
     
  4. Mr.Burns

    Mr.Burns Banned

    Joined:
    13 Aug 2010
    Messages:
    28
    Likes Received:
    10
    Reputations:
    0
    пробуй так

    Code:
    Public Class Form1
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    
    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
    Call ShellExecute(0&, "Open", "http://www.mail.ru/", "", "", 1)
    End Sub
     
  5. Juda

    Juda Elder - Старейшина

    Joined:
    2 Aug 2008
    Messages:
    48
    Likes Received:
    8
    Reputations:
    0
    Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    (ByVal hwnd As Long, ByVal lpszOp As String, _
    ByVal lpszFile As String, ByVal lpszParams As String, _
    ByVal LpszDir As String, ByVal FsShowCmd As Long) _
    As Long



    http://support.microsoft.com/kb/170918
     
  6. mr. shokomen

    mr. shokomen New Member

    Joined:
    29 Jul 2010
    Messages:
    24
    Likes Received:
    0
    Reputations:
    0
    Mr.Burns, от души брат :) спасибо :)
     
  7. DiffiT

    DiffiT Member

    Joined:
    15 Dec 2009
    Messages:
    195
    Likes Received:
    12
    Reputations:
    3
    Так же подумал
     
  8. mr. shokomen

    mr. shokomen New Member

    Joined:
    29 Jul 2010
    Messages:
    24
    Likes Received:
    0
    Reputations:
    0
    Парни вот всё делаю дальше по своему плану и вот тут ещё такая ошибка вышла о_О

    Сам код:
    Code:
    Option Explicit
    Private Declare Function Shell_NotifyIcon Lib "shell32.dll" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
    Private Const NIM_ADD = &H0
    Private Const NIM_DELETE = &H2
    Private Const NIM_MODIFY = &H1
    Private Const WM_MOUSEMOVE = &H200
    Private Const NIF_MESSAGE = &H1
    Private Const NIF_TIP = &H4
    Private Const NIF_ICON = &H2
    Private Const WM_LBUTTONDBLCLK = &H203
    Private Const WM_LBUTTONDOWN = &H201
    Private Const WM_LBUTTONUP = &H202
    Private Const WM_RBUTTONDBLCLK = &H206
    Private Const WM_RBUTTONDOWN = &H204
    Private Const WM_RBUTTONUP = &H205
    Private Type NOTIFYICONDATA
            cbSize As Long
            hwnd As Long
            uID As Long
            uFlags As Long
            uCallbackMessage As Long
            hIcon As Long
            szTip As String * 64
    End Type
    Private tray As NOTIFYICONDATA
    
    Private Sub Command1_Click()
        Shell_NotifyIcon NIM_ADD, tray
    End Sub
    
    Private Sub Command2_Click()
        Shell_NotifyIcon NIM_DELETE, tray
    End Sub
    
    Private Sub Form_Load()
        Command1.Caption = "Добавить"
        Command2.Caption = "Удалить"
        tray.cbSize = Len(tray)
        tray.hIcon = Me.Icon
        tray.hwnd = Me.hwnd
        tray.szTip = "Всплывающая подсказка" & Chr(0)
        tray.uCallbackMessage = WM_MOUSEMOVE
        tray.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
        tray.uID = 0
    End Sub
    
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Dim msg As Long
    
        msg = X / Screen.TwipsPerPixelX
    
        Select Case msg
            Case WM_LBUTTONDBLCLK
                Me.Print "Двойной клик левой кнопкой"
            Case WM_LBUTTONDOWN
                Me.Print "Левая кнопка мыши нажата"
            Case WM_LBUTTONUP
                Me.Print "Левая кнопка мыши отжата"
            Case WM_RBUTTONDBLCLK
                Me.Print "Двойной клик правой кнопкой"
            Case WM_RBUTTONDOWN
                Me.Print "Правая кнопка мыши нажата"
            Case WM_RBUTTONUP
                Me.Print "Правая кнопка мыши отжата"
        End Select
    End Sub
    А вот и она.. Неизвестно-Плохая ошибка :D

     
  9. DiffiT

    DiffiT Member

    Joined:
    15 Dec 2009
    Messages:
    195
    Likes Received:
    12
    Reputations:
    3
    Это весь код?
    Me.Print надо переименовать, потому что есть оператор принт.
    На это и ругается
     
    #9 DiffiT, 19 Sep 2010
    Last edited: 19 Sep 2010
  10. mr. shokomen

    mr. shokomen New Member

    Joined:
    29 Jul 2010
    Messages:
    24
    Likes Received:
    0
    Reputations:
    0
    DiffiT, спасибо :)