Results 1 to 4 of 4

Thread: SendDlgItemMessage abends on NT

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    Hillsborough
    Posts
    5

    SendDlgItemMessage abends on NT

    I have a small piece of code written and compiled in VB6 which works just as designed when used on a Win 95 OS. However when it is placed on an nT OR Win 2000 OS, it fails with a Run Time Error 6 - Overflow. I am posting the code that is having the problem here, and I hope someone will be able to tell me what I'm missing. Thanks in advance!


    Function CheckForNameBox(fName As String) As Boolean

    Dim iii As Long
    Dim hMsgWnd As Long
    Dim lBtnhWnd As Long
    Dim msgText As String

    hMsgWnd = FindWindow(vbNullString, "Print to File")
    CheckForNameBox = False

    'If/When window found, send filename to dialog
    If hMsgWnd <> 0 Then
    'It gets here on NT/2000, but chokes on SendDlgItemMEssage
    iii = SendDlgItemMessage(hMsgWnd, 1152, WM_SETTEXT, 0, fName)
    iii = SendMessage(hMsgWnd, WM_SHOWWINDOW, 0, 0)
    lBtnhWnd = FindWindowEx(hMsgWnd, 0, "Button", "OK")
    iii = SendMessage(lBtnhWnd, BM_CLICK, 0, 0)
    CheckForNameBox = True
    End If

    End Function

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    can you post the API call definition as it's declared in your code for me please.....
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    Hillsborough
    Posts
    5
    Private Declare Function SendDlgItemMessage Lib "user32" _
    Alias "SendDlgItemMessageA" (ByVal hDlg As Integer, ByVal _
    nIDDlgItem As Long, ByVal Msg As Long, ByVal wParam_
    As Long, ByVal lParam As Any) As Long

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    Hillsborough
    Posts
    5
    Here are the Constants:

    Const Max_Path = 260
    Const WM_SETTEXT = &HC
    Const WM_SHOWWINDOW = &H18
    Const WM_LBUTTONUP = &H202
    Const WM_LBUTTONDOWN = &H201
    Const BM_CLICK = &HF5

    I was wondering if these might have different values on NT/2000 or is there a problem with user rights in NT/2000 in regards to executables.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width