Modify

Opened 12 years ago

Closed 12 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 by Melba23, 12 years ago

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

in reply to:  1 comment:2 by anonymous, 12 years ago

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 by Melba23, 12 years ago

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

in reply to:  3 comment:4 by anonymous, 12 years ago

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 by Jos, 12 years ago

Resolution: Rejected
Status: newclosed

No bug.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.