Solved

CreateFileMapping parameter

Posted on 1999-01-05
1
336 Views
Last Modified: 2012-06-21
I follow the sample code from MSDN as shown below.

h = CreateFileMapping(-1,pNull,PAGE_READWRITE,0, 65535,"MyShare")

The problem I am having is that I can't find where the constant pNull and PAGE_READWRITE are defined. I tried to replace pNull with vbNull, Null, 0, and 0& and I get type mismatch error. How can I create a handle by using CreateFileMapping.  Please help
0
Comment
Question by:yray
1 Comment
 
LVL 4

Accepted Solution

by:
chabaud earned 50 total points
Comment Utility
Change the declare statement as follow:

Private Declare Function CreateFileMapping Lib "kernel32" Alias "CreateFileMappingA" (ByVal hFile As Long, ByVal lpFileMappigAttributes As long, ByVal flProtect As Long, ByVal dwMaximumSizeHigh As Long, ByVal dwMaximumSizeLow As Long, ByVal lpName As String) As Long
private const PAGE_READONLY=2
private const PAGE_READWRITE=4
private const PAGE_WRITECOPY=8

and then:

h = CreateFileMapping(&hFFFFFFFF,0,PAGE_READWRITE,0, 65535,"MyShare")

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now