Problem on incorporting code from the Access 2000 Developer's Handbook

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Uttam

    Problem on incorporting code from the Access 2000 Developer's Handbook

    Hello,

    I am using the code from Chapter 17 specifically the code from the
    font frmListFonts in my application.

    I have taken care to copy all the relevant modules / class modules
    into the respective files / folders etc. Nevertheless, I get the
    following error when I start my application:

    Compile error; Sub or Function not defined

    This error is displayed on the following line of which "GetDC" is
    selected.

    hdc = GetDC(HWND_DESK TOP)

    I have all the 7 Class Modules from Ch17.mdb as also all the Modules.
    These were exported from Ch17.mdb into a file and later imported into
    my application.

    I am unable to fathom what is going wrong here - can someone help?

    Thanks in advance.

    Uttam
  • TC

    #2
    Re: Problem on incorporting code from the Access 2000 Developer's Handbook

    I don't have that book, but, GetDC is a so-called "windows API". It must be
    defined in a DECLARE statement. See if you can find such a statement. If you
    can't, that is the problem. If you can, try making it say PUBLIC DECLARE ...
    (not PRIVATE DECLARE ...).

    HTH,
    TC


    "Uttam" <u0107@usa.ne t> wrote in message
    news:8a9f572f.0 309112046.34cc3 146@posting.goo gle.com...[color=blue]
    > Hello,
    >
    > I am using the code from Chapter 17 specifically the code from the
    > font frmListFonts in my application.
    >
    > I have taken care to copy all the relevant modules / class modules
    > into the respective files / folders etc. Nevertheless, I get the
    > following error when I start my application:
    >
    > Compile error; Sub or Function not defined
    >
    > This error is displayed on the following line of which "GetDC" is
    > selected.
    >
    > hdc = GetDC(HWND_DESK TOP)
    >
    > I have all the 7 Class Modules from Ch17.mdb as also all the Modules.
    > These were exported from Ch17.mdb into a file and later imported into
    > my application.
    >
    > I am unable to fathom what is going wrong here - can someone help?
    >
    > Thanks in advance.
    >
    > Uttam[/color]


    Comment

    • TC

      #3
      Re: Problem on incorporting code from the Access 2000 Developer's Handbook

      Try posting the whole content of the module that gets the error. And be sure
      to repeat exactly what the error is, & on what line it occurs.

      HTH,
      TC


      "Uttam" <u0107@usa.ne t> wrote in message
      news:8a9f572f.0 309131831.77c99 d8@posting.goog le.com...[color=blue]
      > Hello,
      >
      > I tried Terry's solution. The declarations section does contain the
      > code as suggested by Terry. Nevertheless the problem still occurs.
      >
      > One thing I discovered was that when running the example in the book,
      > there is one reference to Microsoft Forms 2.0 Object which I installed
      > explicitly. The list of references in my app now match that in
      > Chapter 17.
      >
      > Still I get the problem.
      >
      > Any other suggestions please?
      >
      > Thanks
      >
      > Uttam
      >
      >
      > "Terry Kreft" <terry.kreft@mp s.co.uk> wrote in message[/color]
      news:<bjrssl$67 c$1@newsreaderg 1.core.theplane t.net>...[color=blue][color=green]
      > > Well the problem is most likely that you haven't declared GetDC or you
      > > haven't declared HWND_DESKTOP or they aren't in scope
      > >
      > > To check which it is
      > > Open the code window
      > > put the cursor inside teh word GetDC
      > > Press Shift-F2 on the keyboard
      > >
      > > If you've declared it and it is in scope the cursor will jump to the
      > > declaration
      > >
      > > Then do the same with HWND_DESKTOP
      > >
      > > Once you know which is missinig it is easy to declare them.
      > >
      > > Private Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As
      > > Long) As Long
      > > Private Const HWND_DESKTOP = 0
      > >
      > > both of which go in the declarations section of the module.
      > >
      > > Terry
      > >
      > > "Uttam" <u0107@usa.ne t> wrote in message
      > > news:8a9f572f.0 309112046.34cc3 146@posting.goo gle.com...[color=darkred]
      > > > Hello,
      > > >
      > > > I am using the code from Chapter 17 specifically the code from the
      > > > font frmListFonts in my application.
      > > >
      > > > I have taken care to copy all the relevant modules / class modules
      > > > into the respective files / folders etc. Nevertheless, I get the
      > > > following error when I start my application:
      > > >
      > > > Compile error; Sub or Function not defined
      > > >
      > > > This error is displayed on the following line of which "GetDC" is
      > > > selected.
      > > >
      > > > hdc = GetDC(HWND_DESK TOP)
      > > >
      > > > I have all the 7 Class Modules from Ch17.mdb as also all the Modules.
      > > > These were exported from Ch17.mdb into a file and later imported into
      > > > my application.
      > > >
      > > > I am unable to fathom what is going wrong here - can someone help?
      > > >
      > > > Thanks in advance.
      > > >
      > > > Uttam[/color][/color][/color]


      Comment

      • Michael \(michka\) Kaplan [MS]

        #4
        Re: Problem on incorporting code from the Access 2000 Developer's Handbook

        The important fact to realize -- ACCESS controls do not have HWNDs, except a
        few of them do when they have the focus. Forms^3 (Forms 2.0) controls never
        have HWNDs, at all. The book explains these facts.


        --
        MichKa [MS]

        This posting is provided "AS IS" with
        no warranties, and confers no rights.


        "Uttam" <u0107@usa.ne t> wrote in message
        news:8a9f572f.0 309131831.77c99 d8@posting.goog le.com...[color=blue]
        > Hello,
        >
        > I tried Terry's solution. The declarations section does contain the
        > code as suggested by Terry. Nevertheless the problem still occurs.
        >
        > One thing I discovered was that when running the example in the book,
        > there is one reference to Microsoft Forms 2.0 Object which I installed
        > explicitly. The list of references in my app now match that in
        > Chapter 17.
        >
        > Still I get the problem.
        >
        > Any other suggestions please?
        >
        > Thanks
        >
        > Uttam
        >
        >
        > "Terry Kreft" <terry.kreft@mp s.co.uk> wrote in message[/color]
        news:<bjrssl$67 c$1@newsreaderg 1.core.theplane t.net>...[color=blue][color=green]
        > > Well the problem is most likely that you haven't declared GetDC or you
        > > haven't declared HWND_DESKTOP or they aren't in scope
        > >
        > > To check which it is
        > > Open the code window
        > > put the cursor inside teh word GetDC
        > > Press Shift-F2 on the keyboard
        > >
        > > If you've declared it and it is in scope the cursor will jump to the
        > > declaration
        > >
        > > Then do the same with HWND_DESKTOP
        > >
        > > Once you know which is missinig it is easy to declare them.
        > >
        > > Private Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As
        > > Long) As Long
        > > Private Const HWND_DESKTOP = 0
        > >
        > > both of which go in the declarations section of the module.
        > >
        > > Terry
        > >
        > > "Uttam" <u0107@usa.ne t> wrote in message
        > > news:8a9f572f.0 309112046.34cc3 146@posting.goo gle.com...[color=darkred]
        > > > Hello,
        > > >
        > > > I am using the code from Chapter 17 specifically the code from the
        > > > font frmListFonts in my application.
        > > >
        > > > I have taken care to copy all the relevant modules / class modules
        > > > into the respective files / folders etc. Nevertheless, I get the
        > > > following error when I start my application:
        > > >
        > > > Compile error; Sub or Function not defined
        > > >
        > > > This error is displayed on the following line of which "GetDC" is
        > > > selected.
        > > >
        > > > hdc = GetDC(HWND_DESK TOP)
        > > >
        > > > I have all the 7 Class Modules from Ch17.mdb as also all the Modules.
        > > > These were exported from Ch17.mdb into a file and later imported into
        > > > my application.
        > > >
        > > > I am unable to fathom what is going wrong here - can someone help?
        > > >
        > > > Thanks in advance.
        > > >
        > > > Uttam[/color][/color][/color]


        Comment

        • Michael \(michka\) Kaplan [MS]

          #5
          Re: Problem on incorporting code from the Access 2000 Developer's Handbook

          "Uttam" <u0107@usa.ne t> wrote...
          [color=blue]
          > Thanks Terry for offering to help. Here goes:
          >
          > I have marked the specific line where the error occurs with
          >
          > "========>"
          >
          > On that line the text "GetDC" is highlighted with a pop up message
          > which says:
          >
          > Compile Error. Sub or function not defined.[/color]

          UM... Your Declare statement for GetDC is marked "Private" and its in
          another module. Thus as far as your code is concerned, its not defined.


          --
          MichKa [MS]

          This posting is provided "AS IS" with
          no warranties, and confers no rights.



          Comment

          • TC

            #6
            Re: Problem on incorporting code from the Access 2000 Developer's Handbook

            Hi Uttam

            I'm TC, not Terry!

            As the other respondent said, in Module1, you have "Private Declare..."
            throughout. The Private keyword menas that each of those declarations is
            only visible to code within Module1. It is not visible within any other
            module. Try changing all those "Private"s to "Public"s, and try again (ie.
            Public Declare...).

            HTH,
            TC



            "Uttam" <u0107@usa.ne t> wrote in message
            news:8a9f572f.0 309141724.29a82 140@posting.goo gle.com...[color=blue]
            > Thanks Terry for offering to help. Here goes:
            >
            > I have marked the specific line where the error occurs with
            >
            > "========>"
            >
            > On that line the text "GetDC" is highlighted with a pop up message
            > which says:
            >
            > Compile Error. Sub or function not defined.
            >
            >
            >
            > Private Sub New_Font_List_C ombo_Load()
            > '---------------------------------
            >
            >
            >
            > '
            > ' This function fills in the array of suggested TrueType font
            > sizes.
            > ' It also fills in the array holding all the information about the
            > ' available fonts. If the first font is a raster font, it gets the
            > ' available font sizes for that font.
            > '
            > Dim hdc As Long
            >
            > On Error GoTo HandleErrors
            >
            > mintCountTTSize s = 16
            > maintTTSizes = Array(8, 9, 10, 11, 12, 14, 16, _
            > 18, 20, 22, 24, 26, 28, 36, 48, 72)
            > =======> hdc = GetDC(HWND_DESK TOP)
            > If hdc <> 0 Then
            > ' Get the number of fonts.
            > mlngCountFonts = adh_accGetFontC ount(hdc)
            > ' If there are fonts, dimension the array
            > ' to be the right size.
            > If mlngCountFonts > 0 Then
            > ReDim mafiFonts(0 To mlngCountFonts - 1)
            > ' Fill mafiFonts() with the font names.
            > mlngCountFonts = adh_accGetFontL ist(hdc, mafiFonts())
            > End If
            > <snip><snip><sn ip><snip><snip> <snip><snip><sn ip><snip><snip>
            >
            >
            > In Module1 where all my global variables and my commonly called sub
            > routines are coded, I have the following code:
            >
            >
            >
            >
            > Option Explicit
            >
            > ' From Access 2000 Developer's Handbook, Volume I
            > ' by Getz, Litwin, and Gilbert. (Sybex)
            > ' Copyright 1999. All rights reserved.
            >
            > ' This module contains replacements for the font
            > ' handling procedures provided by Access 97 internally.
            > ' Because Access 2000 doesn't provide these procedures
            > ' you can use these replacements for any existing
            > ' code. You might want to investigate the ScreenInfo
            > ' object for future development, as it provides
            > ' this same information in a simpler manner.
            >
            > ' In this module:
            > ' adh_accGetFontC ount
            > ' adh_accGetFontL ist
            > ' adh_accGetSizeC ount
            > ' adh_accGetSizeL ist
            > '
            > ' Requires:
            > ' basCommon
            > ' basFontCommon
            >
            > ' Indicate that a parameter for Quicksort is missing.
            > Private Const dhcMissing = -2
            >
            > ' =============== =
            > ' API Declarations
            > ' =============== =
            > Private Const LOGPIXELSX = 88 ' Logical pixels/inch in X
            > Private Const LOGPIXELSY = 90
            > Private Const HWND_DESKTOP = 0
            > Private Const LF_FACESIZE = 32
            > Private Const DEFAULT_CHARSET = 1
            >
            > Private Declare Function GetDeviceCaps _
            > Lib "gdi32" _
            > (ByVal hdc As Long, ByVal nIndex As Long) As Long
            >
            > Private Declare Function MulDiv _
            > Lib "kernel32" _
            > (ByVal nNumber As Long, ByVal nNumerator As Long, _
            > ByVal nDenominator As Long) As Long
            >
            > Private Declare Function EnumFontFamilie s _
            > Lib "gdi32" Alias "EnumFontFamili esA" _
            > (ByVal hdc As Long, ByVal lpszFamily As String, _
            > ByVal lpEnumFontFamPr oc As Long, ByVal lParam As Long) As Long
            >
            > Private Declare Function CreateFontIndir ect _
            > Lib "gdi32" Alias "CreateFontIndi rectA" _
            > (lpLogFont As LOGFONT) As Long
            >
            > Private Declare Function GetDC _
            > Lib "USER32" _
            > (ByVal hWnd As Long) As Long
            >
            > Private Declare Function ReleaseDC _
            > Lib "USER32" _
            > (ByVal hWnd As Long, ByVal hdc As Long) As Long
            >
            >
            > *-*-*-*-*-*-*-*-*-*-*
            >
            > As you can see, I have GetDC defined above.
            >
            > Just to explain, I have copied this "as is" from the book with only
            > the variables names of the drop down box changed to match what is on
            > my application.
            >
            > Thanks once again.
            >
            > Cheers!
            >
            > Uttam
            >
            > =============== =
            >
            >
            >
            >
            > "TC" <a@b.c.d> wrote in message news:<106351821 4.847834@teutho s>...[color=green]
            > > Try posting the whole content of the module that gets the error. And be[/color][/color]
            sure[color=blue][color=green]
            > > to repeat exactly what the error is, & on what line it occurs.
            > >
            > > HTH,
            > > TC
            > >
            > >
            > > "Uttam" <u0107@usa.ne t> wrote in message
            > > news:8a9f572f.0 309131831.77c99 d8@posting.goog le.com...[color=darkred]
            > > > Hello,
            > > >
            > > > I tried Terry's solution. The declarations section does contain the
            > > > code as suggested by Terry. Nevertheless the problem still occurs.
            > > >
            > > > One thing I discovered was that when running the example in the book,
            > > > there is one reference to Microsoft Forms 2.0 Object which I installed
            > > > explicitly. The list of references in my app now match that in
            > > > Chapter 17.
            > > >
            > > > Still I get the problem.
            > > >
            > > > Any other suggestions please?
            > > >
            > > > Thanks
            > > >
            > > > Uttam
            > > >
            > > >
            > > > "Terry Kreft" <terry.kreft@mp s.co.uk> wrote in message[/color]
            > > news:<bjrssl$67 c$1@newsreaderg 1.core.theplane t.net>...[color=darkred]
            > > > > Well the problem is most likely that you haven't declared GetDC or[/color][/color][/color]
            you[color=blue][color=green][color=darkred]
            > > > > haven't declared HWND_DESKTOP or they aren't in scope
            > > > >
            > > > > To check which it is
            > > > > Open the code window
            > > > > put the cursor inside teh word GetDC
            > > > > Press Shift-F2 on the keyboard
            > > > >
            > > > > If you've declared it and it is in scope the cursor will jump to the
            > > > > declaration
            > > > >
            > > > > Then do the same with HWND_DESKTOP
            > > > >
            > > > > Once you know which is missinig it is easy to declare them.
            > > > >
            > > > > Private Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal[/color][/color][/color]
            hwnd As[color=blue][color=green][color=darkred]
            > > > > Long) As Long
            > > > > Private Const HWND_DESKTOP = 0
            > > > >
            > > > > both of which go in the declarations section of the module.
            > > > >
            > > > > Terry
            > > > >
            > > > > "Uttam" <u0107@usa.ne t> wrote in message
            > > > > news:8a9f572f.0 309112046.34cc3 146@posting.goo gle.com...
            > > > > > Hello,
            > > > > >
            > > > > > I am using the code from Chapter 17 specifically the code from the
            > > > > > font frmListFonts in my application.
            > > > > >
            > > > > > I have taken care to copy all the relevant modules / class modules
            > > > > > into the respective files / folders etc. Nevertheless, I get the
            > > > > > following error when I start my application:
            > > > > >
            > > > > > Compile error; Sub or Function not defined
            > > > > >
            > > > > > This error is displayed on the following line of which "GetDC" is
            > > > > > selected.
            > > > > >
            > > > > > hdc = GetDC(HWND_DESK TOP)
            > > > > >
            > > > > > I have all the 7 Class Modules from Ch17.mdb as also all the[/color][/color][/color]
            Modules.[color=blue][color=green][color=darkred]
            > > > > > These were exported from Ch17.mdb into a file and later imported[/color][/color][/color]
            into[color=blue][color=green][color=darkred]
            > > > > > my application.
            > > > > >
            > > > > > I am unable to fathom what is going wrong here - can someone help?
            > > > > >
            > > > > > Thanks in advance.
            > > > > >
            > > > > > Uttam[/color][/color][/color]


            Comment

            • Uttam

              #7
              Works! Re: Problem on incorporting code from the Access 2000 Developer's Handbook

              I owe you an apology TC.

              Converting to Public certainly works - now I have to grapple with some
              other logical errors, which I will be able to solve by myself.

              To all who responded to my query - THANK YOU all!

              Cheers!

              Uttam
              =============== =

              "TC" <a@b.c.d> wrote in message news:<106361564 3.882313@teutho s>...[color=blue]
              > Hi Uttam
              >
              > I'm TC, not Terry!
              >
              > As the other respondent said, in Module1, you have "Private Declare..."
              > throughout. The Private keyword menas that each of those declarations is
              > only visible to code within Module1. It is not visible within any other
              > module. Try changing all those "Private"s to "Public"s, and try again (ie.
              > Public Declare...).
              >
              > HTH,
              > TC
              >
              >
              >
              > "Uttam" <u0107@usa.ne t> wrote in message
              > news:8a9f572f.0 309141724.29a82 140@posting.goo gle.com...[color=green]
              > > Thanks Terry for offering to help. Here goes:
              > >
              > > I have marked the specific line where the error occurs with
              > >
              > > "========>"
              > >
              > > On that line the text "GetDC" is highlighted with a pop up message
              > > which says:
              > >
              > > Compile Error. Sub or function not defined.
              > >
              > >
              > >
              > > Private Sub New_Font_List_C ombo_Load()
              > > '---------------------------------
              > >
              > >
              > >
              > > '
              > > ' This function fills in the array of suggested TrueType font
              > > sizes.
              > > ' It also fills in the array holding all the information about the
              > > ' available fonts. If the first font is a raster font, it gets the
              > > ' available font sizes for that font.
              > > '
              > > Dim hdc As Long
              > >
              > > On Error GoTo HandleErrors
              > >
              > > mintCountTTSize s = 16
              > > maintTTSizes = Array(8, 9, 10, 11, 12, 14, 16, _
              > > 18, 20, 22, 24, 26, 28, 36, 48, 72)
              > > =======> hdc = GetDC(HWND_DESK TOP)
              > > If hdc <> 0 Then
              > > ' Get the number of fonts.
              > > mlngCountFonts = adh_accGetFontC ount(hdc)
              > > ' If there are fonts, dimension the array
              > > ' to be the right size.
              > > If mlngCountFonts > 0 Then
              > > ReDim mafiFonts(0 To mlngCountFonts - 1)
              > > ' Fill mafiFonts() with the font names.
              > > mlngCountFonts = adh_accGetFontL ist(hdc, mafiFonts())
              > > End If
              > > <snip><snip><sn ip><snip><snip> <snip><snip><sn ip><snip><snip>
              > >
              > >
              > > In Module1 where all my global variables and my commonly called sub
              > > routines are coded, I have the following code:
              > >
              > >
              > >
              > >
              > > Option Explicit
              > >
              > > ' From Access 2000 Developer's Handbook, Volume I
              > > ' by Getz, Litwin, and Gilbert. (Sybex)
              > > ' Copyright 1999. All rights reserved.
              > >
              > > ' This module contains replacements for the font
              > > ' handling procedures provided by Access 97 internally.
              > > ' Because Access 2000 doesn't provide these procedures
              > > ' you can use these replacements for any existing
              > > ' code. You might want to investigate the ScreenInfo
              > > ' object for future development, as it provides
              > > ' this same information in a simpler manner.
              > >
              > > ' In this module:
              > > ' adh_accGetFontC ount
              > > ' adh_accGetFontL ist
              > > ' adh_accGetSizeC ount
              > > ' adh_accGetSizeL ist
              > > '
              > > ' Requires:
              > > ' basCommon
              > > ' basFontCommon
              > >
              > > ' Indicate that a parameter for Quicksort is missing.
              > > Private Const dhcMissing = -2
              > >
              > > ' =============== =
              > > ' API Declarations
              > > ' =============== =
              > > Private Const LOGPIXELSX = 88 ' Logical pixels/inch in X
              > > Private Const LOGPIXELSY = 90
              > > Private Const HWND_DESKTOP = 0
              > > Private Const LF_FACESIZE = 32
              > > Private Const DEFAULT_CHARSET = 1
              > >
              > > Private Declare Function GetDeviceCaps _
              > > Lib "gdi32" _
              > > (ByVal hdc As Long, ByVal nIndex As Long) As Long
              > >
              > > Private Declare Function MulDiv _
              > > Lib "kernel32" _
              > > (ByVal nNumber As Long, ByVal nNumerator As Long, _
              > > ByVal nDenominator As Long) As Long
              > >
              > > Private Declare Function EnumFontFamilie s _
              > > Lib "gdi32" Alias "EnumFontFamili esA" _
              > > (ByVal hdc As Long, ByVal lpszFamily As String, _
              > > ByVal lpEnumFontFamPr oc As Long, ByVal lParam As Long) As Long
              > >
              > > Private Declare Function CreateFontIndir ect _
              > > Lib "gdi32" Alias "CreateFontIndi rectA" _
              > > (lpLogFont As LOGFONT) As Long
              > >
              > > Private Declare Function GetDC _
              > > Lib "USER32" _
              > > (ByVal hWnd As Long) As Long
              > >
              > > Private Declare Function ReleaseDC _
              > > Lib "USER32" _
              > > (ByVal hWnd As Long, ByVal hdc As Long) As Long
              > >
              > >
              > > *-*-*-*-*-*-*-*-*-*-*
              > >
              > > As you can see, I have GetDC defined above.
              > >
              > > Just to explain, I have copied this "as is" from the book with only
              > > the variables names of the drop down box changed to match what is on
              > > my application.
              > >
              > > Thanks once again.
              > >
              > > Cheers!
              > >
              > > Uttam
              > >
              > > =============== =
              > >
              > >
              > >
              > >
              > > "TC" <a@b.c.d> wrote in message news:<106351821 4.847834@teutho s>...[color=darkred]
              > > > Try posting the whole content of the module that gets the error. And be[/color][/color]
              > sure[color=green][color=darkred]
              > > > to repeat exactly what the error is, & on what line it occurs.
              > > >
              > > > HTH,
              > > > TC
              > > >
              > > >
              > > > "Uttam" <u0107@usa.ne t> wrote in message
              > > > news:8a9f572f.0 309131831.77c99 d8@posting.goog le.com...
              > > > > Hello,
              > > > >
              > > > > I tried Terry's solution. The declarations section does contain the
              > > > > code as suggested by Terry. Nevertheless the problem still occurs.
              > > > >
              > > > > One thing I discovered was that when running the example in the book,
              > > > > there is one reference to Microsoft Forms 2.0 Object which I installed
              > > > > explicitly. The list of references in my app now match that in
              > > > > Chapter 17.
              > > > >
              > > > > Still I get the problem.
              > > > >
              > > > > Any other suggestions please?
              > > > >
              > > > > Thanks
              > > > >
              > > > > Uttam
              > > > >
              > > > >
              > > > > "Terry Kreft" <terry.kreft@mp s.co.uk> wrote in message[/color][/color]
              > news:<bjrssl$67 c$1@newsreaderg 1.core.theplane t.net>...[color=green][color=darkred]
              > > > > > Well the problem is most likely that you haven't declared GetDC or[/color][/color]
              > you[color=green][color=darkred]
              > > > > > haven't declared HWND_DESKTOP or they aren't in scope
              > > > > >
              > > > > > To check which it is
              > > > > > Open the code window
              > > > > > put the cursor inside teh word GetDC
              > > > > > Press Shift-F2 on the keyboard
              > > > > >
              > > > > > If you've declared it and it is in scope the cursor will jump to the
              > > > > > declaration
              > > > > >
              > > > > > Then do the same with HWND_DESKTOP
              > > > > >
              > > > > > Once you know which is missinig it is easy to declare them.
              > > > > >
              > > > > > Private Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal[/color][/color]
              > hwnd As[color=green][color=darkred]
              > > > > > Long) As Long
              > > > > > Private Const HWND_DESKTOP = 0
              > > > > >
              > > > > > both of which go in the declarations section of the module.
              > > > > >
              > > > > > Terry
              > > > > >
              > > > > > "Uttam" <u0107@usa.ne t> wrote in message
              > > > > > news:8a9f572f.0 309112046.34cc3 146@posting.goo gle.com...
              > > > > > > Hello,
              > > > > > >
              > > > > > > I am using the code from Chapter 17 specifically the code from the
              > > > > > > font frmListFonts in my application.
              > > > > > >
              > > > > > > I have taken care to copy all the relevant modules / class modules
              > > > > > > into the respective files / folders etc. Nevertheless, I get the
              > > > > > > following error when I start my application:
              > > > > > >
              > > > > > > Compile error; Sub or Function not defined
              > > > > > >
              > > > > > > This error is displayed on the following line of which "GetDC" is
              > > > > > > selected.
              > > > > > >
              > > > > > > hdc = GetDC(HWND_DESK TOP)
              > > > > > >
              > > > > > > I have all the 7 Class Modules from Ch17.mdb as also all the[/color][/color]
              > Modules.[color=green][color=darkred]
              > > > > > > These were exported from Ch17.mdb into a file and later imported[/color][/color]
              > into[color=green][color=darkred]
              > > > > > > my application.
              > > > > > >
              > > > > > > I am unable to fathom what is going wrong here - can someone help?
              > > > > > >
              > > > > > > Thanks in advance.
              > > > > > >
              > > > > > > Uttam[/color][/color][/color]

              Comment

              Working...