Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    Roby-chan82 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Location
    Verona, Italy
    Posts
    9

    @isladogs you're right, sorry!

    Here it is:
    Code:
    #If VBA7 Then
    Private Declare PtrSafe Function ChooseFont Lib "comdlg32.dll" Alias "ChooseFontA" _
    (pChoosefont As FONTSTRUC) As Long
    Private Declare PtrSafe Function GlobalLock Lib "kernel32" (ByVal hMem As LongPtr) As LongPtr
    Private Declare PtrSafe Function GlobalAlloc Lib "kernel32" _
      (ByVal wFlags As Long, ByVal dwBytes As LongPtr) As LongPtr
    Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
    (hpvDest As Any, hpvSource As Any, ByVal cbCopy As LongPtr)
    Private Declare PtrSafe Function GetDeviceCaps Lib "gdi32" _
      (ByVal hdc As LongPtr, ByVal nIndex As Long) As Long
    Private Declare PtrSafe Function GetDC Lib "user32" (ByVal hWnd As LongPtr) As LongPtr
    #Else
    Private Declare PtrSafe Function ChooseFont Lib "comdlg32.dll" Alias "ChooseFontA" _
    (pChoosefont As FONTSTRUC) As Long
    Private Declare PtrSafe Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
    Private Declare PtrSafe Function GlobalAlloc Lib "kernel32" _
      (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
    Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
    (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
    Private Declare PtrSafe Function GetDeviceCaps Lib "gdi32" _
      (ByVal hdc As Long, ByVal nIndex As Long) As Long
    Private Declare PtrSafe Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
    #End If
    Thanks!
    Roby

  2. #17
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    You're welcome

    BTW in post #5 I mentioned GetTickCount & GetTickCount64
    I've just used GetTickCount in 64-bit and it works fine. Not quite sure why GetTickCount64 exists as it seems to be superfluous
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #18
    Roby-chan82 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Location
    Verona, Italy
    Posts
    9

    Another small issue with date....

    @isladogs ... Sorry to bother you again!!
    I have encountered another small problem.
    In my DB there is a DAte field, which I can usually modify, when I update the clients' profile.
    In this case when I click on it, VBasic opens to this problem:

    Code:
     If intCurrentMonth > 12 Then
                intCurrentMonth = intCurrentMonth - 12 '1
                intCurrentYear = intCurrentYear + 1
                End If
                aMDS(x).lpMONTHDAYSTATE = mc.GetDAYSTATE(intCurrentYear, intCurrentMonth)
                intCurrentMonth = intCurrentMonth + 1
                Next x
                ' set the address of our array
                lngTemp = VarPtr(aMDS(0))
                CopyMem ByVal lparam + (Len(nmds) - 4), lngTemp, 4
            
                ' Signal we want this message to be processed
                WindowProc = 0
                Exit Function
                
       
                Case Else
                WindowProc = DefWindowProc(hWnd, message, wparam, lparam)
    It says that VarPtr is a "non-correspondent type".
    What can I do?

    Thank you a lot...
    Roby

    Quote Originally Posted by isladogs View Post
    You're welcome

    BTW in post #5 I mentioned GetTickCount & GetTickCount64
    I've just used GetTickCount in 64-bit and it works fine. Not quite sure why GetTickCount64 exists as it seems to be superfluous

  4. #19
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    I've never used VarPtr and in fact don't think I've ever seen it before now.
    Did a quick online search and found this http://vb.mvps.org/tips/varptr/
    You'll find other similar items if you search. Hope that helps
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #20
    Roby-chan82 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Location
    Verona, Italy
    Posts
    9
    I read it, but I cannot understand a thing!!
    I tried few things, on a copy of the original DB, but nothing works...

  6. #21
    daolix is offline Novice
    Windows 10 Access 2007
    Join Date
    Feb 2019
    Posts
    5
    lngTemp = VarPtr(...
    The prefix of your variable suggests that it is declared as long. Varptr returns a LongPtr under 64bit.

  7. #22
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Hi daolix.
    Just to thank you properly for your wizhook code suggestion on your only other post
    In case you are interested, you can see how I made use of that here http://www.mendipdatasystems.co.uk/m...ols/4594549378
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  8. #23
    Roby-chan82 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Location
    Verona, Italy
    Posts
    9
    Quote Originally Posted by daolix View Post
    The prefix of your variable suggests that it is declared as long. Varptr returns a LongPtr under 64bit.
    Thank you!
    So, how do I correct it, to let it work properly?

    Roby

  9. #24
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    As Daolix hasn't responded I suggested you do the following.

    Do a VBA search for Dim lngTemp As Long
    Replace that with Dim lngTemp As LongPtr

    Run Debug...Compile. Assuming that compiles your code should then (hopefully) work.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  10. #25
    Roby-chan82 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Location
    Verona, Italy
    Posts
    9
    Quote Originally Posted by isladogs View Post
    As Daolix hasn't responded I suggested you do the following.

    Do a VBA search for Dim lngTemp As Long
    Replace that with Dim lngTemp As LongPtr

    Run Debug...Compile. Assuming that compiles your code should then (hopefully) work.

    Hi Isladogs...
    I did what you suggested.
    and when i Run Debug...Compile, here what happens:

    Code:
      LF.lfWeight = f.Weight  LF.lfItalic = f.Italic * -1
      LF.lfUnderline = f.UnderLine * -1
      LF.lfHeight = -MulDiv(CLng(f.Height), GetDeviceCaps(GetDC(hWndAccessApp), LOGPIXELSY), 72)
      Call StringToByte(f.name, LF.lfFaceName())
      FS.rgbColors = f.Color
      FS.lStructSize = Len(FS)
    
    
        FS.hWnd = hWnd ' April 2 FOnt Dialog is BEHIND CALENDAR!!! Application.hWndAccessApp
    
    
      lMemHandle = GlobalAlloc(GHND, Len(LF))
      If lMemHandle = 0 Then
        DialogFont = False
        Exit Function
      End If
    GlobalAlloc pops up like a mistake. It say it's a "non-correspondent type".

    boh...
    Roby

  11. #26
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    I can only guess as I've no idea what the code is meant to be doing.

    Have you defined GHND anywhere?
    Also the previous line FS.hwnd=hwnd looks wrong to me.

    Did the compile process get past the previous issue?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  12. #27
    Roby-chan82 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Location
    Verona, Italy
    Posts
    9
    Quote Originally Posted by isladogs View Post
    I can only guess as I've no idea what the code is meant to be doing.

    Have you defined GHND anywhere?
    Also the previous line FS.hwnd=hwnd looks wrong to me.

    Did the compile process get past the previous issue?
    Dear Isladogs,
    sorry for my late reply... I didn't work on it lately.

    I just tried to open my DB, and tried to set today's date.
    Here is what happens:

    Code:
    ' From code by Ray Mercer
        ' Set up and register window class
        wc.cbSize = Len(wc)
        wc.style = CS_HREDRAW Or CS_VREDRAW
        
        ' Determine Access Version
        ' **************************
        ' For A97 MUST USE AddrOf
        ' **************************
        'If Val(SysCmd(acSysCmdAccessVer)) < 8 Then
        'wc.lpfnWndProc = AddrOf("WindowProc")
        'Else
        wc.lpfnWndProc = GetFuncPtr(AddressOf WindowProc)
        'End If
    I suppose the previous issue got resolved by itself!?
    Now I have "Addressof WindowProc" popping up.
    Any suggestion??

    Will I ever be able to correct every error on this very old DB?
    It seems like a soap-opera!
    Roby

    PS: I didn't build this DB, another person did it... so I never defined GHND... and honestly I don't even know what it means!
    I'm so sorry to bother you all.
    I tried to build a new DB with another program, but it was so difficult, and I followed some tutorial on YT, then someone in a forum told me it was full of errors in the code that I should restart to build it again. I depressed myself, so I'm trying to fix this old one in Access...
    Last edited by Roby-chan82; 04-06-2019 at 07:11 AM. Reason: added PS

  13. #28
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Quote Originally Posted by Roby-chan82 View Post
    Dear Isladogs,
    sorry for my late reply... I didn't work on it lately.

    I just tried to open my DB, and tried to set today's date.
    ….
    I suppose the previous issue got resolved by itself!?
    Now I have "Addressof WindowProc" popping up.
    Any suggestion??

    Will I ever be able to correct every error on this very old DB?
    It seems like a soap-opera!
    Roby

    PS: I didn't build this DB, another person did it... so I never defined GHND... and honestly I don't even know what it means!
    I'm so sorry to bother you all.
    I tried to build a new DB with another program, but it was so difficult, and I followed some tutorial on YT, then someone in a forum told me it was full of errors in the code that I should restart to build it again. I depressed myself, so I'm trying to fix this old one in Access...
    You got the new error trying to set the date???? I don't understand.
    Remember that I have no idea what the code should do so can't advise on this issue
    Converting very old databases with many APIs and obscure code to 64-bit can sometimes be very difficult and its often easier to start again.
    You may have said once but if so I've forgotten. What is the purpose of this code?
    Have you searched online for other alternatives apart from the one in your PS
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Difficult Query!
    By pastormcnabb in forum Queries
    Replies: 2
    Last Post: 04-09-2013, 09:40 PM
  2. Replies: 2
    Last Post: 04-09-2013, 07:42 PM
  3. difficult query
    By methis in forum Queries
    Replies: 2
    Last Post: 03-18-2013, 02:36 PM
  4. A Difficult One...(I Think)
    By NickyThorne1 in forum Access
    Replies: 0
    Last Post: 01-31-2009, 07:56 AM
  5. Difficult problem
    By francisca_carv in forum Access
    Replies: 0
    Last Post: 11-19-2008, 05:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums