Académique Documents
Professionnel Documents
Culture Documents
winexec
UINT WINAPI WinExec(LPCSTR lpCmdLine,UINT uCmdShow);
Parameters
lpCmdLine
[in] The command line (file name plus optional parameters) for the
application to be executed. If the name of the executable file in the
lpCmdLine parameter does not contain a directory path, the system searches
for the executable file in this sequence:
1. The directory from which the application loaded.
2. The current directory.
3. The Windows system directory. The GetSystemDirectory function
retrieves the path of this directory.
4. The Windows directory. The GetWindowsDirectory function
retrieves the path of this directory.
5. The directories listed in the PATH environment variable.
uCmdShow
[in] The display options. For a list of the acceptable values, see the
description of the nCmdShow parameter of the ShowWindow function.
Return Value
If the function succeeds, the return value is greater than 31.
If the function fails, the return value is one of the following error values.
MessageBox
Aqui un ejemplo de codigo para estos mensajes, programar el siguiente codigo a un boton
y ejecutelo.
int x;
x=MessageBox("Mensaje del contenido del cuadro",
"Mensaje del titulo",
MB_YESNOCANCEL+MB_ICONQUESTION);
if (x==IDYES) MessageBox("Has presionado si");
if (x==IDNO) MessageBox("Has presionado no");
if (x==IDCANCEL) MessageBox("Has presionado cancelar");
Specify one of the following flags to display an icon in the message box:
Flag Meaning
MB_ICONEXCLAMATION, An exclamation-point icon appears in the message box.
MB_ICONWARNING
MB_ICONINFORMATION, An icon consisting of a lowercase letter i in a circle appears in
MB_ICONASTERISK the message box.
MB_ICONQUESTION A question-mark icon appears in the message box.
MB_ICONSTOP, A stop-sign icon appears in the message box.
MB_ICONERROR,
MB_ICONHAND
Specify one of the following flags to indicate the modality of the dialog box:
Flag Meaning
MB_APPLMODAL The user must respond to the message box before continuing work in
the window identified by the hWnd parameter. However, the user can
move to the windows of other threads and work in those windows.
Depending on the hierarchy of windows in the application, the user
may be able to move to other windows within the thread. All child
windows of the parent of the message box are automatically disabled,
but popup windows are not.
MB_APPLMODAL is the default if neither MB_SYSTEMMODAL
nor MB_TASKMODAL is specified.
MB_SYSTEMMODAL Same as MB_APPLMODAL except that the message box has the
WS_EX_TOPMOST style. Use system-modal message boxes to notify
the user of serious, potentially damaging errors that require immediate
attention (for example, running out of memory). This flag has no effect
on the user's ability to interact with windows other than those
MB_SERVICE_NOTIFICATION_NT3X
Windows NT: This value corresponds to the value defined for
MB_SERVICE_NOTIFICATION for Windows NT version 3.51.
Return Values
The return value is zero if there is not enough memory to create the message box.
If the function succeeds, the return value is one of the following menu-item values returned by
the dialog box:
Value Meaning
IDABORT Abort button was selected.
IDCANCEL Cancel button was selected.
IDIGNORE Ignore button was selected.
IDNO No button was selected.
IDOK OK button was selected.
IDRETRY Retry button was selected.
IDYES Yes button was selected.
If a message box has a Cancel button, the function returns the IDCANCEL value if either the esc
key is pressed or the Cancel button is selected. If the message box has no Cancel button,
pressing esc has no effect.
Remarks
When you use a system-modal message box to indicate that the system is low on memory, the
strings pointed to by the lpText and lpCaption parameters should not be taken from a resource
file, because an attempt to load the resource may fail.
When an application calls MessageBox and specifies the MB_ICONHAND and
MB_SYSTEMMODAL flags for the uType parameter, the system displays the resulting message
box regardless of available memory. When these flags are specified, the system limits the length
of the message box text to three lines. The system does not automatically break the lines to fit in
the message box, however, so the message string must contain carriage returns to break the lines
at the appropriate places.
If you create a message box while a dialog box is present, use the handle of the dialog box as the
hWnd parameter. The hWnd parameter should not identify a child window, such as a control in a
dialog box.
Windows 95: The system can support a maximum of 16,364 window handles.
Windows CE: Windows CE does not support the following styles for the uType parameter:
MB_SYSTEMMODAL
MB_TASKMODAL
MB_HELP
MB_RIGHT
MB_RTLREADING
MB_DEFAULT_DESKTOP_ONLY
MB_SERVICE_NOTIFICATION
MB_USERICON.
The following return values are not supported:
IDCLOSE
IDHELP
PlaySound (mmsystem.h)
The PlaySound function plays a sound specified by the given filename, resource, or system
event. (A system event may be associated with a sound in the registry or in the WIN.INI file.)
BOOL PlaySound(
LPCSTR pszSound,
HMODULE hmod,
DWORD fdwSound
);
Parameters
pszSound
A string that specifies the sound to play. If this parameter is NULL, any currently playing
waveform sound is stopped. To stop a non-waveform sound, specify SND_PURGE in
the fdwSound parameter.
Three flags in fdwSound (SND_ALIAS, SND_FILENAME, and SND_RESOURCE)
determine whether the name is interpreted as an alias for a system event, a filename, or a
resource identifier. If none of these flags are specified, PlaySound searches the registry
or the WIN.INI file for an association with the specified sound name. If an association is
found, the sound event is played. If no association is found in the registry, the name is
interpreted as a filename.
hmod
Handle of the executable file that contains the resource to be loaded. This parameter must
be NULL unless SND_RESOURCE is specified in fdwSound.
fdwSound
Flags for playing the sound. The following values are defined:
SND_APPLICATION
The sound is played using an application-specific association.
SND_ALIAS
The pszSound parameter is a system-event alias in the registry or the WIN.INI file. Do
not use with either SND_FILENAME or SND_RESOURCE.
SND_ALIAS_ID
The pszSound parameter is a predefined sound identifier.
SND_ASYNC
The sound is played asynchronously and PlaySound returns immediately after beginning
the sound. To terminate an asynchronously played waveform sound, call PlaySound
with pszSound set to NULL.
SND_FILENAME
The pszSound parameter is a filename.
SND_LOOP
The sound plays repeatedly until PlaySound is called again with the pszSound parameter
set to NULL. You must also specify the SND_ASYNC flag to indicate an asynchronous
sound event.
SND_MEMORY
A sound event's file is loaded in RAM. The parameter specified by pszSound must point
to an image of a sound in memory.
SND_NODEFAULT
No default sound event is used. If the sound cannot be found, PlaySound returns silently
without playing the default sound.
SND_NOSTOP
The specified sound event will yield to another sound event that is already playing. If a
sound cannot be played because the resource needed to generate that sound is busy
CFont::CreateFont
BOOL CreateFont( int nHeight, int nWidth, int nEscapement, int nOrientation, int
nWeight, BYTE bItalic, BYTE bUnderline, BYTE cStrikeOut, BYTE nCharSet, BYTE
nOutPrecision, BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily, LPCTSTR
lpszFacename );
Return Value
Nonzero if successful; otherwise 0.
Parameters
nHeight
Specifies the desired height (in logical units) of the font. The font height can be specified in
the following ways:
Greater than 0, in which case the height is transformed into device units and
matched against the cell height of the available fonts.
Equal to 0, in which case a reasonable default size is used.
Less than 0, in which case the height is transformed into device units and the
absolute value is matched against the character height of the available fonts.
The absolute value of nHeight must not exceed 16,384 device units after it is
converted. For all height comparisons, the font mapper looks for the largest font that
does not exceed the requested size or the smallest font if all the fonts exceed the
requested size.
nWidth
Specifies the average width (in logical units) of characters in the font. If nWidth is 0, the
aspect ratio of the device will be matched against the digitization aspect ratio of the
available fonts to find the closest match, which is determined by the absolute value of the
difference.
nEscapement
Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of
the display surface. The escapement vector is the line through the origins of the first and
last characters on a line. The angle is measured counterclockwise from the x-axis.
nOrientation
Specifies the angle (in 0.1-degree units) between the baseline of a character and the x-
axis. The angle is measured counterclockwise from the x-axis for coordinate systems in
which the y-direction is down and clockwise from the x-axis for coordinate systems in which
the y-direction is up.
nWeight
FW_DONTCARE 0
FW_THIN 100
FW_EXTRALIGHT 200
FW_ULTRALIGHT 200
FW_LIGHT 300
FW_NORMAL 400
FW_REGULAR 400
FW_MEDIUM 500
FW_SEMIBOLD 600
FW_DEMIBOLD 600
FW_BOLD 700
FW_EXTRABOLD 800
FW_ULTRABOLD 800
FW_BLACK 900
FW_HEAVY 900
These values are approximate; the actual appearance depends on the typeface. Some fonts
have only FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is
specified, a default weight is used.
bItalic
Specifies whether the font is italic.
bUnderline
Specifies whether the font is underlined.
cStrikeOut
Specifies whether characters in the font are struck out. Specifies a strikeout font if set to a
nonzero value.
nCharSet
Specifies the fonts character set. The following constants and values are predefined:
Constant Value
ANSI_CHARSET 0
DEFAULT_CHARSET 1
SYMBOL_CHARSET 2
SHIFTJIS_CHARSET 128
OEM_CHARSET 255
OUT_DEFAULT_PRECIS OUT_STROKE_PRECIS
OUT_DEVICE_PRECIS OUT_TT_PRECIS
OUT_RASTER_PRECIS
CLIP_DEFAULT_PRECIS CLIP_STROKE_PRECIS
CLIP_ENCAPSULATE CLIP_TT_ALWAYS
CLIP_LH_ANGLES
CBrush::CBrush
CBrush( );
CBrush( COLORREF crColor );
CBrush( int nIndex, COLORREF crColor );
CBrush( CBitmap* pBitmap );
Parameters
crColor
Specifies the foreground color of the brush as an RGB color. If the brush is hatched, this
parameter specifies the color of the hatching.
nIndex
CPen::CPen
CPen( );
CPen( int nPenStyle, int nWidth, COLORREF crColor );
CPen( int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, int nStyleCount = 0, const
DWORD* lpStyle = NULL );
Parameters
nPenStyle
Specifies the pen style. This parameter in the first version of the constructor can be one of
the following values:
PS_SOLID Creates a solid pen.
PS_DASH Creates a dashed pen. Valid only when the pen width is 1 or less, in
device units.
PS_DOT Creates a dotted pen. Valid only when the pen width is 1 or less, in device
units.
PS_DASHDOT Creates a pen with alternating dashes and dots. Valid only when
the pen width is 1 or less, in device units.
PS_DASHDOTDOT Creates a pen with alternating dashes and double dots. Valid
only when the pen width is 1 or less, in device units.
PS_NULL Creates a null pen.
PS_INSIDEFRAME Creates a pen that draws a line inside the frame of closed
shapes produced by the Windows GDI output functions that specify a bounding
rectangle (for example, the Ellipse, Rectangle, RoundRect, Pie, and Chord
member functions). When this style is used with Windows GDI output functions that
do not specify a bounding rectangle (for example, the LineTo member function), the
drawing area of the pen is not limited by a frame.
The second version of the CPen constructor specifies a combination of type, style,
end cap, and join attributes. The values from each category should be combined by
using the bitwise OR operator (|). The pen type can be one of the following values:
PS_GEOMETRIC Creates a geometric pen.
PS_COSMETIC Creates a cosmetic pen.
The second version of the CPen constructor adds the following pen styles for
nPenStyle:
CClientDC
The CClientDC class is derived from CDC and takes care of calling the Windows functions
GetDC at construction time and ReleaseDC at destruction time. This means that the device
context associated with a CClientDC object is the client area of a window.
For more information on CClientDC, see Device Contexts in Visual C++ Programmer's
Guide.
Construction
CDC Constructs a CDC object.
Initialization
CreateDC Creates a device context for a specific device.
DeleteDC Deletes the Windows device context associated with this CDC
object.
Detach Detaches the Windows device context from this CDC object.
GetWindow Returns the window associated with the display device context.
Device-Context Functions
GetSafeHdc Returns m_hDC, the output device context.
RestoreDC Restores the device context to a previous state saved with SaveDC.
IsPrinting Determines whether the device context is being used for printing.
Drawing-Tool Functions
GetBrushOrg Retrieves the origin of the current brush.
SetBrushOrg Specifies the origin for the next brush selected into a device context.
SelectStockObject Selects one of the predefined stock pens, brushes, or fonts provided by
Windows.
RealizePalette Maps palette entries in the current logical palette to the system palette.
UpdateColors Updates the client area of the device context by matching the current
colors in the client area to the system palette on a pixel-by-pixel basis.
Drawing-Attribute Functions
GetColorAdjustment Retrieves the color adjustment values for the device context.
SetColorAdjustment Sets the color adjustment values for the device context using the
specified values.
Mapping Functions
GetMapMode Retrieves the current mapping mode.
OffsetViewportOrg Modifies the viewport origin relative to the coordinates of the current
viewport origin.
GetWindowOrg Retrieves the x- and y-coordinates of the origin of the associated window.
OffsetWindowOrg Modifies the window origin relative to the coordinates of the current
window origin.
Coordinate Functions
DPtoHIMETRIC Converts device units into HIMETRIC units.
Region Functions
FillRgn Fills a specific region with the specified brush.
Clipping Functions
SetBoundsRect Controls the accumulation of bounding-rectangle information
for the specified device context.
SelectClipRgn Combines the given region with the current clipping region
by using the specified mode.
Line-Output Functions
GetCurrentPosition Retrieves the current position of the pen (in logical
coordinates).
LineTo Draws a line from the current position up to, but not
including, a point.
AngleArc Draws a line segment and an arc, and moves the current
position to the ending point of the arc.
GetArcDirection Returns the current arc direction for the device context.
SetArcDirection Sets the drawing direction to be used for arc and rectangle
functions.
PolyDraw Draws a set of line segments and Bzier splines. This function
updates the current position.
PolylineTo Draws one or more straight lines and moves the current
position to the ending point of the last line.
PolyBezierTo Draws one or more Bzier splines, and moves the current
position to the ending point of the last Bzier spline.
PolyPolygon Creates two or more polygons that are filled using the current
polygon-filling mode. The polygons may be disjoint or they
may overlap.
Rectangle Draws a rectangle using the current pen and fills it using the
current brush.
RoundRect Draws a rectangle with rounded corners using the current pen
and filled using the current brush.
Bitmap Functions
PatBlt Creates a bit pattern.
StretchBlt Moves a bitmap from a source rectangle and device into a destination
rectangle, stretching or compressing the bitmap if necessary to fit the
dimensions of the destination rectangle.
GetPixel Retrieves the RGB color value of the pixel at the specified point.
SetPixel Sets the pixel at the specified point to the closest approximation of the
specified color.
SetPixelV Sets the pixel at the specified coordinates to the closest approximation of the
specified color. SetPixelV is faster than SetPixel because it does not need to
return the color value of the point actually painted.
ExtFloodFill Fills an area with the current brush. Provides more flexibility than the
FloodFill member function.
MaskBlt Combines the color data for the source and destination bitmaps using the given
mask and raster operation.
PlgBlt Performs a bit-block transfer of the bits of color data from the specified
rectangle in the source device context to the specified parallelogram in the
given device context.
Text Functions
TextOut Writes a character string at a specified location using the
currently selected font.
GetOutputTextExtent Computes the width and height of a line of text on the output
device context using the current font to determine the
dimensions.
GetTextFace Copies the typeface name of the current font into a buffer as a
null-terminated string.
GetTextMetrics Retrieves the metrics for the current font from the attribute
device context.
GetOutputTextMetrics Retrieves the metrics for the current font from the output
device context.
Font Functions
GetFontData Retrieves font metric information from a scalable font file.
The information to retrieve is identified by specifying an
offset into the font file and the length of the information to
return.
GetKerningPairs Retrieves the character kerning pairs for the font that is
currently selected in the specified device context.
SetMapperFlags Alters the algorithm that the font mapper uses when it maps
logical fonts to physical fonts.
Escape Allows applications to access facilities that are not directly available from a
particular device through GDI. Also allows access to Windows escape
functions. Escape calls made by an application are translated and sent to the
device driver.
DrawEscape Accesses drawing capabilities of a video display that are not directly available
through the graphics device interface (GDI).
StartDoc Informs the device driver that a new print job is starting.
SetAbortProc Sets a programmer-supplied callback function that Windows calls if a print job
must be aborted.
AbortDoc Terminates the current print job, erasing everything the application has written
to the device since the last call of the StartDoc member function.
Scrolling Functions
ScrollDC Scrolls a rectangle of bits horizontally and vertically.
Metafile Functions
PlayMetaFile Plays the contents of the specified metafile on the given device. The
enhanced version of PlayMetaFile displays the picture stored in the
given enhanced-format metafile. The metafile can be played any
number of times.
Path Functions
AbortPath Closes and discards any paths in the device context.
EndPath Closes a path bracket and selects the path defined by the bracket into the
device context.
FillPath Closes any open figures in the current path and fills the paths interior by
using the current brush and polygon-filling mode.
FlattenPath Transforms any curves in the path selected into the current device context,
and turns each curve into a sequence of lines.
GetPath Retrieves the coordinates defining the endpoints of lines and the control
points of curves found in the path that is selected into the device context.
SelectClipPath Selects the current path as a clipping region for the device context,
combining the new region with any existing clipping region by using the
specified mode.
SetMiterLimit Sets the limit for the length of miter joins for the device context.
StrokeAndFillPath Closes any open figures in a path, strikes the outline of the path by using
the current pen, and fills its interior by using the current brush.
WidenPath Redefines the current path as the area that would be painted if the path were
stroked using the pen currently selected into the device context.
Initialization
Create Creates the combo box and attaches it to the CComboBox
object.
General Operations
GetCount Retrieves the number of items in the list box of a combo box.
GetCurSel Retrieves the index of the currently selected item, if any, in the list
box of a combo box.
GetEditSel Gets the starting and ending character positions of the current
selection in the edit control of a combo box.
SetItemData Sets the 32-bit value associated with the specified item in a combo
box.
SetItemDataPtr Sets the 32-bit value associated with the specified item in a combo
box to the specified pointer (void*).
GetTopIndex Returns the index of the first visible item in the list-box portion of the
combo box.
SetTopIndex Tells the list-box portion of the combo box to display the item with
the specified index at the top.
SetHorizontalExtent Sets the width in pixels that the list-box portion of the combo box can
be scrolled horizontally.
GetHorizontalExtent Returns the width in pixels that the list-box portion of the combo box
can be scrolled horizontally.
SetDroppedWidth Sets the minimum allowable width for the drop-down list-box portion
of a combo box.
GetDroppedWidth Retrieves the minimum allowable width for the drop-down list-box
portion of a combo box.
Clear Deletes (clears) the current selection (if any) in the edit control.
Copy Copies the current selection (if any) onto the Clipboard in CF_TEXT
format.
Cut Deletes (cuts) the current selection, if any, in the edit control and
copies the deleted text onto the Clipboard in CF_TEXT format.
Paste Inserts the data from the Clipboard into the edit control at the current
cursor position. Data is inserted only if the Clipboard contains data in
CF_TEXT format.
LimitText Limits the length of the text that the user can enter into the edit
control of a combo box.
SetItemHeight Sets the height of list items in a combo box or the height of the edit-
control (or static-text) portion of a combo box.
GetLBTextLen Gets the length of a string in the list box of a combo box.
ShowDropDown Shows or hides the list box of a combo box that has the
CBS_DROPDOWN or CBS_DROPDOWNLIST style.
GetDroppedState Determines whether the list box of a drop-down combo box is visible
(dropped down).
SetExtendedUI Selects either the default user interface or the extended user interface
for a combo box that has the CBS_DROPDOWN or
CBS_DROPDOWNLIST style.
GetExtendedUI Determines whether a combo box has the default user interface or the
extended user interface.
String Operations
AddString Adds a string to the end of the list in the list box of a combo box or at the
sorted position for list boxes with the CBS_SORT style.
ResetContent Removes all items from the list box and edit control of a combo box.
FindString Finds the first string that contains the specified prefix in the list box of a
combo box.
FindStringExact Finds the first list-box string (in a combo box) that matches the specified
string.
SelectString Searches for a string in the list box of a combo box and, if the string is
found, selects the string in the list box and copies the string to the edit
control.
Overridables
DrawItem Called by the framework when a visual aspect of an owner-draw combo box
changes.
MeasureItem Called by the framework to determine combo box dimensions when an owner-
draw combo box is created.
CompareItem Called by the framework to determine the relative position of a new list item in
a sorted owner-draw combo box.
DeleteItem Called by the framework when a list item is deleted from an owner-draw
combo box.
m_nFields Contains the number of field data members in the recordset. Type UINT.
m_nParams Contains the number of parameter data members in the recordset. Type UINT.
m_pDatabase Contains a pointer to the CDatabase object through which the recordset is
connected to a data source.
m_strSort Contains a CString that specifies an SQL ORDER BY clause. Used to control
how the records are sorted.
Construction
CRecordset Constructs a CRecordset object. Your derived class must
provide a constructor that calls this one.
Recordset Attributes
CanAppend Returns nonzero if new records can be added to the recordset via the
AddNew member function.
CanRestart Returns nonzero if Requery can be called to run the recordsets query
again.
CanUpdate Returns nonzero if the recordset can be updated (you can add, update, or
delete records).
GetStatus Gets the status of the recordset: the index of the current record and
whether a final count of the records has been obtained.
GetTableName Gets the name of the table on which the recordset is based.
GetSQL Gets the SQL string used to select records for the recordset.
IsBOF Returns nonzero if the recordset has been positioned before the first
record. There is no current record.
IsEOF Returns nonzero if the recordset has been positioned after the last record.
There is no current record.
Delete Deletes the current record from the recordset. You must explicitly scroll to
Edit Prepares for changes to the current record. Call Update to complete the edit.
Update Completes an AddNew or Edit operation by saving the new or edited data on
the data source.
Move Positions the recordset to a specified number of records from the current
record in either direction.
MoveFirst Positions the current record on the first record in the recordset. Test for
IsBOF first.
MoveLast Positions the current record on the last record or on the last rowset. Test
for IsEOF first.
MoveNext Positions the current record on the next record or on the next rowset. Test
for IsEOF first.
MovePrev Positions the current record on the previous record or on the previous
rowset. Test for IsBOF first.
GetRowsetSize Returns the number of records you wish to retrieve during a single
fetch.
IsFieldDirty Returns nonzero if the specified field in the current record has been
changed.
IsFieldNull Returns nonzero if the specified field in the current record is Null
(has no value).
IsFieldNullable Returns nonzero if the specified field in the current record can be set
to Null (having no value).
Requery Runs the recordsets query again to refresh the selected records.
SetFieldNull Sets the value of the specified field in the current record to Null
(having no value).
SetRowsetCursorPosition Positions the cursor on the specified row within the rowset.
Recordset Overridables
Check Called to examine the return code from an ODBC API function.
DoBulkFieldExchange Called to exchange bulk rows of data from the data source to the
recordset. Implements bulk record field exchange (Bulk RFX).
DoFieldExchange Called to exchange data (in both directions) between the field data
members of the recordset and the corresponding record on the data
source. Implements record field exchange (RFX).
SetRowsetSize Specifies the number of records you wish to retrieve during a fetch.