Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a file

Status
Not open for further replies.

jennyek2000

Programmer
Sep 2, 2003
43
GB
Hi

I have never used the Windows API before and am a mere beginner at VB.NET.

What I need to know is how to open a file of any type using a windows API call (or is there a better way?). I know how to use the VB.NET openfiledialog and plan to use this in my application. I also found this function definition on a tutorial on the web:

Declare Function OpenFile Lib "kernel32" Alias "OpenFile" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long

I put this in the general declarations section, but for a start it says that OFSTRUCT is not declared. How do I do this? Also how do I use this function to open a file?

If anyone can help me I would be very happy as my first work project needs to be done by next week! I am panicking :-(

Jenny
 


System.Diagnostics.Process.Start("notepad")

Scott
Programmer Analyst
<{{><
 
Try adding the following to your code.

Public Structure OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName(OFS_MAXPATHNAME) As Byte
End Type

The API u use is using a User Defined Type
You have to declare the type.

I think this should answer your problem.

To search or to post - that is the question.
To search first and to post later. THAT is the answer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top