FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log inLog in 


FindWindowEx and VP application architecture [resolved]

Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog
View previous topic :: View next topic  
Author Message
Tonton Luc



FRANCE (Le Touquet)
Joined: 16 Oct 2001
Posts: 1548

PostPosted: 9 Aug 2017 12:23    Post subject: FindWindowEx and VP application architecture [resolved] Reply with quote

Hi,

I've a VP 7.3 application named "Attrib_options_excel.exe" and the title of the task is "Attrib_options_excel".
In the task, there is one form (named "Frm1").
In this form, there is an edit control named "prix" (and other controls).
From an Excel VBA macros, I would like to put a value in this edit control.

How to recover the edit control handle ?
Here is my VBA code :

Sub ApplicationPremierPlan()
    Dim hwnd As Long
    Dim Hwnd_child As Long
    Dim Hwnd_prix As Long

    hwnd = FindWindow("PDCFrame32", "Attrib_options_excel")
    If hwnd > 0 Then
        Hwnd_child = FindWindowEx(hwnd, 0,???, "")
     Else
        Shell "d:\...my_path...\Attrib_options_excel.exe", vbNormalFocus
    End If
End Sub

FindWindow works fine in this code, but how to write FindWindowEx ?


Last edited by Tonton Luc on 10 Aug 2017 10:07; edited 1 time in total
Back to top
View user's profile Send private message
Tonton Luc



FRANCE (Le Touquet)
Joined: 16 Oct 2001
Posts: 1548

PostPosted: 10 Aug 2017 7:21    Post subject: Reply with quote

I've found what I'm looking for :

Sub ApplicationPremierPlan()
    Dim hwnd, Hwnd_child, Hwnd_PDCMDI32, Hwnd_32770, Hwnd_px As Long
 
    hwnd = FindWindow("PDCFrame32", "Attrib_options_excel")
 
    If hwnd > 0 Then
        BringWindowToTop hwnd
        ShowWindow hwnd, 1
        Hwnd_child = FindWindowEx(hwnd, 0&, "MDIClient", "")
        If Hwnd_child > 0 Then
            Hwnd_PDCMDI32 = FindWindowEx(Hwnd_child, 0&, "PDCMDI32", "")
            If Hwnd_PDCMDI32 > 0 Then
                Hwnd_32770 = FindWindowEx(Hwnd_PDCMDI32, 0&, "#32770", "")
                If Hwnd_32770 > 0 Then
                    Hwnd_px = FindWindowEx(Hwnd_32770, 0&, "Edit", "Référence_plage_excel")
                    If Hwnd_px > 0 Then
                        Call SendMessageByString(Hwnd_px, WM_SETTEXT, 0&, Selection.Address)
                    End If
                End If
            End If
        End If
     Else
        Shell "d:\...my_path...\Attrib_options_excel.exe", vbNormalFocus
    End If
End Sub

Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum