Results 1 to 12 of 12

Thread: [RESOLVED] Getting errors on windows 10

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    111

    Resolved [RESOLVED] Getting errors on windows 10

    Hi Member,
    I need some help from you here.
    I just installed OS Windows 10 to my PC, currently I am using Windows 7.
    I tried my project on OS Windows 10, then I got an error message when I used the code below.

    Code:
      Private Sub Form_Load()
    If Dir("C:\WINDOWS\Filemysystem.INI") = "" Then
    MkDir "C:\WINDOWS\Filemysystem.INI"
    Close #1
    Open "C:\WINDOWS\Filemysystem.INI" For Input As #1
    
    Input #1, MytreTree1PathTr3
    Close #1
    MytreTree1.Path = MytreTree1PathTr3
    MytreTree1.InitialDir = MytreTree1PathTr3
    File1.Path = MytreTree1PathTr3 .Path
    End If
    On Error Resume Next
    End Sub
    Before I tested it on Windows 7, there was no error.
    Could anyone here, can help me what is wrong and what happened?.
    On OS Windows 10, I tried other code and there are no problems, it means my IDE is installed on this system as well.


    Baj.

  2. #2
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,834

    Re: Getting errors on windows 10

    I got an error message when I used the code below
    Any chance you can tell us what the error is
    Please remember next time...elections matter!

  3. #3
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: Getting errors on windows 10

    In normal situations a program can not create files or directories in the Windows folder.

    Also you create a directory and then try to open it as if it was a file.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    111

    Re: Getting errors on windows 10

    Quote Originally Posted by Arnoutdv View Post
    In normal situations a program can not create files or directories in the Windows folder.

    Also you create a directory and then try to open it as if it was a file.
    Arnoutdv,
    Thanks for info.
    Here is a video, this run well on windows 7.


    Baj.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    111

    Re: Getting errors on windows 10

    TLP,
    Well, I will take a screen shot what is an error.

    Baj.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    111

    Re: Getting errors on windows 10

    Quote Originally Posted by TysonLPrice View Post
    Any chance you can tell us what the error is
    TLP,
    Here is an error.
    Name:  Run Time Error.JPG
Views: 206
Size:  13.8 KB

    Baj.

  7. #7
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Getting errors on windows 10

    I would think that on the system where it is working that ini file exists in the target location and on the other system it does not.

    The code would throw an error on the mkdir function if that file is not present as you are using a filename as a directory name and trying to create it in a location that is restricted.

    It looks like some redesign is in order.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    111

    Re: Getting errors on windows 10

    Quote Originally Posted by DataMiser View Post
    I would think that on the system where it is working that ini file exists in the target location and on the other system it does not.

    The code would throw an error on the mkdir function if that file is not present as you are using a filename as a directory name and trying to create it in a location that is restricted.

    It looks like some redesign is in order.
    DataMiser,
    I agree with your statement, that W7 is working fine and W10 is not working, it's my point, could there be some other way or API to make it work between both OS.

    Do you have any sample code to make it work, refer to this need and function to create a folder into C.

    Baj.

  9. #9
    Hyperactive Member
    Join Date
    Sep 2014
    Posts
    373

    Re: Getting errors on windows 10

    Not only there may be spots with different treatments between Win 7 and Win 10, but also between the earlier Win 10 and the latest Win 10. The code below is to clear the image and mask DIBs of Animated GIF frames upon my GIF class termination. Two years ago in 2019, these code lines were perfectly okay on Vista, Win 7 and Win 10, but would crash, without an error flag, on the later Win 10 upgrade (I don't know since when)

    Code:
        'If m_FrameCount > 0 Then
        '     For i = 1 To m_FrameCount
        '            'This line will cause crash under Windows 10 
        '           'If Not (m_FrameImage(i).frDIBXOR.DIBhDIB = 0) Then
        '                Set m_FrameImage(i).frDIBXOR = Nothing
        '           'End If
        '           'If Not (m_FrameImage(i).frDIBAND.DIBhDIB = 0) Then
        '                Set m_FrameImage(i).frDIBAND = Nothing
        '           'End If
        '     Next i
        'End If
    
        Redim m_FrameImage(0)
    Last edited by Brenker; Dec 29th, 2021 at 11:44 PM.

  10. #10
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Getting errors on windows 10

    Quote Originally Posted by rukmi View Post
    DataMiser,
    I agree with your statement, that W7 is working fine and W10 is not working, it's my point, could there be some other way or API to make it work between both OS.

    Do you have any sample code to make it work, refer to this need and function to create a folder into C.

    Baj.
    Manually create the file and place it there and it may work which is probably what was done on the other system. The code shown should fail on any version of Windows if that file is not present.

    What you should be doing is creating the file in a proper location and not in the Windows folder. You also should look up mkdir() and how to create a file and if this truly is an INI file you should be using the API functions for reading and writing to INI files as well as pointing to a proper folder like AppData

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    111

    Re: Getting errors on windows 10

    Quote Originally Posted by DataMiser View Post
    Manually create the file and place it there and it may work which is probably what was done on the other system. The code shown should fail on any version of Windows if that file is not present.

    What you should be doing is creating the file in a proper location and not in the Windows folder. You also should look up mkdir() and how to create a file and if this truly is an INI file you should be using the API functions for reading and writing to INI files as well as pointing to a proper folder like AppData
    DataMiser,
    Thank you for explaining this.
    I changed that and used a command button, it means when the program is run that piece of code is not in Form_Load, but I place it under command button and ...amazingly it worked well.

    Once it is running then I toggle the button and there is no error coming.

    After I look it work then I add one Form as startup form, with a button, then once it button is toggle then Form1 as startup form is unload then Form2 is show, then automatically called button in Form2 is activated, in form1 I did this way ( Form1.Command1.Value = True ), I found from here https://www.vbforums.com/showthread....n-another-form (si_the_geek).

    So my problem is solved.

    Baj.

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Mar 2018
    Location
    Bandung
    Posts
    111

    Re: Getting errors on windows 10

    Quote Originally Posted by Brenker View Post
    Not only there may be spots with different treatments between Win 7 and Win 10, but also between the earlier Win 10 and the latest Win 10. The code below is to clear the image and mask DIBs of Animated GIF frames upon my GIF class termination. Two years ago in 2019, these code lines were perfectly okay on Vista, Win 7 and Win 10, but would crash, without an error flag, on the later Win 10 upgrade (I don't know since when)

    Code:
        'If m_FrameCount > 0 Then
        '     For i = 1 To m_FrameCount
        '            'This line will cause crash under Windows 10 
        '           'If Not (m_FrameImage(i).frDIBXOR.DIBhDIB = 0) Then
        '                Set m_FrameImage(i).frDIBXOR = Nothing
        '           'End If
        '           'If Not (m_FrameImage(i).frDIBAND.DIBhDIB = 0) Then
        '                Set m_FrameImage(i).frDIBAND = Nothing
        '           'End If
        '     Next i
        'End If
    
        Redim m_FrameImage(0)
    Brenker,
    Thanks for some description about the errors.
    I done already this problem, I am did not understand till now, why I place that pieces code under Form_Load it getting an errors, but it work well if that pieces code under command button, it mean when the program is run, it will not straight to run that pieces code, seems like need to stable then it will fine.

    I am not sure why...?


    Baj.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width