PDA

View Full Version : Can't find DLL entry point



schatzi
06-22-2018, 11:41 AM
I have code to hide a userform title bar. Was working just fine for over a year and this week Office pushed an update and now I get the error message "Can't find DLL entry point FindWindowA in user 32". Here's my code...


Option Explicit


Public Const GWL_STYLE = -16
Public Const WS_CAPTION = &HC00000
#If VBA7 Then
Public Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Public Declare PtrSafe Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
#Else
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
#End If


Sub HideTitleBar(frm As Object)
Dim lngWindow As Long
Dim lFrmHdl As Long
lFrmHdl = FindWindowA(vbNullString, frm.Caption)
lngWindow = GetWindowLong(lFrmHdl, GWL_STYLE)
lngWindow = lngWindow And (Not WS_CAPTION)
Call SetWindowLong(lFrmHdl, GWL_STYLE, lngWindow)
Call DrawMenuBar(lFrmHdl)
End Sub


In the userform initialize i call HideTitleBar Me

Any ideas on what broke and how to fix? thanks

JKwan
06-22-2018, 12:20 PM
Shot in the dark, did you by chance got 64 bit version of Office? If so, you need to re-defined all your functions to 64 bit.

schatzi
06-22-2018, 12:24 PM
Nope still the 32 bit version. From what I've read the behavior acts as if I'm using 64 bit. Still researching.

schatzi
07-11-2018, 11:39 AM
I've determined this has to do with an update released on June 13 Version 1805 Build 9330.2124. From posts on other msg boards it appears to have affected VBA across the entire office suite. Hoping they catch this quick, it's been a big pain.