| | |
Error 998 in VB6 on Vista Home Premium
![]() |
•
•
Join Date: May 2007
Posts: 7
Reputation:
Solved Threads: 1
I am trying to call the GetLayeredWindowAttributes(hwnd, crKey, bAlpha, dwFlags) function but it does not work.
I use Visual Basic 6 on Windows Vista Home Premium.
I declared it using:
I called it using:
Debug.Print shows that GetLastError() returns 998, which the MSDN says is ERROR_NOACCESS (Invalid access to memory location.)
byteAlpha is still the same value as before (1).
I can call the GetLayeredWindowAttributes in Dev-C++ on the same computer and it works fine.
Does anyone have any idea on how to call it from VB6 in Vista?
I use Visual Basic 6 on Windows Vista Home Premium.
I declared it using:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Declare Function GetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Boolean
I called it using:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim byteAlpha As Byte, hwnd As Long byteAlpha = 1 'Make it 1 for debugging purposes hwnd = Me.hwnd Call GetLayeredWindowAttributes(hwnd, vbNull, byteAlpha, vbNull) 'use vbNull for variables you don't need Debug.Print = GetLastError() & " " & byteAlpha
Debug.Print shows that GetLastError() returns 998, which the MSDN says is ERROR_NOACCESS (Invalid access to memory location.)
byteAlpha is still the same value as before (1).
I can call the GetLayeredWindowAttributes in Dev-C++ on the same computer and it works fine.
Does anyone have any idea on how to call it from VB6 in Vista?
•
•
Join Date: May 2007
Posts: 7
Reputation:
Solved Threads: 1
I was experimenting and found out the solution. You need to declare it without ByVal like this (except for hwnd as that is not a returned value):
This works now.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Declare Function GetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As Long, crKey As Long, bAlpha As Byte, dwFlags As Long) As Boolean
This works now.
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Find Record
- Next Thread: Reading data from SQL
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





