PDA

Click to See Complete Forum and Search --> : SendDlgItemMessage abends on NT


kfitts
Aug 1st, 2001, 08:26 PM
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

crispin
Aug 2nd, 2001, 09:36 AM
can you post the API call definition as it's declared in your code for me please.....

kfitts
Aug 2nd, 2001, 09:42 AM
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

kfitts
Aug 2nd, 2001, 09:51 AM
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.