Issue with @user32.FindWindowA and XPA


Graham White
 

Hi,

 

We have some logic in our XPA3.3 application that upon starting checks to see if there is another instance of the application running it will close the one that has just been launched, however, this seems to have stopped working and I am not sure why or when.  Here is our scenario..

 

We have 2 databases one for New Zealand and one for Australia.  We the user starts our menu application they select which country, the logical name pointers to the location of the database are set and the application is launched perfect.  They can then launch another one but can only go into the other country if they try to go into the same country the system closes the window and exits.  How we have done this is by us changing the window title to the country name and checking if there is another window open with the same name.  This has worked but at some point (new server, hardware windows updates??) it has stopped.

 

The code we use is as follows…

 

If CtxGetName()='Main'

                Invoke UDP @user32.FindWindowA with Arguments – ‘ AA4’, 'WindowsForms10.Window.8.app.0.141b42a_r14_ad1', 'Instance Manager', virtual ‘hWndThis’ N10

                Invoke UDP @user32.FindWindowA with Arguments – ‘ AA4’, 'WindowsForms10.Window.8.app.0.141b42a_ r14_ad1', 'This_Country_Name', virtual ‘hWndThat’ N10

                                If hWndThat<>0 and hWndThis<> hWndThat

                                                Invoke UDP @user32.ShowWindow with Arguments - '440', hWndThat,3

                                Block End

Block End

 

I am not 100% sure of exactly why/how it does/does not work or in fact if it’s the best way of doing it.  I would appreciate any assistance if figuring out why it doesn’t work or a better way of doing it.

 

Regards

 

 

Graham White
Software Developer
Graham.White@...
EC Credit Control |  eccreditcontrol.com

 

IMPORTANT NOTICE: This e-mail message and any attachments are confidential to EC Credit Control and subject to legal privilege (which is not waived or 

lost by mistaken delivery). If you have received this e-mail in error, please advise the sender immediately and destroy the message and any attachments.  

If you are not the intended recipient you are notified that any use, distribution, amendment, copying or any action taken or omitted to be taken in reliance of 

this message or attachments is prohibited. EC Credit Control collects personal information to provide and market our services (see our privacy policy at: 

www.eccreditcontrol.co.nz – www.eccreditcontrol.com - www.eccreditcontrol.com.au for more information about use, disclosure and access). 

EC Credit Control’s liability in connection with transmitting, unauthorised access to, or viruses in this message and its attachments is limited to resupply of 

any affected message or attachments.

Join main@magicu-l.groups.io to automatically receive all group messages.