J.Ross
J.Ross

Reputation: 11

PowerBuilder 2021 Deployed user32.dll Error

I have a deployed PowerBuilder 2021 build 1288 and when accessing a calendar dropdown the application crashes with this error.

Error Number 21
Error text = Bad runtime function reference at line 43 in function of of_iscalendaropen of object u_dw_dsa_detail
Object = u_dw_dsa_detail
Control = u_dw_dsa_detail
Script = of_iscalendaropen
Line in script = 43

I have these two functions in my code which call the user32.dll which is directly where the error message is pointing to. I have a copy of user32.dll in my deployed workspace and for some reason the error is still occurring - other .dlls seem to be working fine.

FUNCTION ulong win_GetFocus() ALIAS FOR "GetFocus" LIBRARY "user32.dll"
FUNCTION ulong win_GetClassName(ulong hwnd, ref string cname, int buf) ALIAS FOR "GetClassNameW" LIBRARY "user32.dll"

Upvotes: 0

Views: 315

Answers (1)

Eric Glenn
Eric Glenn

Reputation: 399

Many Windows calls expect ANSI parameters.

Modern versions of PowerBuilder use Unicode character encoding.

I propose that you try

FUNCTION ulong win_GetFocus() ALIAS FOR "GetFocus" LIBRARY "user32.dll;ansi"

Please let us know if this works!

Also the code for line 43 would be exceptionally helpful.

Since you are using your own version of user32.dll, it may be incompatible with the version of Windows. This will cause your application to fail. Additionally, if your version of user32.dll is too old it will not have GetClassNameW which would cause your application to fail.

Upvotes: 1

Related Questions