|
-
Mar 21st, 2000, 06:55 PM
#1
Thread Starter
Fanatic Member
When I use the CreateFile API function on my machine (win2000) it works perfectly, but when I create an installation and install it on another machine (win95), I am forever getting back -1.
Any ideas why it stops working?
-
Mar 22nd, 2000, 12:02 AM
#2
Lively Member
This page will tell you all about the CreateFile API.
http://www.vbapi.com/ref/c/createfile.html
It should work okay on Windows 95, so you might have to use the GetLastError Function to shed some light on the problem.
Good luck.
-
Mar 22nd, 2000, 01:36 AM
#3
Thread Starter
Fanatic Member
I read through the suggested page, and as far as I can make out my problem seems to be, I am passing in a Security Attribute structure for the lpSecurityAttributes parameter. This works fine on NT and 2000, but not on 95 and 98. For 95, 98 I need to pass in a 0 (byval clng(0)).
The thing is how can I tell what version of windows is running?
More so, if I try to put in a condition to pass in one parameter or the other, my code won't compile as 2000 doesn't like the passing of a 0.
Help please, I'm new to API and am getting tied in knots!!!
-
Mar 22nd, 2000, 06:00 PM
#4
Junior Member
To get Version info of Windows put this code into a module:
Option Explicit
Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
And put this in your form
Option Explicit
Private Sub Form_Load()
Dim os As OSVERSIONINFO ' receives version information
Dim retval As Long ' return value
os.dwOSVersionInfoSize = Len(os) ' set the size of the structure
retval = GetVersionEx(os) ' read Windows's version information
Select Case retval
Case 1
MsgBox "Win95/98"
Case 2
MsgBox "Win NT"
Case 0
MsgBox "Win 3.x"
End Select
End Sub
Retval returns the version of windows you have.
Hope this helps,
Hutchie
-
Mar 22nd, 2000, 07:09 PM
#5
Thread Starter
Fanatic Member
Excellent.
Thanks a lot.
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
|