topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 7:08 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Non MSDN online WinAPI reference?  (Read 9979 times)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Non MSDN online WinAPI reference?
« on: June 11, 2009, 06:51 PM »
MSDN seems to be Binged.  Every search ends up on the same page.  Anyone know of a non MSDN online WinAPI reference?  Hopefully something like the dll call, not some subobject?  The simplest APIs seem to be impossible to look up now with Bing snapping up all the searches or whatever is going on at MSDN.

fenixproductions

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,186
    • View Profile
    • Donate to Member
Re: Non MSDN online WinAPI reference?
« Reply #1 on: June 11, 2009, 06:59 PM »
2MilesAhead
Maybe installing Platform SDK on your PC could help you?

I was using it a lot in the past when I had neither MSDN CDs nor Internet connection.

P.S. I have also found this: http://winapi.freete...ecrets.com/index.htm
« Last Edit: June 11, 2009, 07:02 PM by fenixproductions »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Non MSDN online WinAPI reference?
« Reply #2 on: June 11, 2009, 08:21 PM »
Thanks for the reply.  It seems once you get into an MSDN page, then search, it works.  Really bizarre! btw have you done any calls to get Windows7 version?  I keep getting a Major version of 6 and a Minor version of 256, which seems a bit weird. :)
If I go in Computer Properties it claims it's 6.1

edit: ok, I got it.  After masking off the hi byte I needed to shift right 8
Wish they'd just return a damn floating point number like 6.1!!  Jeez!

« Last Edit: June 11, 2009, 08:33 PM by MilesAhead »

fenixproductions

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,186
    • View Profile
    • Donate to Member
Re: Non MSDN online WinAPI reference?
« Reply #3 on: June 11, 2009, 08:39 PM »
2MilesAhead
btw have you done any calls to get Windows7 version?

I neither have Win7 nor need for C++ programming. The only way I can use WinApi these days is PInvoke in C# :)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Non MSDN online WinAPI reference?
« Reply #4 on: June 11, 2009, 09:24 PM »
C# has some nice things built in.  Collections and stuff.  AutoIt3 doesn't have associative arrays or maps or whatever you want to call them, but I found on the AutoIt forum that you can just make an object from Scripting.Dictionary and you're in business.

I'm still getting used to some stuff that's peculiar to script.  One thing that bums me is I don't have a way to do 64 bit shell extensions.  Seemed like 64 bit was never going to get here, then all of a sudden, BAM!! every machine at Best Buy is > 4 GB ram and running 64 bit OS.  It would be nice if I could just recompile my old VC++ 6 32 bit shell stuff.  No such luck. But the hotkey stuff is kind of fun.


f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Non MSDN online WinAPI reference?
« Reply #5 on: June 12, 2009, 07:06 AM »
edit: ok, I got it.  After masking off the hi byte I needed to shift right 8
Wish they'd just return a damn floating point number like 6.1!!  Jeez!
Floating-point is evil and imprecise, fixed-point is precise and easy-peas :)
- carpe noctem

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Non MSDN online WinAPI reference?
« Reply #6 on: June 12, 2009, 12:08 PM »
edit: ok, I got it.  After masking off the hi byte I needed to shift right 8
Wish they'd just return a damn floating point number like 6.1!!  Jeez!
Floating-point is evil and imprecise, fixed-point is precise and easy-peas :)

I'd appreciate it if they put the dot in for me, whatever they use.  The way it is now is a pita.  The lo byte's connected to the hi byte, the hi byte's connected to the shin bone yadda yadda.  There should be OSVersion() spits out 6.1 for W7 period.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Non MSDN online WinAPI reference?
« Reply #7 on: June 12, 2009, 12:35 PM »
Bitshifting is hardly rocket science :)

But use GetVersionEx with the OSVERSIONINFOEX structure, then?
- carpe noctem

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Non MSDN online WinAPI reference?
« Reply #8 on: June 12, 2009, 01:03 PM »
Bitshifting is hardly rocket science :)

But use GetVersionEx with the OSVERSIONINFOEX structure, then?

Why not OSVersion that returns "6.1" ??  Just about any compiled or scripting language can convert the string representation of a number to a numeric data type for comparison.  Instead I have to do it, then convert it back.  Pretty much a time waster.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Non MSDN online WinAPI reference?
« Reply #9 on: June 12, 2009, 01:27 PM »
Depends on how you look at it, and what you need to use the information for.

If you just need to display the version, sure, it would be nice just getting a string back. But this isn't a very common task, compared to the much more common: checking if you're running on a supported platform. It's much easier bitshifting and checking than it is to convert a string or floating-point value... besides, with the following code snippet in MSDN, what's the worry? :)

#include <windows.h>
#include <stdio.h>

void main()
{
    DWORD dwVersion, dwMajorVersion, dwMinorVersion, dwBuild;

    dwVersion = GetVersion();
 
    // Get the Windows version.

    dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
    dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));

    // Get the build number.

    if (dwVersion < 0x80000000)             
        dwBuild = (DWORD)(HIWORD(dwVersion));
    else                                      // Windows Me/98/95
        dwBuild =  0;

    printf("Version is %d.%d (%d)\n",
                dwMajorVersion,
                dwMinorVersion,
                dwBuild);
}
- carpe noctem

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Non MSDN online WinAPI reference?
« Reply #10 on: June 12, 2009, 11:45 PM »
I think this is more useful, at least in AutoIt

;return the Windows version as a number.
;example 6.1 for Windows7, 6 for Vista,
;5.1 for XP etc..
;
; Author MilesAhead
;
Func _WinVersion()
Local $dwVersion = DllCall("kernel32.dll", "dword", "GetVersion")
Local $versionStr = String(BitAND($dwVersion[0], 0x00FF))
$versionStr &= "." & String(BitShift(BitAND($dwVersion[0], 0xFF00), 8))
Return Number($versionStr)
EndFunc   ;==>_WinVersion


MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Non MSDN online WinAPI reference?
« Reply #11 on: June 12, 2009, 11:46 PM »
Or if you prefer ahk

_LoWord(arg)
{
Return arg & 0xFFFF
}

_HiWord(arg)
{
Return arg >> 16
}

_LoByte(arg)
{
Return arg & 0x00FF
}

_HiByte(arg)
{
Return (arg & 0xFF00) >> 8
}

_WinVersionMajor()
{
Return _LoByte(_LoWord(DllCall("kernel32.dll\GetVersion", "UInt", -1)))
}

_WinVersionMinor()
{
Return _HiByte(_LoWord(DllCall("kernel32.dll\GetVersion", "UInt", -1)))
}

_WinVersion()
{
        dwVersion := DllCall("kernel32.dll\GetVersion", "UInt", -1)
Return _LoByte(_LoWord(dwVersion)) . "."
. _HiByte(_LoWord(dwVersion))
}


I didn't say I can't do it.  I just said it's a pain in the ass! :)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Non MSDN online WinAPI reference?
« Reply #12 on: June 13, 2009, 12:36 PM »
With this AutoIt version you can have it both ways. Pass a param of non-zero to return as string, 0 (or leave blank) to return as number

;return the Windows version as a number or string
;according to $retAsString param.
;example 6.1 for Windows7, 6 for Vista,
;5.1 for XP etc.. as number, as string the
;minor version will be preserved even if .0
;(Vista returns "6.0" etc.)
;
; Author MilesAhead
;
Func _WinVersion($retAsString = 0)
    Local $dwVersion = DllCall("kernel32.dll", "dword", "GetVersion")
    Local $versionStr = String(BitAND($dwVersion[0], 0x00FF))
    $versionStr &= "." & String(BitShift(BitAND($dwVersion[0], 0xFF00), 8))
    If $retAsString Then Return $versionStr
    Return Number($versionStr)
EndFunc  ;==>_WinVersion