473,695 Members | 2,587 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fileMappig with paging

I'll do a mappig of a big file using a paging for reader it.
The first time I call CreateFileMappi ng 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)((offSe t)
/ _pageSize))) * _pageSize;

if (_pTofile.ToPoi nter() != null)
{
//Dispose
Winapi.UnmapVie wOfFile(_pTofil e);
_pTofile = new IntPtr(null);

//Winapi.CloseHan dle(_hMap);
//_hMap = new IntPtr(null);
}
else
_hMap =
Winapi.CreateFi leMapping(_hFil e.DangerousGetH andle(), IntPtr.Zero,
Winapi.myEnumPr otect.PAGE_READ ONLY, 0,
(int)_sFile,
indexFile.ToStr ing());

indexFile++;
_pTofile = Winapi.MapViewO fFile(_hMap,
Winapi.myenumFi leMap.FILE_MAP_ READ,
iType.HIWORD(_a ddrStart),
iType.LOWORD(_a ddrStart),
(int)_pageSize) ;
}
It's corret the dispose methods
Can someone help me? Thanks

Jan 20 '06 #1
2 2062
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.MapView OfFile(_hMap,
Winapi.myenumFi leMap.FILE_MAP_ READ,
iType.HIWORD(_a ddrStart),
iType.LOWORD(_a ddrStart),
(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.*********@gm ail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . I'll do a mappig of a big file using a paging for reader it.
The first time I call CreateFileMappi ng 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)((offSe t)
/ _pageSize))) * _pageSize;

if (_pTofile.ToPoi nter() != null)
{
//Dispose
Winapi.UnmapVie wOfFile(_pTofil e);
_pTofile = new IntPtr(null);

//Winapi.CloseHan dle(_hMap);
//_hMap = new IntPtr(null);
}
else
_hMap =
Winapi.CreateFi leMapping(_hFil e.DangerousGetH andle(), IntPtr.Zero,
Winapi.myEnumPr otect.PAGE_READ ONLY, 0,
(int)_sFile,
indexFile.ToStr ing());

indexFile++;
_pTofile = Winapi.MapViewO fFile(_hMap,
Winapi.myenumFi leMap.FILE_MAP_ READ,
iType.HIWORD(_a ddrStart),
iType.LOWORD(_a ddrStart),
(int)_pageSize) ;
}
It's corret the dispose methods
Can someone help me? Thanks

Jan 20 '06 #2
The trouble is exactly this.
Thanks!

Jan 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2730
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 not the whole page, but a portion of the page. Strangely enough the URL below http://beta.asp.net/QUICKSTARTV20/aspnet/doc/ctrlref/data/gridview.aspx (VB GridView Paging and Sorting Callbacks example)
2
3569
by: RelaxoRy | last post by:
sqlConnection1.Open(); myReader = sqlCommand1.ExecuteReader(); DataGrid1.DataSource = myReader; DataGrid1.DataBind(); myReader.Close(); sqlConnection1.Close(); The Datagrid populates fine. I'm styling it on the HTML page. I configure the DataGrid for paging through the property builder fine. I AllowCustomePaging=true;. The page loads fine but it only shows "1"
6
1813
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 fills the temp table again and returns rows 10-19. The temp table is dropped after each call to the SP, so it has to be created and filled every time the user changes page in the datagrid. My question is this: Would it be more efficient to...
2
2217
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
2
6446
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 begin and occured .I want to separate this code and compiling .vb code using VBC.exe later .(bin/paging.dll) when do it like me so you retrive only < Previous Page Next Page > in your web browser and you don't retrive list Of data in your web browser....
0
3383
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 2005 and the likes of it. So This one works with SQL2000 What do you think?
2
1932
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 particular order (like ProductID, Name, Description, Quantity etc.) are displayed in one DataGrid where as the personal details of the buyer corresponding to this order (like Name, E-Mail, Shipping & Billing Address etc.) are displayed in another...
3
3739
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 coming to the client, right? I mean, the paging feature isn't somehow making calls to the database for 25 records at a time or anything like that is it? I remember in the past having to write nasty stored procedures that took in
5
3210
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 this way, but I can't see these methods as public. BookmarksDataSetTableAdapters.BookmarksTableAdapter bookTA = new BookmarksDataSetTableAdapters.BookmarksTableAdapter(); BookmarkList1.DataSource = bookTA.GetAllBookmarksWrtUser(
0
9110
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8818
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8812
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5825
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4332
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2992
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2249
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.