I'll do a mappig of a big file using a paging for reader it.
The first time I call CreateFileMapping and MapViewOfFile with a page
of 655360, the pointer is not null; then I want to read another page
and I used UnmapViewOfFile, CloseHandle and callback MapViewOfFile.
but the pointer is null.
The method that make a new paging:
public int MapFile(long offSet)
{
IntegerType iType=new IntegerType();
//The start address of the new page
long _addrStart;
_addrStart =(long) (Math.Ceiling((decimal)((offSet)
/ _pageSize))) * _pageSize;
if (_pTofile.ToPointer() != null)
{
//Dispose
Winapi.UnmapViewOfFile(_pTofile);
_pTofile = new IntPtr(null);
//Winapi.CloseHandle(_hMap);
//_hMap = new IntPtr(null);
}
else
_hMap =
Winapi.CreateFileMapping(_hFile.DangerousGetHandle (), IntPtr.Zero,
Winapi.myEnumProtect.PAGE_READONLY, 0,
(int)_sFile,
indexFile.ToString());
indexFile++;
_pTofile = Winapi.MapViewOfFile(_hMap,
Winapi.myenumFileMap.FILE_MAP_READ,
iType.HIWORD(_addrStart),
iType.LOWORD(_addrStart),
(int)_pageSize);
}
It's corret the dispose methods
Can someone help me? Thanks 2 2047
Just a hint in the docs MapViewOfFile accepts low and hight portions of the
offset,
that is lower and higher 32 bits of the 64 bit value, right?
Maybe the trouble is that iType.LOWORD and iType.HIWORD are operating with
WORDs ( 16 bit ) and
not DWORD ( 32 bit )? Winapi.MapViewOfFile(_hMap, Winapi.myenumFileMap.FILE_MAP_READ, iType.HIWORD(_addrStart), iType.LOWORD(_addrStart), (int)_pageSize);
About disposing, why aren't you checking return results from
UnmapViewOfFile?
Except this I think that disposing is okay.
--
Vadym Stetsyak aka Vadmyst http://vadmyst.blogspot.com
"Vlad" <a.*********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com... I'll do a mappig of a big file using a paging for reader it. The first time I call CreateFileMapping and MapViewOfFile with a page of 655360, the pointer is not null; then I want to read another page and I used UnmapViewOfFile, CloseHandle and callback MapViewOfFile. but the pointer is null.
The method that make a new paging:
public int MapFile(long offSet) { IntegerType iType=new IntegerType();
//The start address of the new page long _addrStart; _addrStart =(long) (Math.Ceiling((decimal)((offSet) / _pageSize))) * _pageSize;
if (_pTofile.ToPointer() != null) { //Dispose Winapi.UnmapViewOfFile(_pTofile); _pTofile = new IntPtr(null);
//Winapi.CloseHandle(_hMap); //_hMap = new IntPtr(null); } else _hMap = Winapi.CreateFileMapping(_hFile.DangerousGetHandle (), IntPtr.Zero, Winapi.myEnumProtect.PAGE_READONLY, 0, (int)_sFile, indexFile.ToString());
indexFile++; _pTofile = Winapi.MapViewOfFile(_hMap, Winapi.myenumFileMap.FILE_MAP_READ, iType.HIWORD(_addrStart), iType.LOWORD(_addrStart), (int)_pageSize);
} It's corret the dispose methods Can someone help me? Thanks
The trouble is exactly this.
Thanks! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ck388 |
last post by:
For some reason when I enable the callback feature of the gridview I
still get a page refresh, that is it seems like there is a postback
that occurs, not a callback which is just supposed to update...
|
by: RelaxoRy |
last post by:
sqlConnection1.Open();
myReader = sqlCommand1.ExecuteReader();
DataGrid1.DataSource = myReader;
DataGrid1.DataBind();
myReader.Close();
sqlConnection1.Close();
The Datagrid populates fine. ...
|
by: Shawn |
last post by:
Hi.
I already have a datagrid where I'm using paging. I have a stored procedure
that fills a temp table with 200-500 rows and then sends back 10 records at
the time. When I go to page 2 the SP...
|
by: asad |
last post by:
Hello friends, i am designing a ASP.NET page where i want to use custom
paging bcoz data is too heavy so pls tell me how can i use custom paging in
ASP.NET
Thanks
|
by: farhad13841384 |
last post by:
Hi , I Hope You fine.
I have some problem with this code for paging in asp.net
this bottom code work correctly without any error but when
I try to place separate code in .VB file then error is...
|
by: anonieko |
last post by:
This approach I found very efficient and FAST when compared to the
rowcount, or Subquery Approaches.
This is before the advent of a ranking function from DB such as
ROW_NUMBER() in SQL Server...
|
by: rn5a |
last post by:
In a shopping cart app, a ASPX page retrieves the order details &
personal details of a user from a MS-Access database table depending
upon the username of the user.
The order details of a...
|
by: Ronald S. Cook |
last post by:
I was told that if calling lots of records from the database (let's say
100,000), that the GridView's paging feature would automatically "handle"
everything.
But the 100,000 records are still...
|
by: Donald Adams |
last post by:
Hi,
I will have both web and win clients and would like to page my data. I
could not find out how the datagrid control does it's paging though I did
find some sample code that says they do it...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |