AutoHotkey Community

It is currently May 27th, 2012, 11:55 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: June 5th, 2007, 8:49 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Dear corrupt, :)

:o Very comprehensive list and nicely done! :D

just a doubt:

WS_OVERLAPPEDWINDOW := (WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX)

What does that Or do ? Sorry for the noobish question!

My CSV version has only integers for the second field, like:

WS_OVERLAPPEDWINDOW := 0xCF0000

Is it worth evaluating and converting all these into numbers?

Regards, :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 5th, 2007, 9:01 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
Skan wrote:
:o Very comprehensive list and nicely done! :D
Thanks :) . There may be a few bugs though. I used a script to process the list and have only inspected a few random vales so far.

Skan wrote:
just a doubt:

WS_OVERLAPPEDWINDOW := (WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX)

What does that Or do ?
I think it should probably read WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX

Skan wrote:
My CSV version has only integers for the second field, like:

WS_OVERLAPPEDWINDOW := 0xCF0000

Is it worth evaluating and converting all these into numbers?
It might be. It probably depends on how you use the constants in your code. If you use them as variables then it shouldn't be necessary but if you add the output in a comment then use the value in the code then it would be convenient. I'm currently using adding comments and adding values to the code but might switch to using variables soon for readability.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 5th, 2007, 9:12 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
corrupt wrote:
If you use them as variables then it shouldn't be necessary but if you add the output in a comment then use the value in the code then it would be convenient. I'm currently using adding comments and adding values to the code but might switch to using variables soon for readability.


Would not something like this be better ?

Code:
WS_OVERLAPPEDWINDOW := 0xCF0000 ; ( WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX )


Thanks for suggesting API viewer 2004. I had never used it.

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2007, 3:49 pm 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
Search Keywords: api constants value hex

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2007, 5:04 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
I chose the title to be Win32 constants because some of the constants can be used directly in AHK. :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 12th, 2007, 6:39 pm 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
Need to remember this post as im always lookign for it :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 8th, 2007, 6:02 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
This is absolutely beautiful. I have been struggling with figuring these out. No more! Thanks for the handy tool.

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2008, 7:29 am 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
Trying to track down a Win32 constant can many times be very frustrating. :evil: After remembering that I had downloaded this tool a while back I was able to find several constants that were difficult if not impossible to find otherwise.

Thanks. :) Keep up the good work!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2008, 10:19 am 
jballi wrote:
Trying to track down a Win32 constant can many times be very frustrating.

...unfortunately a straight Google on the constant most/some of the time doesn't get the number, it normally gets the MSDN article about the constant, but not the number behind it...however using my VARNAME site:ddart.net...trick (mentioned here), normally DOES work...click the link, then replace VARNAME with a windows constant, like WM_COMMAND...

Also can I take this time to encourage everyone to assign the constant, not just lookup the number then put the number directly in the code...

For example...don't do this...

Code:
PostMessage, 0x0012

...but instead do this...

Code:
WM_QUIT:=0x0012
PostMessage, WM_QUIT

...& no, I don't like seeing this either...

Code:
PostMessage, 0x0012   ;//WM_QUIT

...a comment explaining it doesn't help me...best to define all the constants in one place, so the rest of the code is clear. The whole reason Windows has these constants is so people DON'T have weird numbers all over the code, but it seems as if most AutoHotkeyers like magic numbers littering their code...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2008, 11:43 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
Anonymous wrote:
a comment explaining it doesn't help me...best to define all the constants in one place, so the rest of the code is clear.
AutoHotkey doesn't have #define so what's the point of creating useless variables. If you have a performance critical application it makes more sense to hard code the value than to XAND if you know every value.

Anonymous wrote:
The whole reason Windows has these constants is so people DON'T have weird numbers all over the code
That's not the only reason.

Hey Skan I've just compiled a list of Vista 32bit ANSI constants if you're interested :)

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2008, 3:58 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Anonymous wrote:
encourage everyone to assign the constant, not just lookup the number then put the number directly in the code
It depends... In compiled, optimized code constants don’t cost anything, but sometimes make the code more readable. Not always. But in an interpreted language constant names are added to the table of variables, consuming memory and slowing down all dynamic variable references: the interpreter has to search for the name in a longer list. In AHK I prefer
Code:
 PostMessage 0x0012   ; WM_QUIT


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2008, 1:19 am 
Titan wrote:
AutoHotkey doesn't have #define so what's the point of creating useless variables.

...well of course I want a #define & I also want to hide all the "useless variables"...but I work with what I've got...I've only got "normal" vars, so I use em...

Laszlo wrote:
...the interpreter has to search for the name in a longer list.

...ah!...didn't think of a performance hit, I only noticed the "useless variables" in ListVars...but until AutoHotkey gets #define, I'll just have to live with the performance hit, since I can't stand magic numbers in code...

For completeness, I'd like to mention AutoHotkey needs #define, working exactly like C's define...replace all #defines at load-time, so there's not run-time performance hit...which also hides #defines from ListVars...& also perhaps a Const option...with does almost the same as a #define, cept would be listed in ListVars...so a Const would only be resolved once at load-time but be visible in ListVars (for whatever reason)...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2008, 7:39 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Titan wrote:
Hey Skan I've just compiled a list of Vista 32bit ANSI constants if you're interested :)


:D . thanks Titan, I will look into it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 28th, 2008, 10:19 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
If you don't mind me reviving this topic, I'd have a suggestion:
since (sadly) Vista is taking up more and more users percentage but there still are Win9x users (like myself, for example), I thought it would be a good idea to add another field to the window, to show the Windows version range the selected constant can be found in.

This would be helpful in avoiding the usage of unsupported constants in older Windows versions.

Also, a small note: on my Win98SE system I couldn't find any icon in USER32.DLL, so I just switched to USER.EXE, which shows the info (i) icon.
The code could be modified as follows:
if A_OSVersion in WIN_95,WIN_98,WIN_ME
Menu, Tray, Icon, C:\Windows\System\USER.EXE, 5
else
Menu, Tray, Icon, USER32.DLL, 5

_________________
AHK tools by Drugwash (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, notsoobvious, rrhuffy, Yahoo [Bot] and 28 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group