English
Regulars table & Café

OpenFileMapping.

 

Description:

OpenFileMapping opens one with CreateFileMapping erzeugtes benanntes Filemapping Objekt and supply which lever back.


Deklaration:

DEF @OpenFileMapping(3) !kernel32,OpenFileMappingA


Parameter:

1.Parameter: One Flag for Zugriffsmodus the lever.
-$2 = only reading.
-$4 = write and reading.
-$8 = reading and write, but not The disk. under NT-based Systemen write only actually Process.
2.Parameter: One Flag, the specify, whether the zurückgegebene lever on others processes vererbt go can. =>
-1 = can vererbt go.
-0 = can't vererbt go.
3.Parameter: One String or a Memory-Variable with a String, the whom names the To öffnenden Dateiabbildungsprojektes contains.


Return Value:

0 with failure, otherwise the lever the Dateiabbildungsprojektes.


Examples:

example 1
DEF @CopyMemory(3) !kernel32,RtlMoveMemory
DEF @CreateFileMapping(6) !kernel32,CreateFileMappingA
Def @CloseHandle(1) !kernel32,CloseHandle
DEF @GetLastError() !kernel32,GetLastError
DEF @WriteFile(5) !kernel32,WriteFile
Def @MapViewOfFile(5) !kernel32,MapViewOfFile
DEf @UnmapViewOfFile(1) !kernel32,UnmapViewOfFile
DEF @CopyMemory(3) !kernel32,RtlMoveMemory
DEF @CreateFile(7) !kernel32,CreateFileA
WINDOWSTYLE 31+512
Windowtitle here becomes The Variable created
WINDOW 0,0-300,400
Declare Tick&,name$,Ausgelesen#
Declare Speicherhandle&,Speicheraddr&,Dateihandle&
Declare Dateiname$,Text$,Written#,Dateilänge&
LET TEXT$=From the 1.File written
LET DATEINAME$=C:TEST.TXT
LET DateiHandle&=@CreateFile(@ADDR(Dateiname$),$80000000+$40000000,0,0,4,$80,0)
Dim Written#,4
@WriteFile(DateiHandle&,@ADDR(TEXT$),@len(Text$),Written#,0)
Dispose Written#
Let name$=AH-File
LET Speicherhandle&=@CreateFileMapping(DateiHandle&,0,4,0,0,@addr(name$))
DrawText 0,50,lever the Speicherbereichs: +@STR$(Speicherhandle&)
LET Speicheraddr&=@MapViewOfFile(Speicherhandle&,2,0,0,0)

Whilenot %MENUITEM=-2

    IF &GETTICKCOUNT-Tick&>10000

        @CopyMemory(Speicheraddr&,@addr(Text$),@len(Text$))
        LET TICK&=&GETTICKCOUNT

    endif

    DIM Ausgelesen#,256
    Clear Ausgelesen#
    @CopyMemory(Ausgelesen#,Speicheraddr&,@len(Text$))
    DrawText 0,80,Text=+@String $(Ausgelesen#,0)+
    Dispose Ausgelesen#
    Sleep 10

WEND

@CloseHandle(Speicherhandle&)
@CloseHandle(DateiHandle&)
Beep 1

DEF @OpenFileMapping(3) !kernel32,OpenFileMappingA
DEF @GetLastError() !kernel32,GetLastError
Def @MapViewOfFile(5) !kernel32,MapViewOfFile
DEf @UnmapViewOfFile(1) !kernel32,UnmapViewOfFile
DEF @CopyMemory(3) !kernel32,RtlMoveMemory
Def @CloseHandle(1) !kernel32,CloseHandle
Windowtitle here becomes The Variable read
WINDOWSTYLE 31+512
WINDOW 300,0-300,400
Declare Speicherhandle&,Ausgelesen#,name$
Declare Speicheraddr&,Text$
Declare Variable&
Let Text$=From the 2.File written
Let name$=AH-File

While @AND(Speicherhandle&=0,%MENUITEM<>-2)

    sleep 100
    LET Speicherhandle&=@OpenFileMapping(2,0,@ADDR(name$))

Wend

LET Speicherhandle&=@OpenFileMapping(2,0,@ADDR(name$))
LET Speicheraddr&=@MapViewOfFile(Speicherhandle&,2,0,0,0)
DrawText 0,50,lever the Speicherbereichs:+@STR$(Speicherhandle&)
DIM Ausgelesen#,256
Clear Ausgelesen#

WHILEnot %MENUITEM=-2

    DrawText 0,0,F1 pressing to that Reading
    DrawText 0,21,F2 pressing to that write...
    Waitinput

    IF %SCANKEY=112

        @CopyMemory(Ausgelesen#,Speicheraddr&,@len(Text$))
        DrawText 0,80,Variale=+@String $(Ausgelesen#,0)+
        Beep 1

    ElseIF %SCANKEY=113

        Beep 1
        @CopyMemory(Speicheraddr&,@addr(Text$),@len(Text$))
        @CopyMemory(Ausgelesen#,Speicheraddr&,@len(Text$))
        DrawText 0,80,Variale=+@String $(Ausgelesen#,0)+

    Endif

WEND

Dispose Ausgelesen#
@UnmapViewOfFile(Speicheraddr&)
@CloseHandle(Speicherhandle&)
Beep 1
 
04/02/05  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.899 Views

Untitledvor 0 min.
Georg Teles08/01/23
Ingo01/20/20
Klaus Ernst01/10/17
Ernst05/12/14

Themeninformationen

this Topic has 1 subscriber:

unbekannt (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie