Hi everyone,
I have my application that works into SAP BusinessOne
To open my windows into SAP MDI I get SAP MDI handle's and set this as parent to my windows using windows api SetParent
I don't know why but some windows open without issue others don't show, powerbuilder function Open works but window is not visible.
I'm using PowerBuilder 2022 R3 3289 on Windows 2019 Server 64bit, 64bit environment
If I use my application builded with PowerBuilder R2 build 2819 I don't have this issue.
Any suggestions?
Thanks
-----------------------------------------------------------------------------------------------------------
Window open event
long ll_rc
long ll_hPBWindow
long ll_parent_handle
ll_parent_handle = wf_get_handle_sap(string(gole_sbo_application.Desktop.Title))
ll_hPBWindow = handle(This)
ll_rc = SetParent( ll_hPBWindow, ll_parent_handle)
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
Function to get SAP MDI handle's wf_get_handle_sap(string as_windowname)
Constant long GW_HWNDFIRST = 0
Constant long GW_HWNDLAST = 1
Constant long GW_HWNDNEXT = 2
Constant long GW_HWNDPREV = 3
Constant long GW_OWNER = 4
Constant long GW_CHILD = 5
Constant long GW_MAX = 5
Constant long MAX_WIDTH = 1255
long ll_hFrameWindow
long ll_hParentWindow
long ll_Desktop
long ll_Child
String ls_WindowName
String ls_ClassName
String ls_ieopened
SetNull( ls_WindowName )
ll_hFrameWindow = FindWindowA( 'TMFrameClass', as_windowname)
ll_Child = GetWindow( ll_hFrameWindow, GW_CHILD )
DO WHILE (ll_Child > 0)
ls_ClassName = Space(MAX_WIDTH)
ls_WindowName = Space(MAX_WIDTH)
GetClassNameW( ll_Child, ls_ClassName, MAX_WIDTH )
GetWindowTextW( ll_Child, ls_WindowName, MAX_WIDTH )
IF ls_classname = 'TMMDIClientClass' and IsWindowVisible(ll_Child) THEN
Return ll_Child
END IF
ll_Child = GetWindow( ll_Child, GW_HWNDNEXT )
LOOP
Return ll_Child
------------------------------------------------------------------------------------------------------------
What's important right now is that the existing code does not work. Does the code check for error conditions from the various API functions? Doing so may help you discover why the code is not working.
Calling a DLL function from PB is a very low-level operation, where a lot of factors all need to be correct in order for the DLL interface to work correctly. The rules for 64-bit apps are a little different because the size/length of memory addresses (pointers) and Windows handles are 64-bit. These changes can affect structures, as well (not in your case, thankfully, since the API functions you are calling do not pass any structures).