Autor Beitrag
Biarchiv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Di 23.08.05 13:39 
Hey,

wenn ein Fremdprogramm eine Dateioffen hat die ich auch nicht
zum lesen öffen kann, prüfen lassen.

Oder gibt es da OpenFile, CreateFile,... das mir eine -1 ruckgibt? Währe so auch recht.


Danke...
azrael_7
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 78

Windows Vista
D2005 Pers. [de]
BeitragVerfasst: Di 23.08.05 13:45 
Titel: Re: Möglichkeit Dateien zum lesen öffnen (niemals Fehlermeld
user profile iconBiarchiv hat folgendes geschrieben:
wenn ein Fremdprogramm eine Dateioffen hat die ich auch nicht
zum lesen öffen kann, prüfen lassen.


Sorry... Bitte was?!? wer prüft wen worauf? *confused* 'n bisserl genauer bitte...


Zuletzt bearbeitet von azrael_7 am Di 23.08.05 13:51, insgesamt 1-mal bearbeitet
zero_cool1986
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

MS DOS ;)
D6
BeitragVerfasst: Di 23.08.05 13:46 
Drück dich mal etwas besser aus ich hab nix verstanden was willst du wie würdest du es verwirklichen.. und was ist dein Problem...
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Di 23.08.05 14:04 
Titel: Re: Möglichkeit Dateien zum lesen öffnen (niemals Fehlermeld
user profile iconBiarchiv hat folgendes geschrieben:
wenn ein Fremdprogramm eine Dateioffen hat die ich auch nicht zum lesen öffen kann, prüfen lassen.

ich finde diese wort-konstruktion (Satz kann man das nicht nennen) echt zu geil, das ist weder ne frage, sonst etwas, mehr sowas wie ne aussage, aber ich kann da echt nichts draus lesen.

soll da vielleicht noch ein "Wie kann ich, " davor ? und ein "?" dahinter ? ich glaube dann macht es schon mehr sinn. :lol:
Biarchiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Di 23.08.05 15:37 
Hey,

sorry für meine Verwirrfragen.

Mir ist es schon öfter passiert wenn ich ZB:
eine Datei öffne die ein anderes Programm auch gerade offen
hat das ein E/A Fehler ausgespuckt wird.

Grund kann nicht geöffnet werden da ein anderes Programm
die Datei gerade Exclusiv Lesen und Schreiben geöffnet hat.

Also EA Fehler...
Wie geht das nun das keine Fehler sonder nichts zurückgegeben wird so das ich weiß Datei kann nicht geöffnet werden...

ZB: Manche DLL Dateien die vom Windows-Kernel offen sind.
Grendel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 443

Gentoo Linux, MacOS X, Win 2000
D5 Ent, D7 Ent, Lazarus, Anjuta, MonoDevelop
BeitragVerfasst: Di 23.08.05 15:47 
user profile iconBiarchiv hat folgendes geschrieben:
Also EA Fehler...
Wie geht das nun das keine Fehler sonder nichts zurückgegeben wird so das ich weiß Datei kann nicht geöffnet werden...

Wie wäre es z.B. mit try except?!

Bis neulich ...
ebs
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 213

Suse Linux 9.2, Win 98, Win NT, Win XP, Win for Workgroups, Win XP SP2, Dos 6.1
D3 Prof, D2005 PE, Delphi 2006 Prof.
BeitragVerfasst: Di 23.08.05 15:50 
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
OpenFile

The OpenFile function creates, opens, reopens, or deletes a file.

Note  This function is provided only for compatibility with 16-bit versions of Windows. New applications should use the CreateFile function.


HFILE OpenFile(
  LPCSTR lpFileName,
  LPOFSTRUCT lpReOpenBuff,
  UINT uStyle
);

Parameters
lpFileName 
[in] Pointer to a null-terminated string that names the file to be opened. The string must consist of characters from the Windows character set. The OpenFile function does not support Unicode file names. Also, OpenFile does not support opening named pipes. 
lpReOpenBuff 
[out] Pointer to the OFSTRUCT structure that receives information about the file when it is first opened. The structure can be used in subsequent calls to the OpenFile function to see the open file. 
The OFSTRUCT structure contains a pathname string member whose length is limited to OFS_MAXPATHNAME characters. OFS_MAXPATHNAME is currently defined to be 128. Because of this, you cannot use the OpenFile function to open a file whose path length exceeds 128 characters. The CreateFile function does not have such a path length limitation.

uStyle 
[in] Action to take. This parameter can be one or more of the following values. Value Meaning 
OF_CANCEL Ignored. To produce a dialog box containing a Cancel button, use OF_PROMPT. 
OF_CREATE Creates a new file. If the file already exists, it is truncated to zero length. 
OF_DELETE Deletes the file. 
OF_EXIST Opens the file and then closes it. Used to test for a file's existence. 
OF_PARSE Fills the OFSTRUCT structure but carries out no other action. 
OF_PROMPT Displays a dialog box if the requested file does not exist. The dialog box informs the user that the system cannot find the file, and it contains Retry and Cancel buttons. Choosing the Cancel button directs OpenFile to return a file-not-found error message. 
OF_READ Opens the file for reading only. 
OF_READWRITE Opens the file for reading and writing. 
OF_REOPEN Opens the file using information in the reopen buffer. 
OF_SHARE_COMPAT For MS-DOS–based file systems, opens the file with compatibility mode, allowing any process on a specified computer to open the file any number of times. Other efforts to open with any other sharing mode fail. 
This flag is mapped to the CreateFile function's FILE_SHARE_READ | FILE_SHARE_WRITE flags.
 
OF_SHARE_DENY_NONE Opens the file without denying read or write access to other processes. On MS-DOS-based file systems, if the file has been opened in compatibility mode by any other process, the function fails. 
This flag is mapped to the CreateFile function's FILE_SHARE_READ | FILE_SHARE_WRITE flags.
 
OF_SHARE_DENY_READ Opens the file and denies read access to other processes. On MS-DOS-based file systems, if the file has been opened in compatibility mode or for read access by any other process, the function fails. 
This flag is mapped to the CreateFile function's FILE_SHARE_READ | FILE_SHARE_WRITE flags.
 
OF_SHARE_DENY_WRITE Opens the file and denies write access to other processes. On MS-DOS-based file systems, if the file has been opened in compatibility mode or for write access by any other process, the function fails. 
This flag is mapped to the CreateFile function's FILE_SHARE_READ | FILE_SHARE_WRITE flags.
 
OF_SHARE_EXCLUSIVE Opens the file with exclusive mode, denying both read and write access to other processes. If the file has been opened in any other mode for read or write access, even by the current process, the function fails. 
OF_VERIFY Verifies that the date and time of the file are the same as when it was previously opened. This is useful as an extra check for read-only files. 
OF_WRITE Opens the file for writing only. 

Return Values
If the function succeeds, the return value specifies a file handle.

If the function fails, the return value is HFILE_ERROR. To get extended error information, call GetLastError.


Remarks
If the lpFileName parameter specifies a file name and extension only, this function searches for a matching file in the following directories, in the order shown:


The directory from which the application loaded. 
The current directory. 
The Windows system directory. Use the GetSystemDirectory function to get the path of this directory. 
The 16-bit Windows system directory. There is no function that retrieves the path of this directory, but it is searched. 
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory. 
The directories that are listed in the PATH environment variable. 

The lpFileName parameter cannot contain wildcard characters.

The OpenFile function does not support the OF_SEARCH flag supported by the 16-bit Windows OpenFile function. The OF_SEARCH flag directs the system to search for a matching file even when the file name includes a full path. To search for a file, use the SearchPath function.


A sharing violation will occur if an attempt is made to open a file or directory for deletion on a remote machine when the value of the uStyle parameter is the OF_DELETE access flag OR'ed with any other access flag, and the remote file or directory has not been opened with FILE_SHARE_DELETE share access. To avoid the sharing violation in this scenario, open the remote file or directory with OF_DELETE access only or call DeleteFile without first opening the file or directory for deletion.


Windows Me/98/95:  This remark does not apply.




Requirements
Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, and Windows 95.
Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.


See Also
File Management Functions, CreateFile, GetSystemDirectory, GetWindowsDirectory, OFSTRUCT, SearchPath


Alles klar?
Biarchiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Di 23.08.05 16:03 
Danke...