Author Topic: CDN_ constants  (Read 4425 times)

jj2007

  • Member
  • *****
  • Posts: 10636
  • Assembler is fun ;-)
    • MasmBasic
CDN_ constants
« on: September 29, 2012, 07:13:23 AM »
Hutch,
Is there a logic I don't understand, or just a translation error?

Windows.inc:
CDN_INITDONE                     equ 0000h
CDN_SELCHANGE                    equ 0001h
CDN_FOLDERCHANGE                 equ 0002h
CDN_SHAREVIOLATION               equ 0003h
CDN_HELP                         equ 0004h
CDN_FILEOK                       equ 0005h
CDN_TYPECHANGE                   equ 0006h
CDN_INCLUDEITEM                  equ 0007h

CommDlg.h:
#define CDN_FIRST   (0U-601U)
#define CDN_LAST    (0U-699U)

// Notifications from Open or Save dialog
#define CDN_INITDONE            (CDN_FIRST - 0x0000)
#define CDN_SELCHANGE           (CDN_FIRST - 0x0001)
#define CDN_FOLDERCHANGE        (CDN_FIRST - 0x0002)
#define CDN_SHAREVIOLATION      (CDN_FIRST - 0x0003)
#define CDN_HELP                (CDN_FIRST - 0x0004)
#define CDN_FILEOK              (CDN_FIRST - 0x0005)
#define CDN_TYPECHANGE          (CDN_FIRST - 0x0006)
#if (NTDDI_VERSION >= NTDDI_WIN2K)
#define CDN_INCLUDEITEM         (CDN_FIRST - 0x0007)
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7607
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: CDN_ constants
« Reply #1 on: September 29, 2012, 12:27:05 PM »
 :biggrin:

I don't claim to understand the logic you don't understand but it looks like the lead equate is missing and needs to be fixed.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

MichaelW

  • Global Moderator
  • Member
  • *****
  • Posts: 1209
Re: CDN_ constants
« Reply #2 on: September 29, 2012, 01:21:47 PM »
CDN_FIRST and CDN_LAST are defined on lines 15032 and 15033:
Code: [Select]
CDN_FIRST        equ 0-601
CDN_LAST         equ 0-699
But not used for the other definitions.

Code: [Select]
//===================================================================
#include <windows.h>
#include <conio.h>
#include <stdio.h>
//===================================================================

void main( void )
{
    printf( "CDN_FIRST          %d\n", CDN_FIRST );
    printf( "CDN_LAST           %d\n", CDN_LAST );
    printf( "CDN_INITDONE       %d\n", CDN_INITDONE );
    printf( "CDN_SELCHANGE      %d\n", CDN_SELCHANGE );
    printf( "CDN_FOLDERCHANGE   %d\n", CDN_FOLDERCHANGE );
    printf( "CDN_SHAREVIOLATION %d\n", CDN_SHAREVIOLATION );
    printf( "CDN_HELP           %d\n", CDN_HELP );
    printf( "CDN_FILEOK         %d\n", CDN_FILEOK );
    printf( "CDN_TYPECHANGE     %d\n", CDN_TYPECHANGE );
    printf( "CDN_INCLUDEITEM    %d\n", CDN_INCLUDEITEM );
    getch();
}
Code: [Select]
CDN_FIRST          -601
CDN_LAST           -699
CDN_INITDONE       -601
CDN_SELCHANGE      -602
CDN_FOLDERCHANGE   -603
CDN_SHAREVIOLATION -604
CDN_HELP           -605
CDN_FILEOK         -606
CDN_TYPECHANGE     -607
CDN_INCLUDEITEM    -608

One thing I don’t understand in CommDlg.h is why CDN_FIRST and CDN_LAST are specified as unsigned. And since there are no other references to CDN_LAST, I see the possibility that there may be some sort of coding convention in use for common dialogs that may depend on this.



Well Microsoft, here’s another nice mess you’ve gotten us into.

TouEnMasm

  • Member
  • *****
  • Posts: 1391
    • EditMasm
Re: CDN_ constants
« Reply #3 on: September 29, 2012, 05:14:48 PM »
Quote
CDN_FIRST   equ   < 0 - 601>
CDN_LAST   equ   < 0 - 699>
; Notifications from Open or Save dialog
CDN_INITDONE   equ   < CDN_FIRST - 00000h>
CDN_SELCHANGE   equ   < CDN_FIRST - 00001h>
CDN_FOLDERCHANGE   equ   < CDN_FIRST - 00002h>
CDN_SHAREVIOLATION   equ   < CDN_FIRST - 00003h>
CDN_HELP   equ   < CDN_FIRST - 00004h>
CDN_FILEOK   equ   < CDN_FIRST - 00005h>
CDN_TYPECHANGE   equ   < CDN_FIRST - 00006h>
IF ( NTDDI_VERSION GE  NTDDI_WIN2K)
CDN_INCLUDEITEM   equ   < CDN_FIRST - 00007h>
ENDIF ; (NTDDI_VERSION >= NTDDI_WIN2K)
CDM_FIRST   equ   < WM_USER + 100>
CDM_LAST   equ   < WM_USER + 200>
; Messages to query information from the Open or Save dialogs
; lParam = pointer to text buffer that gets filled in
; wParam = max number of characters of the text buffer (including NULL)
; return = < 0 if error; number of characters needed (including NULL)
CDM_GETSPEC   equ   < CDM_FIRST + 00000h>
Fa is a musical note to play with CL