0% found this document useful (0 votes)
101 views7 pages

CWND::: Getparent

The document provides information on several Windows API functions and C++ classes: - CWnd::GetParent returns the parent window of a child window or NULL if no parent exists. The returned pointer should not be stored for later use. - CScrollView::SetScrollSizes sets the mapping mode, total size, page size, and line size for scrolling in a scroll view. - CopyFile copies an existing file to a new file location, overwriting the new file if it already exists unless the bFailIfExists parameter is TRUE.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views7 pages

CWND::: Getparent

The document provides information on several Windows API functions and C++ classes: - CWnd::GetParent returns the parent window of a child window or NULL if no parent exists. The returned pointer should not be stored for later use. - CScrollView::SetScrollSizes sets the mapping mode, total size, page size, and line size for scrolling in a scroll view. - CopyFile copies an existing file to a new file location, overwriting the new file if it already exists unless the bFailIfExists parameter is TRUE.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

CWnd::GetParent

CWnd* GetParent( ) const;


Return Value
Identifies the parent window if the member function is successful. Otherwise, the
value is NULL, which indicates an error or no parent window.
The returned pointer may be temporary and should not be stored for later use.
Remarks
Call this function to get a pointer to a child windows parent window (if any). The
GetParent function returns a pointer the immediate parent. In contrast, the
et!arentOwner function returns a pointer to the most immediate parent or owner
window that is not a child window (does not have the WS_CHL! style). If you have
a child window within a child window GetParent and GetParent"#ner return
different results.
CScrollV$e#::SetScrollS$%es
&o$d SetScrollS$%es( $nt nMapMode' S() sizeTotal' const S()* sizePage +
s$%e!e,ault' const S()* sizeLine + s$%e!e,ault );
Parameters
nMapMode
The mapping mode to set for this view. !ossible values include"
Mapping Mode Logical Unit Positive y-axis Extends...
MM_TEXT 1 pixel Downward
MM_HIMETRIC 0.01 mm Upward
MM_TWIP 1/1440 in Upward
MM_HIE!"LIH 0.001 in Upward
MM_L#METRIC 0.1 mm Upward
MM_L#E!"LIH 0.01 in Upward
#ll of these modes are defined by $indows. Two standard mapping modes,
--_S".R"PC and --_/NS".R"PC, are not used for CScrollV$e#. The
class library provides the SetScale.o0$tS$%e member function for scaling the view
to window si%e. Column three in the table above describes the coordinate orientation.
sizeTotal
The total si%e of the scroll view. The c1 member contains the hori%ontal e&tent. The
c2 member contains the vertical e&tent. 'i%es are in logical units. (oth c1 and c2
must be greater than or e)ual to *.
sizePage
The hori%ontal and vertical amounts to scroll in each direction in response to a mouse
clic+ in a scroll,bar shaft. The c1 member contains the hori%ontal amount. The c2
member contains the vertical amount.
sizeLine
The hori%ontal and vertical amounts to scroll in each direction in response to a mouse
clic+ in a scroll arrow. The c1 member contains the hori%ontal amount. The c2
member contains the vertical amount.
Remarks
Call SetScrollS$%es when the view is about to be updated. Call it in your override of
the "nU3date member function to ad-ust scrolling characteristics when, for
e&ample, the document is initially displayed or when it changes si%e.
Copy$ile
The Copy$ile function copies an existing file to a new file.
BOOL CopyFile(
LPCTSTR lpExistingFileName,
// pointer to name of an existing file
LPCTSTR lpNewFileName, // pointer to filename to copy to
BOOL bFailIfExists // flag for operation if file exists
);

Pa%a&ete%s
lpExistingFileName
Pointer to a null-terminated string that specifies the name of an existing file.
lpNewFileName
Pointer to a null-terminated string that specifies the name of the new file.
bFailIfExists
Specifies how this operation is to proceed if a file of the same name as that
specified ! lpNewFileName alread! exists. "f this parameter is T#U$ and the
new file alread! exists% the function fails. "f this parameter is &'(S$ and the new
file alread! exists% the function o)erwrites the existing file and succeeds.
Ret'%n (al'es
"f the function succeeds% the return )alue is non*ero.
"f the function fails% the return )alue is *ero. To get extended error information% call
"etLastE%%o%.
Re&a%)s
Securit! attriutes for the existing file are not copied to the new file.
&ile attriutes for the existing file are copied to the new file. &or example% if an existing
file has the &"($+'TT#",UT$+#$'D-.(/ file attriute% a cop! created through a call
to Copy$ile will also ha)e the &"($+'TT#",UT$+#$'D-.(/ file attriute.
CStr$n4
CStr$n4 does not have a base class.
# CStr$n4 ob-ect consists of a variable,length se)uence of characters. CStr$n4
provides functions and operators using a synta& similar to that of (asic.
Concatenation and comparison operators, together with simplified memory
management, ma+e CStr$n4 ob-ects easier to use than ordinary character arrays.
CStr$n4 is based on the .CH/R data type. If the symbol _UNC"!) is defined for
your program, .CH/R is defined as type #c5ar_t, a ./,bit character type0
otherwise, it is defined as c5ar, the normal 1,bit character type. 2nder 2nicode,
then, CStr$n4 ob-ects are composed of ./,bit characters. $ithout 2nicode, they are
composed of 1,bit c5ar type.
$hen not using _UNC"!), CStr$n4 is enabled for multibyte character sets (3(C',
also +nown as double,byte character sets, 4(C'). 5ote that for 3(C' strings,
CStr$n4 still counts, returns, and manipulates strings based on 1,bit characters, and
your application must interpret 3(C' lead and trail bytes itself.
CStr$n4 ob-ects also have the following characteristics"
CStr$n4 ob-ects can grow as a result of concatenation operations.
CStr$n4 ob-ects follow 6value semantics.7 Thin+ of a CStr$n4 ob-ect as an
actual string, not as a pointer to a string.
8ou can freely substitute CStr$n4 ob-ects for const c5ar* and LPC.S.R
function arguments.
# conversion operator gives direct access to the strings characters as a read,
only array of characters (a C,style string).
C"67ect
C"67ect is the principal base class for the 3icrosoft 9oundation Class :ibrary. It
serves as the root not only for library classes such as C0$le and C"6L$st, but also
for the classes that you write. C"67ect provides basic services, including
'eriali%ation support
;un,time class information
Ob-ect diagnostic output
Compatibility with collection classes
5ote that C"67ect does not support multiple inheritance. 8our derived classes can
have only one C"67ect base class, and that C"67ect must be leftmost in the
hierarchy. It is permissible, however, to have structures and non,C"67ect,derived
classes in right,hand multiple,inheritance branches.
8ou will reali%e ma-or benefits from C"67ect derivation if you use some of the
optional macros in your class implementation and declarations.
The first,level macros, 4<C:#;<=485#3IC and I3!:<3<5T=485#3IC, permit run,
time access to the class name and its position in the hierarchy. This, in turn, allows
meaningful diagnostic dumping.
The second,level macros, 4<C:#;<='<;I#: and I3!:<3<5T='<;I#:, include all the
functionality of the first,level macros, and they enable an ob-ect to be 6seriali%ed7 to
and from an 6archive.7
Registe%Windo*Message
The Registe%Windo*Message function defines a new window message that is
guaranteed to e uni0ue throughout the s!stem. The returned message )alue can e used
when calling the endMessage or PostMessage function.
UINT RegisterWindowess!ge(
LPCTSTR lpString // address of message string
);

Pa%a&ete%s
lpString
Pointer to a null-terminated string that specifies the message to e registered.
Ret'%n (al'es
"f the message is successfull! registered% the return )alue is a message identifier in the
range 0x1000 through 0x&&&&.
"f the function fails% the return )alue is *ero. To get extended error information% call
"etLastE%%o%.
Re&a%)s
The Registe%Windo*Message function is t!picall! used to register messages for
communicating etween two cooperating applications.
"f two different applications register the same message string% the applications return the
same message )alue. The message remains registered until the session ends.
-nl! use Registe%Windo*Message when more than one application must process the
same message. &or sending pri)ate messages within a window class% an application can
use an! integer in the range 23+US$# through 0x4&&&. 53essages in this range are
pri)ate to a window class% not to an application. &or example% predefined control classes
such as ,UTT-.% $D"T% ("ST,-6% and 1-3,-,-6 ma! use )alues in this range.7
SDI or MDI Interface
Two different st!les are a)ailale for the 8isual ,asic "D$9 single document interface
5SD"7 or multiple document interface 53D"7. 2ith the SD" option% all of the "D$
windows are free to e mo)ed an!where on screen: as long as 8isual ,asic is the current
application% the! will remain on top of an! other applications. 2ith the 3D" option% all of
the "D$ windows are contained within a single resi*ale parent window.
To s*itc+ ,et*een -I and M-I &odes
1. Select #ptions from the Tools menu.
The #ptions dialog ox is displa!ed.
;. Select the .dvanced ta.
<. 1hec= or unchec= the -I -evelop&ent Envi%on&ent chec= ox.
The "D$ will start in the selected mode the next time !ou start 8isual ,asic.
>or>
#un 8isual ,asic from the command line with a /sdi or /mdi parameter
S! and -!
39C ma+es it easy to wor+ with both single document interface ('4I) and multiple
document interface (34I) applications.
'4I applications allow only one open document frame window at a time. 34I
applications allow multiple document frame windows to be open in the same instance
of an application. #n 34I application has a window within which multiple 34I child
windows, which are frame windows themselves, can be opened, each containing a
separate document. In some applications, the child windows can be of different
types, such as chart windows and spreadsheet windows. In that case, the menu bar
can change as 34I child windows of different types are activated.

You might also like