Modify

Opened 6 years ago

Closed 6 years ago

#2847 closed Bug (Rejected)

Handle from string

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: 3.3.13.17 Severity: None
Keywords: Cc:

Description

From help for function HWnd()
No literal string should be converted to an HWND

From ticket #2820

Oddly "192.txt" messes up when it is forced to convert from a string into a handle and ends up evaluating as 192 or C0.


Autoit v3.3.13.17 beta (Win7 x86)

WinExists("192.txt") ; 0
HWnd("192.txt") ; 0x000000C0

Is this correct result?

Thanks.

Attachments (0)

Change History (5)

comment:1 follow-up: Changed 6 years ago by Melba23

As the Help file specifically says that HWnd should not be passed strings as an argument why are you deliberately doing so? And why are you surprised when you get an indeterminate result?

Just do not use string arguments and the problem does not arise.

M23

comment:2 in reply to: ↑ 1 Changed 6 years ago by anonymous

Replying to Melba23:

As the Help file specifically says that HWnd should not be passed strings as an argument

That was removed in the 3.3.13.17 beta help file.

comment:3 follow-up: Changed 6 years ago by Melba23

My point remains - you are knowingly passing something which under no circumstances would be converted into a valid handle to a function which is intended to produce one. If you do not do this the problem never arises.

I have only ever used the HWnd function to retrieve handles which might have been converted to other datatypes when stored during script execution - that works without problem. Passing a random string as a parameter is just wilful misuse - stop doing it and there is no problem.

M23

comment:4 in reply to: ↑ 3 Changed 6 years ago by anonymous

Replying to Melba23:

My point remains - you are knowingly passing something which under no circumstances would be converted into a valid handle to a function which is intended to produce one.

I didn't create this ticket. That was just a remark.
If you use that documentation file, then you don't know that a string literal is somthing which under no circumstances would be converted into a valid handle.

Passing a random string as a parameter is just wilful misuse - stop doing it and there is no problem.

It's a creative misuse. Other language implementors encourage it to discover what the language is missing.

comment:5 Changed 6 years ago by Jos

  • Resolution set to Rejected
  • Status changed from new to closed

No bug.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.