Jump to content

Unregister GUIRegisterMsg()?


Recommended Posts

Anyone know a way to unregister a WM_NOTIFY Windows MsgID which was registered with GUIRegisterMsg()? The notification is causing major problems with a treeview control in a separate GUI created from the main GUI. I just need to unregister it while the other GUI is open and then I can re-register it after the GUI is closed, unless someone has another idea. Unregistering it will work fine since I don't need it for this other GUI anyway.

I've tried re-registering it to a dummy function, but I get the same results. So the problem isn't the function it calls, it's the notification itself. I've also tried changing the styles and extended styles of the GUI and the treeview, no luck.

Nomad :D

Link to comment
Share on other sites

Have any source code to test with? What kind of TreeView troubles are you running into?

Helpfile -> GuiRegisterMessage

By default after finishing the user function the AutoIt internal message handler will be proceed.

That won't be if yourself Return a value (See WM_COMMAND in example) or if you use the keyword 'Return' without any value.

By using 'Return' without any return value the AutoIt internal message handler (if there is one for this message) will NOT be proceed!

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Have any source code to test with? What kind of TreeView troubles are you running into?

Helpfile -> GuiRegisterMessage

Yes, I've read the help file and I've also tried that. :wacko:

As far as some code, I would have to make a quick sample, which I guess I'll do, unless you'd rather sort through a few thousand lines of If's, For's, Do's, and equations, hehe.

I'll post a sample in a few.

Nomad :D

Link to comment
Share on other sites

Ohhh...thanks for info :D

A bug - normally it should be work with GUIRegisterMsg($WM_NOTIFY, "")...

For more GUI-windows I did some tests - found no problems...

Will wait for your sample.

Greets

Holger

Link to comment
Share on other sites

Ok, here's an example. Took me a while because I was eating and then I had to make it. :wacko:

1) click on the icon control to open the other GUI window.

2) select a process and click open.

3) mess with the listview control on the main GUI. (re-order the columns, double-click an item, etc..)

4) click on the icon control to open the other GUI window again.

5) now try to scroll, or select something.

The control is extremely unresponsive, and the GUI window even distorts. It almost feels like the mouse button is being held down. If you delete the GUIRegisterMsg() function, everything works great, but then you lose the double-click ability on the listview control from the main GUI.

Example.au3

Nomad :D

Link to comment
Share on other sites

Ok, I know now what the problem is but have no idea to solve it so fast:

There is a overlapping issue with the GUIDelete()-function.

The WM_Notify is in progress and while it is running you delete the GUI itself for what the WM_Notify runs.

So there is maybe a return to something nonexisting and so the crash happens.

For the moment you should use GUISetState() with @SW_SHOW and @SW_HIDE instead of always recreating a new GUI.

I will take a look again later...

Link to comment
Share on other sites

Ok, I know now what the problem is but have no idea to solve it so fast:

There is a overlapping issue with the GUIDelete()-function.

The WM_Notify is in progress and while it is running you delete the GUI itself for what the WM_Notify runs.

So there is maybe a return to something nonexisting and so the crash happens.

For the moment you should use GUISetState() with @SW_SHOW and @SW_HIDE instead of always recreating a new GUI.

I will take a look again later...

I can give that a shot, however, the GUI the msg is supposed to be registered for is the main GUI and it's never deleted until the script exits (so i can double-click the listview for performing tasks on it). I moved the GUIRegisterMsg() to where it is now so that I could activate it after the process is selected (to get past the error for the first time anyway). It was in the main GUI creation function before that (which runs as soon as the script starts) and was still getting the same effect.

I'll try messing around with your suggestion. I may also be on to another potential problem, but I'm going to investigate it further before making any assumptions. Thanks for the help so far.

Nomad :D

Link to comment
Share on other sites

I know this isn't exactly what you wanted, but I found this code to be pretty reliable...

Mousewheel movements, clicks in the list, and the use of arrow keys all work well.

The only time it wigs out is when I click on the scrollbar. Even then, it recovers in a moment.

@Holger: Could you take a look at this code and see why it's still happening?

(No GUI deletion/re-creation, no re-registering the message)

Thanks, all!

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Thanks for the attempt, but I've already tried all of that. :D The problem isn't the function, so redirecting at the beginning of the function like you did doesn't change anything. I've registered the notification to a dummy function which contained absolutely nothing, and was the only time in the script I registered it, and it still gave the same effect.

I've also tried moving the GUIRegisterMsg() function to different spots of the script and using the @SW_SHOW/@SW_HIDE macros instead of deleting the process GUI, still the same effect.

Also, if I register the msg before I create the process GUI for the first time then it messes up the first time you create it.

I'm stumped. I thought I was on to something earlier, which as it turns out is a minor error on my part, but it doesn't have any effect on the situation at hand. I've tried everything I can think of, even creating the process GUI as a child of the main. No matter what I do the treeview control on the process GUI just doesn't want to function properly with this msg registered. If I can't figure out a workaround that has no undesired effects, I may just have to do the double-click idea for the listview control another way. But I like this way if it wasn't for the darn treeview error. :wacko:

Maybe I'll just try changing to another control instead. I'd prefer the current setup, but I'd prefer the double-click over the treeview. The double-click is going to be used a lot more than the process GUI. But for all I know another control might not like this either, or it might even be the GUI itself...

This is driving me crazy. Request to developers: Implement a way to unregister msgs in future releases (if it's possible). :D

Nomad :D

Link to comment
Share on other sites

Well, I got it working. It's exactly the way I want it too. I changed from a treeview to a list control, and it looks identical so I'm happy. I still haven't figured out why the treeview didn't like the registered msg though. Now I can move on to the stuff that's really going to give me problems. :D

Here's the working example:

Example.au3

Nomad :wacko:

Link to comment
Share on other sites

Other question: what Autoit-version are you both using?

Hopefully min. Beta 3.1.1.128, don't you?

Prior versions have bigger problems with GUIRegisterMsg().

Excellent news!

I was using 3.1.1.128, but heard that there was a new release today.

After loading v.129 the code from post #8 works great without any changes. :D

Edit: I didn't see anything that seemed relevant to this issue in the changelog.

Thanks, Holger!

Edited by Skruge

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

uh... 3.1.127 :wacko:

I didn't know there was an update today, I'll have to get it. My problem is solved for now, but if it doesn't have this problem with the newer version, then I won't have to worry about running into this again.

Right now I'm working on bigger problems. But so far everything has been working it's way along, slowly but surely. :D

Thanks for the help,

Nomad :D

Edited by Nomad
Link to comment
Share on other sites

Found the crash-bug in an overlapping GUI-WM-message and OnEvent-Message.

Ok, will do some tests again later and then give the infos to the other devs for the next beta release.

Thanks so far.

Holger

Link to comment
Share on other sites

Found the crash-bug in an overlapping GUI-WM-message and OnEvent-Message.

Ok, will do some tests again later and then give the infos to the other devs for the next beta release.

Thanks so far.

Holger

Thanks to you too. I'm glad that you found the problem, and that it wasn't me causing it. :D

Nomad :wacko:

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...