flat assembler
Message board for the users of flat assembler.

Index > Windows > Question about NONCLIENTMETRICS

Author
Thread Post new topic Reply to topic
Picnic



Joined: 05 May 2007
Posts: 1393
Location: Piraeus, Greece
Picnic 13 Oct 2013, 09:04
Hello,

I see the NONCLIENTMETRICS structure in MSDN

Code:
typedef struct tagNONCLIENTMETRICS {
  UINT    cbSize;
  int     iBorderWidth;
  int     iScrollWidth;
  int     iScrollHeight;
  int     iCaptionWidth;
  int     iCaptionHeight;
  LOGFONT lfCaptionFont;
  int     iSmCaptionWidth;
  int     iSmCaptionHeight;
  LOGFONT lfSmCaptionFont;
  int     iMenuWidth;
  int     iMenuHeight;
  LOGFONT lfMenuFont;
  LOGFONT lfStatusFont;
  LOGFONT lfMessageFont;
#if (WINVER >= 0x0600)                            ; here
  int     iPaddedBorderWidth;
#endif 
}
    


I want to implement the preprocessor directive in fasm.
Code:
if defined WINVER 
  if WINVER >= 0x600
    iPaddedBorderWidth dd ?
  end if
end if
    


That means i have to define WINVER manually and replace it's value depending the Windows version i compile for each time?
Thank you.

_________________
Hobby BASIC Interpreter
Post 13 Oct 2013, 09:04
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20409
Location: In your JS exploiting you and your system
revolution 13 Oct 2013, 09:09
Probably easier and safer to define the structure member permanently and then in the code check for the windows version at runtime. Also remember you need to adjust the cbSize value accordingly before calling the Windows API.
Post 13 Oct 2013, 09:09
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1393
Location: Piraeus, Greece
Picnic 13 Oct 2013, 10:07
Ah, neat, It says so on remarks Mad
My app now seems to work on both xp/vista. Have a nice day revolution.

Code:
        mov [ncm.cbSize], sizeof.NONCLIENTMETRICS
        mov [lpVersion.dwOSVersionInfoSize], sizeof.OSVERSIONINFO
        invoke GetVersionEx, lpVersion
        .if ( [lpVersion+OSVERSIONINFO.dwMajorVersion] < 6 ) ; #if (WINVER < 0x0600)
                sub [ncm.cbSize], 4
        .endif

    

_________________
Hobby BASIC Interpreter
Post 13 Oct 2013, 10:07
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.