Skip to content

Latest commit

 

History

History
125 lines (107 loc) · 7.16 KB

GlobalAlloc.md

File metadata and controls

125 lines (107 loc) · 7.16 KB

Home

Function name : GlobalAlloc

Group: Memory Management - Library: kernel32


The GlobalAlloc function allocates the specified number of bytes from the heap


Code examples:

Enumerating printer drivers installed
Using EnumPrinters function to enumerate locally installed printers
Copying strings through the global memory block
Dynamic strings implemented through VFP Custom class
How to print FoxPro form
Enhanced GetFont dialog
FindText -- the hopeless and useless Common Dialog
URL: splitting into its component parts
Storing screen shot of a form to bitmap file
Storing content of the Clipboard to a bitmap file
Sending email messages with Simple MAPI
Using FillMemory
How to write and read Window Properties for the specified window
Attaching menu to a top-level form
How to print a bitmap file
Loading a string resource from an executable file
Using the ChooseColor function
Creating the Save dialog box to specify the drive, directory, and name of a file to save
Enumerating network resources
How to display the Properties dialog box for a file (ShellExecuteEx)
Deleting files into the Recycle Bin
Enumerating ports that are available for printing on a specified server
Adding printer to the list of supported printers for the specified server
Reading the structure of VFP main menu
MapiSendMail class for Visual FoxPro application
Passing data records between VFP applications via the Clipboard
How to enumerate cookies and URL History entries in the cache of the local computer
How to enumerate, add and delete shares on the local computer (WinNT/XP)
Creating the Open dialog box to specify the drive, directory, and name of a file to open
Displaying system dialog that selects a folder
Enumerating print jobs and retrieving information for default printer (JOB_INFO_1 structures)
Simple printer queue monitor: deletes, pauses, resumes print jobs for local printer
How to browse and connect to printers on a network (WinNT)
Mapping and disconnecting network drives
Winsock: connecting to a news server (NNTP, port 119)
Enumerating forms supported by a specified printer
Subclassing CommandButton control to create BackColor property
Custom HttpRequest class (WinHTTP)
Vertical Label control
Obtaining list of tables stored in an ODBC Data Source
WAV file player
Shortcut Menu Class
Class for sound recording
Changing pitch and speed of a wave file
Quering Audio Mixer Device
GDI+: reading and writing metadata in JPEG and TIFF files
How to delete IE cookies, clear IE history and delete files in Temporary Internet Files directory
Adding and deleting User Accounts
Using Change Notification Objects to monitor changes to the printer or print server
How to assemble an array of strings and pass it to external function
Adding and deleting Scheduled Tasks using NetScheduleJob API functions
How to prevent users from accessing the Windows Desktop and from switching to other applications
How to convert a bitmap file to monochrome format (1 bpp)
How to display a user-defined icon in the MessageBox dialog
Obtaining addresses for the adapters on the local computer (Win XP/2003/Vista)
Displaying standard progress dialog box when copying files
Adding user-defined items to the Control Menu of VFP form (requires VFP9)
Playing WAV sounds simultaneously
Reading entries from Event logs
How to display the Print property sheet
Extensible Storage Engine class library
Using WM_COPYDATA for interprocess communication (VFP9)
How to remove a directory that is not empty
Starting a dialog box for connecting to network resources and passing input parameters
Printing Image File, programmatically set print page orientation to landscape
How to display advanced Task Dialog (Vista)
Writing entries to custom Event Log
Compressing and decompressing files with Windows API Runtime Library routines
Verifying a file using the Authenticode policy provider
Windows Shell Icons displayed and exported to ICO files (Vista)
Browsing Windows Known Folders (Special Folders)
Displaying dimmed window behind VFP top-level form
How to load a user profile

Declaration:

HGLOBAL GlobalAlloc(
  UINT uFlags,     // allocation attributes
  SIZE_T dwBytes   // number of bytes to allocate
);  

FoxPro declaration:

DECLARE INTEGER GlobalAlloc IN kernel32;
	INTEGER wFlags,;
	INTEGER dwBytes
  

Parameters:

uFlags [in] Specifies how to allocate memory

dwBytes [in] Specifies the number of bytes to allocate


Return value:

If the function succeeds, the return value is a handle to the newly allocated memory object


Comments:

So the memory is allocated. What else you can do with it? I mean, could it be useful for a Foxpro application? I should think about it