-
Dec 29th, 2021, 01:36 PM
#1
Thread Starter
Lively Member
[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.
-
Dec 29th, 2021, 01:54 PM
#2
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!
-
Dec 29th, 2021, 02:40 PM
#3
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.
-
Dec 29th, 2021, 02:56 PM
#4
Thread Starter
Lively Member
Re: Getting errors on windows 10
Originally Posted by Arnoutdv
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.
-
Dec 29th, 2021, 02:58 PM
#5
Thread Starter
Lively Member
Re: Getting errors on windows 10
TLP,
Well, I will take a screen shot what is an error.
Baj.
-
Dec 29th, 2021, 03:10 PM
#6
Thread Starter
Lively Member
Re: Getting errors on windows 10
Originally Posted by TysonLPrice
Any chance you can tell us what the error is
TLP,
Here is an error.
Baj.
-
Dec 29th, 2021, 03:14 PM
#7
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.
-
Dec 29th, 2021, 11:12 PM
#8
Thread Starter
Lively Member
Re: Getting errors on windows 10
Originally Posted by DataMiser
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.
-
Dec 29th, 2021, 11:37 PM
#9
Hyperactive Member
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.
-
Dec 30th, 2021, 12:56 AM
#10
Re: Getting errors on windows 10
Originally Posted by rukmi
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
-
Dec 30th, 2021, 01:15 PM
#11
Thread Starter
Lively Member
Re: Getting errors on windows 10
Originally Posted by DataMiser
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.
-
Dec 30th, 2021, 01:24 PM
#12
Thread Starter
Lively Member
Re: Getting errors on windows 10
Originally Posted by Brenker
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|