Jump to content

How to optimize GUIRegisterMsg($WM_COPYDATA, "RecieveCopyData")

Recommended Posts

Hi, I am creating a script that is an asynchronous ListView with data that needs to be updated when requested by a client.

The way I am communicating between the client and the Autoit script is using the $WM_COPYDATA registered event.

Basically what happens is Client uses sendCopyData(id, msg)

The Autoit Script fires the event function (recieveCopyData)

which then calls _GUICtrlListView_SetItem(handle... blah blah, msg)

So when I have only 1 client sending msg to the autoit script it updates correctly

However, when i have more than 3 clients trying to get their "row" in the listview updated it tends to get laggy and some of my "copydata" sends are being ignored because they were recieved simultaneously

My question to you is:

1) is there a better way to implement transfer of data between a script and another process

2) is there a faster way to update the GUI

3) should i implement a queue system for copydata

4) what is the difference between using "ON EVENT MODE" vs the GUIGetMsg, is one better or more efficient than the other? (i am currently using on event mode and my main while loop has a delay(1))

Thanks for reading,


Link to post
Share on other sites

1) This is a matter of opinion.

2) You haven't provided any code off which to base a recommendation.

3) Probably yes.

4) This is more a question of code style / design than efficiency, however Sleep(1) is wrong, Sleep(10) is the minimum. And unless you are doing something else in your while loop, there's no reason for a sleep that small. You can just as well have Sleep(1000) or Sleep(1000000). Sleep() does not affect OnEvent mode in your main loop.

Post a reasonable sized example that gives us a better idea what you're trying to do, and we can take a look. I've used WM_COPYDATA in a multi-client environment before - one main process, each additional instance checks if it is the first (if it is, IT is the main process), if not it sends info to the main process.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...