Beruflich Dokumente
Kultur Dokumente
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
MFC
. Visual Studio 2008 .
C++
.
.
1388
www.jenab.persiangig.com
- MFC
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
C++
...
if
and or
using
MFC
)(Setup
MSDN
...
) (ID
)(Tab Order
- MFC
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AND OR
)(Flags
) (
Minimize
CString
CString
long
long
- MFC
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
) (
)(Desktop
- MFC
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
C++
C .
visual Basic C# .
) (Low-latency
:
2 3 /
... .
C++ :
C++ . exe
).
(
C++ .
exe C++ .
C++ .
C++ .
.
) (Native )(Managed
-1 Native ) (
) (CPU CE mobile
. Native
) (Performance .
.
- MFC
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Win32 ) 16 64(
VB C#
.
) (
API .
C++
win32 API .
MFC .
Nero CD/DVD
... MFC .
Ram ...
) (flexibility ) (Performance
. .Net .
) (CLR
Visual C++
vista native
- MFC
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
( C++/CLI
:
C++/CLI
Managed ) C# ( .
C++ Native
MFC Win32 Managed .
) (CLR
) (MFC C#
MFC .
Win32 .
- MFC
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
MFC
.
. ) (Tab
- MFC
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Finish .
- MFC
www.jenab.persiangig.com
10
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
- MFC
www.jenab.persiangig.com
11
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
C++ .
//
.
//
C++ * / */ .
.
*/ */
*****************************/
*
*
*
*
*****************************/
. .
.1 File Save ALL .
.2 Ctrl+Shift+S .
- MFC
www.jenab.persiangig.com
12
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
) (Unicode
Yes
.
) (exe Ctrl+F5 .
).(exe
- MFC
www.jenab.persiangig.com
13
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
main . _tmain
) (Unicode .
)][int _tmain(int argc, _TCHAR* argv
{
;return 0
}
}{ . :
;)(void MyFunction
{
//
}
C++ )( main . )( main C++ .
{ main ; return 0
.
C++ .
- MFC
www.jenab.persiangig.com
14
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
) (Enter .
C++ ; .
Ctrl+F5 .
.
;std::cout << "1111111" << std::endl
;std::cout << "2222222" << std::endl
std::endl \n )""( .
Ctrl+F5 .
- MFC
www.jenab.persiangig.com
15
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
:A.CPP
-1 :
"#include "stdafx.h
>#include <iostream
)][int _tmain(int argc, _TCHAR* argv
{
;int a
;int b
;int c
;a = 2
;b = 3
;c = a + b
;std::cout << "a=" << a << std::endl
;std::cout << "b=" << b << std::endl
;std::cout << "a+b=" << c << std::endl
;return 0
a . C++
) (declare . .
. int
. b c a b .
.
. C++ _ .
1A A12h
- MFC
16
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
a ; int a b
; double b . C++ .
true or false
bool
128 to +127
char
128 to +127
signed char
0 to 255
unsigned char
0 to 65,535
wchar_t
32,768 to +32,767
short
0 to 65,535
unsigned short
2,147,483,648 to 2,147,483,647
int
0 to 4,294,967,295
unsigned int
2,147,483,648 to 2,147,483,647
long
0 to 4,294,967,295
unsigned long
7 3.41038
float
15 1.710308
double
15 1.710308
long double
* A, Z, 8,
wchar_t
int
10U, 64000u
unsigned int
long
unsigned long
3.14f, 34.506F
float
1.414, 2.71828
double
1.414L, 2.71828l
long double
true, false
bool
- MFC
www.jenab.persiangig.com
17
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
;int a = 0
;int b = 10
;int abc = 5
;)int a(0
;)int b(10
;)int abc(5
: C++ .
a
= a
= a
;= 2
;2
;2
) " " ( :
;b=30; c=a+b
;a=20
;int a,b,c
c=a+b . :
;std::cout << "a=" << a << std::endl
;std::cout << "b=" << b << std::endl
;std::cout << "a+b=" << c << std::endl
. ba c " " ba .c
.
- MFC
www.jenab.persiangig.com
18
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
C++
C++
++
--
++ -- . a++
a=a+1 b-- b=b-1 .
;a++
;b--
C++
)( main )( Add .
-1 :
"#include "stdafx.h
>#include <iostream
)][int _tmain(int argc, _TCHAR* argv
{
;int a,b,c
;a = 2
;b = 3
;)c = Add(a,b
;std::cout << "a=" << a << std::endl
;std::cout << "b=" << b << std::endl
;std::cout << "a+b=" << c << std::endl
;return 0
}
: ); (int a,b,c ) int (
- MFC
19
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
C++ )( Add
.
)(Add
)( Add ) (int
. ) (Prototype :
}
)( Add . ).
)( main (.
)(Add
)( Add :
)int Add(int num1,int num2
{
;int addnum
;addnum = num1 + num2
;return addnum
}
- MFC
20
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
; .
.
:
"#include "stdafx.h
>#include <iostream
;)int Add(int , int
)][int _tmain(int argc, _TCHAR* argv
{
;int a
;int b
;int c
;a = 2
;b = 3
;)c = Add(a,b
;std::cout << "a=" << a << std::endl
;std::cout << "b=" << b << std::endl
;std::cout << "a+b=" << c << std::endl
;return 0
}
)int Add(int num1,int num2
{
;int addnum
;addnum = num1 + num2
;return addnum
}
.
addnum )( main c .
)( Add
C++ ) (Scope .
) (Local a )( main
- MFC
www.jenab.persiangig.com
21
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
a
)( main )( Add .
) (Global
)( main .
a 1 .
"#include "stdafx.h
>#include <iostream
;int a
)][int _tmain(int argc, _TCHAR* argv
{
;a=1
;std::cout << a << std::endl
;return 0
}
.
- MFC
22
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
if
if C++ . if .
if .
-1 )( main :
"#include "stdafx.h
>#include <iostream
)][int _tmain(int argc, _TCHAR* argv
{
;int a,b
;a=20
;b=30
)if(a == 20
{
;std::cout << "a is 20" << std::endl
}
)if(b == 50
{
;std::cout << "b is 50" << std::endl
}
else
{
;std::cout << "b is not 50" << std::endl
}
;return 0
}
. if a 20 )
( " " a is 20 . if b 50 ) (
" " b is 50 " " b is not 50 )
if == = (.
-2 .
- MFC
www.jenab.persiangig.com
23
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
: = == C++ . = =
= . == ==
: C++ .
=<
<
=>
>
=!
==
AND OR
a b c d
. if :
)if(a == b
{
)if(c == d
{
;std::cout << "Ok" << std::endl
}
}
AND &&
.
AND if :
)if(a == b && c == d
{
;std::cout << "Ok" << std::endl
}
a b c d .
)if(a == b
{
;std::cout << "Ok" << std::endl
}
else
{
)if(c == d
{
;std::cout << "Ok" << std::endl
}
}
- MFC
24
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
OR || .
OR .
)if(a == b || c == d
{
;std::cout << "Ok" << std::endl
}
.
using
using
- MFC
www.jenab.persiangig.com
25
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
MFC
)(MFC
MFC C++ .
File Project .
P1 Ok .
- MFC
www.jenab.persiangig.com
26
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
> Next .
- MFC
www.jenab.persiangig.com
27
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
) (.
. .
.
View .
.1 Solution Explorer . VS
) ( VS .
.2 Class View .
.3 Add Resource ... .
.1 Properties ) (...
.
.2 Toolbox ... .
- MFC
www.jenab.persiangig.com
28
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
- Auto Hide .
MFC
TODO
Ok Cancel .
.1 Ok . Ok Delete
Delete
.2 TODO .
.
.3 TODO . Properties
Caption .
- MFC
www.jenab.persiangig.com
29
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
.4 P1 .
Properties Caption
.5 .
.
.6 Cancel Caption .
.
.
.
Resource View
IDD_P1_DIALOG ) .
- MFC
www.jenab.persiangig.com
30
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
) ( .
Open File .
Resource View ] IDD_P1_DIALOG[Farsi .
Properties Maximize Box Minimize Box False True . False
True .
About About P1
.
Resource View IDD_ABOUTBOX ) ( .
- MFC
www.jenab.persiangig.com
31
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
FM C
C++ .
Solution Explorer
P1.ico . .
4 8 .
.
Sib Icon Editor
. AAA logo
PNG 256*256 Sib Icon Editor
Ok
Save as ico
. res ) ( Clipboard
- MFC
www.jenab.persiangig.com
32
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Rename Paste
.
:
.
: P1.exe
My Computer
TODO
Farsi . My Computer .
- MFC
www.jenab.persiangig.com
33
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
C++ .
C++ Debug
Release .
) (
) (DLL
. ) (Shared DLL
.
) (Static Library
) (Portable .
: static
.
MFC :
-1 MFC
-2 C run-time
Project P1 Properties .
- MFC
www.jenab.persiangig.com
34
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
C run-time
Project Properties
Configuration Properties -> C/C++ -> Code Generation -> Runtime library
/MT Ok .
) (Portable
P1.exe Documents
My
: MFC .
Use MFC in a static library
MFC .
- MFC
www.jenab.persiangig.com
35
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
. Setup
Use MFC in a Shared DLL 344
359 ) (.
) (Setup .
: Setup Release
) (exe Setup .
)(Setup Project
- MFC
www.jenab.persiangig.com
36
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
.1 ) (exe Project Add File . exe
Release .
Open .
[ProgramFilesFolder]\Mahtab .
.4 Application Folder
- Create Shortcut to
User's Desktop .
.5 Properties Icon
Browse . Icon )(exe
Browse * *.
Application Folder .
- MFC
www.jenab.persiangig.com
37
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Remove Program .
.
.9 Setup Release Build Build Solution
. Setup Release .
: Startup User's
Programs Menu .
Setup .
Microsoft Visual Studio MSDN
. IDE (Integrated
) Development Environment )(
. IDE ) C# C++
( C++ J# . ) Visual Studio 2008 (VS .
- MFC
www.jenab.persiangig.com
38
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
VS . MSDN
. MSDN .
! MSDN VS
Help VS ) VS ( . MSDN
Help F1 . VS
. MSDN
www.msdn.microsoft.com
! MSDN MSDN
. MSDN VS )
( F1 .
VS MSDN DVD CD .
MSDN
MSDN ) I
( ) ( F1 ) MSDN
( . MSDN
Output ' 'error F1 . VS
F1 MSDN .
)
.(MSDN .
. C++
.
C++ .
VS Start Page
.
File > Open . sln .
- MFC
www.jenab.persiangig.com
39
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
MFC
. :
)(static text
)(edit box
)(command button
)(check box
)(radio button
- MFC
www.jenab.persiangig.com
40
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
. .
.
. .
.
. .
. .
. .
.
.
.
.
- MFC
www.jenab.persiangig.com
41
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
:
.1
MFC Application
P2 Dialog based
.2 .
.3 .
Toolbox Properties
Button .
Caption Properties .
Toolbox
Caption Properties
.
- MFC
www.jenab.persiangig.com
42
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
.1 ) (Edit Control
.2 ) (Combo Box Control
.4 ) (Check-box Control .
Properties Right Align Text Right To Left Reading Order True .
.
.
) (Ctrl
.
... .
- MFC
www.jenab.persiangig.com
43
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
- MFC
www.jenab.persiangig.com
44
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
) (ID
. . ) (ID BUTTON1
BUTTON2 .
.
Properties ID .
ID
ID
IDC_STATIC
IDC_CLRMSG
IDC_STATICMSG
IDC_RUNPGM
IDC_STATICPGM
IDC_EXIT
IDC_MSG
IDC_CKSHWMSG
IDC_PROGTORUN
IDC_CKSHWPGM
IDC_SHWMSG
IDC_CKENBLMSG
IDC_DFLTMSG
IDC_CKENBLPGM
. . .
ADD Variable .
- MFC
www.jenab.persiangig.com
45
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
.
)(Variable Type
)(Category
)(Variable name
)(ID
CString
CString
CComboBox
BOOL
BOOL
BOOL
BOOL
Value
Value
Control
Value
Value
Value
Value
m_strMessage
m_strProgToRun
m_strCB1
m_bEnableMsg
m_bEnablePgm
m_bShowMsg
m_bShowPgm
IDC_MSG
IDC_PROGTORUN
IDC_PROGTORUN
IDC_CKENBLMSG
IDC_CKENBLPGM
IDC_CKSHWMSG
IDC_CKSHWPGM
: MFC _ m . ) b
str ( ... . VC++
MFC .
.
Solution Explorer P2Dlg.cpp-
. )( OnInitDialog) (.
- MFC
www.jenab.persiangig.com
46
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
TODO .
;) )" "(m_strCB1.InsertString( 0, _T
;) )" "(m_strCB1.InsertString( 1, _T
;) )""(m_strCB1.InsertString( 2, _T
;" "m_strMessage=L
;m_bShowMsg=TRUE
;m_bShowPgm=TRUE
;m_bEnableMsg=TRUE
;m_bEnablePgm=TRUE
;)UpdateData(FALSE
C C++ m_strMessage Visual Basic
" L"Text
)" _T("Text .
.
UpdateData .
. FALSE TRUE
.
.
.
Add Event Handler... . Message Type
) BN_CLICKED (
.
. .
;)(OnOK
- MFC
www.jenab.persiangig.com
47
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
;)UpdateData(TRUE
;)MessageBox(m_strMessage
m_strMessage
.
.
;""=m_strMessage
;)UpdateData(FALSE
.
;""m_strMessage=L
;)UpdateData(FALSE
. .
;)UpdateData(TRUE
;)")) WinExec("calc.exe",SW_SHOW "if(m_strProgToRun == (L
48
www.jenab.persiangig.com
- MFC
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
.
:
UpdateData(TRUE);
if(m_bShowMsg == TRUE)
{
GetDlgItem(IDC_MSG)->ShowWindow(TRUE);
GetDlgItem(IDC_SHWMSG)->ShowWindow(TRUE);
GetDlgItem(IDC_DFLTMSG)->ShowWindow(TRUE);
GetDlgItem(IDC_CLRMSG)->ShowWindow(TRUE);
GetDlgItem(IDC_STATICMSG)->ShowWindow(TRUE);
}
else
{
GetDlgItem(IDC_MSG)->ShowWindow(FALSE);
GetDlgItem(IDC_SHWMSG)->ShowWindow(FALSE);
GetDlgItem(IDC_DFLTMSG)->ShowWindow(FALSE);
GetDlgItem(IDC_CLRMSG)->ShowWindow(FALSE);
GetDlgItem(IDC_STATICMSG)->ShowWindow(FALSE);
}
:
UpdateData(TRUE);
if(m_bShowPgm == TRUE)
{
GetDlgItem(IDC_RUNPGM)->ShowWindow(TRUE);
GetDlgItem(IDC_PROGTORUN)->ShowWindow(TRUE);
GetDlgItem(IDC_STATICPGM)->ShowWindow(TRUE);
}
else
{
GetDlgItem(IDC_RUNPGM)->ShowWindow(FALSE);
GetDlgItem(IDC_PROGTORUN)->ShowWindow(FALSE);
GetDlgItem(IDC_STATICPGM)->ShowWindow(FALSE);
}
- MFC
www.jenab.persiangig.com
49
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
:
;)UpdateData(TRUE
)if(m_bEnableMsg == TRUE
{
;)GetDlgItem(IDC_MSG)->EnableWindow(TRUE
;)GetDlgItem(IDC_SHWMSG)->EnableWindow(TRUE
;)GetDlgItem(IDC_DFLTMSG)->EnableWindow(TRUE
;)GetDlgItem(IDC_CLRMSG)->EnableWindow(TRUE
;)GetDlgItem(IDC_STATICMSG)->EnableWindow(TRUE
}
else
{
;)GetDlgItem(IDC_MSG)->EnableWindow(FALSE
;)GetDlgItem(IDC_SHWMSG)->EnableWindow(FALSE
;)GetDlgItem(IDC_DFLTMSG)->EnableWindow(FALSE
;)GetDlgItem(IDC_CLRMSG)->EnableWindow(FALSE
;)GetDlgItem(IDC_STATICMSG)->EnableWindow(FALSE
}
:
;)UpdateData(TRUE
)if(m_bEnablePgm == TRUE
{
;)GetDlgItem(IDC_RUNPGM)->EnableWindow(TRUE
;)GetDlgItem(IDC_PROGTORUN)->EnableWindow(TRUE
;)GetDlgItem(IDC_STATICPGM)->EnableWindow(TRUE
}
else
{
;)GetDlgItem(IDC_RUNPGM)->EnableWindow(FALSE
;)GetDlgItem(IDC_PROGTORUN)->EnableWindow(FALSE
;)GetDlgItem(IDC_STATICPGM)->EnableWindow(FALSE
}
. TRUE FALSE
. .
Tab
- MFC
www.jenab.persiangig.com
50
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Order .
. Format
Tab Order .
- MFC
www.jenab.persiangig.com
51
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
MFC
.
.
. -
. .
Messages
WM_LBUTTONDOWN
WM_LBUTTONUP
WM_LBUTTONDBLCLK
WM_RBUTTONDOWN
WM_RBUTTONUP
WM_RBUTTONDBLCLK
WM_MOUSEMOVE
WM_MOUSEWHEEL
- MFC
www.jenab.persiangig.com
52
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
.
WM_MOUSEMOVE .
. .
.2 .
)
( .
Properties Messages
- MFC
www.jenab.persiangig.com
53
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
.4 OnMouseMove .
. . :
OnMouseMove . .
) (device context .
CClientDC . .
.
. SetPixel . X Y
: . RGB
.
0 255.
AND OR
. AND .
01011001
00101001
00001001
AND
- MFC
www.jenab.persiangig.com
54
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
1 1
1 0 .
OR | AND | OR || OR
OR . OR Visual Basic . OR
. OR 0 0 1
. . 0 0 .
01011001
00101001
01111001
OR
OR . OR
00001000
00100000
00101000
.
. ) ( .
AND .
00101000
00001000
00001000
) ( .
if . if .
- MFC
www.jenab.persiangig.com
55
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
) (
X Y .
Add Variable int
.
.
.
!
.
. OnMouseMove
CMouseDlg Class View ) highlight( Properties Messages
. WM_LBUTTONDOWN
Combo box <add> OnLButtonDown .
OnLButtonDown .
;m_iPrevX = point.x
;m_iPrevY = point.y
.
- MFC
www.jenab.persiangig.com
56
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
. .
WM_KEYDOWN
WM_KEYUP
) (.
A B I C
. WM_KEYDOWN OnKeyDown
;char IsChar
;HCURSOR IhCursor
;)IsChar = char(nChar
)'if(IsChar == 'a' || IsChar == 'A
{
;)IhCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW
;)SetCursor(IhCursor
}
)'if(IsChar == 'b' || IsChar == 'B
{
;)IhCursor = AfxGetApp()->LoadStandardCursor(IDC_IBEAM
;)SetCursor(IhCursor
}
)'if(IsChar == 'c' || IsChar == 'C
{
;)IhCursor = AfxGetApp()->LoadStandardCursor(IDC_WAIT
;)SetCursor(IhCursor
}
)'if(IsChar == 'x' || IsChar == 'X
{
;)IhCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW
;)SetCursor(IhCursor
;)(OnOK
}
- MFC
www.jenab.persiangig.com
57
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
OnKeyDown . .
.
. OnKeyDown .
. OnKeyDown Alt
Ctrl Shift . if
Caps Lock OR .
LoadStandardCursor .
. SetCursor
. .
. .
. ...
WM_SETCURSOR .
;m_bCursor = FALSE
OnKeyDown m_bCursor TRUE .
.
;char IsChar
;HCURSOR IhCursor
;)IsChar = char(nChar
)'if(IsChar == 'a' || IsChar == 'A
{
;)IhCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW
;)SetCursor(IhCursor
}
)'if(IsChar == 'b' || IsChar == 'B
{
;)IhCursor = AfxGetApp()->LoadStandardCursor(IDC_IBEAM
;)SetCursor(IhCursor
}
- MFC
www.jenab.persiangig.com
58
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
FALSE OnSetCursor .
OnSetCursor .
.
: LoadCursor .
Visual C++ IDC_MYCURSOR
;)IhCursor = AfxGetApp()->LoadCursorW(IDC_MYCURSOR
- MFC
www.jenab.persiangig.com
59
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
MFC
) (
NOTIFYICONDATA .
shlwapi.h include .
) (Global
"#include "shlwapi.h
;NOTIFYICONDATA m_SysTryIcon
OnInitDialog .
;)(m_SysTryIcon.hWnd = this->GetSafeHwnd
;m_SysTryIcon.uID = 0x1
;m_SysTryIcon.cbSize = NOTIFYICONDATA_V2_SIZE
;)m_SysTryIcon.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME
;m_SysTryIcon.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE
;)" "StrCpy(m_SysTryIcon.szTip, L
;m_SysTryIcon.uCallbackMessage = WM_USER+75
;)Shell_NotifyIcon(NIM_ADD,&m_SysTryIcon
hWnd
uID .
cbSize
hIcon
uFlags
.1 NIF_ICON hIcon
.
.3 NIF_MESSAGE
uCallbackMessage .
- MFC
www.jenab.persiangig.com
60
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
szTip StrCpy
.
uCallbackMessage ) ( ...
.
Shell_NotifyIcon NIM_ADD
. WM_DESTROY
) ( .
;)Shell_NotifyIcon(NIM_DELETE,&m_SysTryIcon
NIF_MESSAGE uFlags
uCallbackMessage .WM_USER+75
SysTry ) (SysTryDlg.CPP
) BEGIN_MESSAGE_MAP(CSysTryDlg, Cdialog .
)ON_MESSAGE (WM_USER+75, OnSystemTryMessage
) OnSystemTryMessage ( )
( .
- MFC
www.jenab.persiangig.com
61
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
//
)switch(lParam
{
case WM_LBUTTONDOWN:
;)this->ShowWindow(SW_NORMAL
//
;)(SetForegroundWindow
SetFocus(); //
;break
case WM_RBUTTONDOWN:
this->ShowWindow(SW_HIDE); //
;break
}
. lParam
. switch ShowWindow
- MFC
www.jenab.persiangig.com
62
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
WM_WINDOWPOSCHANGING override )
Peroperties Messages WM_WINDOWPOSCHANGING
OnWindowPosChanging (.
)if(!m_visible
;lpwndpos->flags &= ~SWP_SHOWWINDOW
;)CDialog::OnWindowPosChanging(lpwndpos
) OnSystemTryMessage
( .
)switch(lParam
{
case WM_LBUTTONDOWN:
;m_visible = TRUE
;)this->ShowWindow(SW_NORMAL
;)(SetForegroundWindow
;)(SetFocus
;break
case WM_RBUTTONDOWN:
;)this->ShowWindow(SW_HIDE
;break
}
Minimize
Minimize WM_SIZE
.
)if(nType == SIZE_MINIMIZED
;)ShowWindow(SW_HIDE
else
;)CDialog::OnSize(nType, cx, cy
) (Popup .
IDR_MENU1 TrackPopupMenu ) .
OnSystemTryMessage .
- MFC
www.jenab.persiangig.com
63
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
if(lParam == WM_RBUTTONDOWN) //
{
;CMenu mnu
//
;)mnu.LoadMenu(IDR_MENU1
;CMenu *PopUpMenu
;)PopUpMenu=mnu.GetSubMenu(0
;)(SetForegroundWindow
CPoint pt; //
//
;)GetCursorPos(&pt
PopUpMenu->TrackPopupMenu(TPM_RIGHTALIGN,pt.x,pt.y,this); //
}
: ) (Resource View Add Resource
. Menu New .
. IDR_MENU1
. ID Properties
ID .
Shell_NotifyIcon NIM_MODIFY
) . ID IDI_ICON1 (.
;)m_SysTryIcon.hIcon = AfxGetApp()->LoadIcon(IDI_ICON1
;)" "StrCpy(m_SysTryIcon.szTip, L
;)Shell_NotifyIcon(NIM_MODIFY,&m_SysTryIcon
NIF_INFO uFlags .
dwInfoFlags
szInfo szInfoTitle .
Shell_NotifyIcon NIM_MODIFY
)
Shell_NotifyIcon ( . :
- MFC
www.jenab.persiangig.com
64
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
;m_SysTryIcon.dwInfoFlags = NIIF_INFO
")); // "(StrCpy(m_SysTryIcon.szInfo,_T
;))" "(StrCpy(m_SysTryIcon.szInfoTitle,_T
//
//
;)Shell_NotifyIcon(NIM_MODIFY,&m_SysTryIcon
dwInfoFlags
NIIF_INFO
NIIF_NONE
NIIF_ERROR
szInfo
szInfoTitle
szInfo .
szInfo
Shell_NotifyIcon . :
;))""(StrCpy(m_SysTryIcon.szInfo,_T
;)Shell_NotifyIcon(NIM_MODIFY,&m_SysTryIcon
- MFC
www.jenab.persiangig.com
65
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
MFC
.
.
32 . Registry
:
HKEY_CLASSES_ROOT
HKCR . .
.
HKEY_CURRENT_USER
HKCU .
. Hive USER.DAT .
HKEY_LOCAL_MACHINE
HKLM CPU
.
HKEY_USERS
HKU . HKU . Default
. HKU
Administrator .
HKEY_CURRENT_CONFIG
HKCC
.
.
.
.
. . . .
512 .
32 . 255
16383 . 1 .
- MFC
www.jenab.persiangig.com
66
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
: ERROR_SUCCESS
if .
. Registry Editor
. Start Run
CString
RegCreateKeyExW
RegCloseKey . RegCreateKeyExW
.
Edit Control .
;HKEY hkey
;DWORD dwDisp
UpdateData(TRUE); //
;}wchar_t buf[255]={0
" " "" wcscpy_s(buf,m_strRegInUser); //
;wchar_t *strMyRegValue=buf
;long errorcheck
errorcheck=RegCreateKeyExW( //
//
//
HKEY_CURRENT_USER,
L"Software\\Mahtab_V1",
0,
//
NULL,
REG_OPTION_NON_VOLATILE, //
KEY_ALL_ACCESS,
//
NULL,
&hkey,
//
&dwDisp); //
if(errorcheck == ERROR_SUCCESS) //
{
errorcheck=RegSetValueExW( //
- MFC
67
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
//
//
hkey,
L"MySTR",
//
//
//
0,
REG_SZ,
(LPBYTE) strMyRegValue,
(DWORD)(lstrlen(strMyRegValue)+1)*sizeof(TCHAR));//
RegCloseKey(hkey); //
)if((errorcheck == ERROR_SUCCESS
{
//
}
HKEY DWORD
.
RegCreateKeyEx .
HKEY_CURRENT_USER
Software . Regedit
.
- MFC
68
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
REG_OPTION_VOLATILE
REG_OPTION_NON_VOLATILE
dwDisp
.
REG_CREATED_NEW_KEY
REG_OPENED_EXISTING_KEY
RegSetValueExW MySTR .
. .
ERROR_SUCCESS
if .
CString
RegOpenKeyEx
RegQueryValueEx MySTR .
//
//
//
;HKEY hkey
;long errorcheck
(errorcheck=RegOpenKeyEx
HKEY_CURRENT_USER,
L"Software\\Mahtab_V1",
//
//
0,
KEY_ALL_ACCESS,
//
;)&hkey
if(errorcheck == ERROR_SUCCESS) //
{
;}wchar_t buf[255] = {0
DWORD dwType,
dwBufSize=500L; //
errorcheck=RegQueryValueEx( //
- MFC
www.jenab.persiangig.com
69
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
hkey, //
L"MySTR", //
0, //
&dwType, //
(BYTE*)buf, //
&dwBufSize); //
//
;)RegCloseKey(hkey
if(errorcheck == ERROR_SUCCESS) //
{
m_strRegOutData=buf; //
;)UpdateData(FALSE
}
}
long
RegCreateKeyExW
Edit Control
;HKEY hkey
;DWORD dwDisp,cpData=4
;)UpdateData(TRUE
;DWORD longMyRegValue=m_longNumberInUser
;long errorcheck
(errorcheck=RegCreateKeyExW
//
//
//
HKEY_CURRENT_USER,
L"Software\\Mahtab_V1",
0,
//
NULL,
REG_OPTION_NON_VOLATILE,
//
KEY_ALL_ACCESS,
//
NULL,
&hkey,
//
&dwDisp); //
if(errorcheck == ERROR_SUCCESS) //
{
- MFC
70
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
//
(errorcheck=RegSetValueExW
hkey, //
L"MyNUM", //
0, //
32 //
REG_DWORD,
(LPBYTE) &longMyRegValue, //
cpData); //
RegCloseKey(hkey); //
)if((errorcheck == ERROR_SUCCESS
{
//
}
}
long
long RegOpenKeyEx
RegQueryValueEx MyNUM .
MyNUM long .
//
//
//
;HKEY hkey
;long errorcheck
(errorcheck=RegOpenKeyEx
HKEY_CURRENT_USER,
L"Software\\Mahtab_V1",
//
//
0,
KEY_ALL_ACCESS,
&hkey); //
if(errorcheck == ERROR_SUCCESS) //
{
;DWORD buf = 4
;DWORD dwType = REG_DWORD
;)DWORD dwBufSize = sizeof(DWORD
errorcheck=RegQueryValueEx( //
hkey, //
L"MyNUM", //
0, //
&dwType, //
(PBYTE)&buf, //
- MFC
71
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
&dwBufSize); //
RegCloseKey(hkey); //
if(errorcheck == ERROR_SUCCESS) //
{
m_longRegValueOut=buf; //
;)UpdateData(FALSE
}
RegOpenKeyEx RegDeleteValue
.
//
//
//
;HKEY hkey
;long errorcheck
(errorcheck=RegOpenKeyEx
HKEY_CURRENT_USER,
L"Software\\Mahtab_V1",
//
0,
//
KEY_ALL_ACCESS,
//
;)&hkey
if(errorcheck == ERROR_SUCCESS) //
{
errorcheck= RegDeleteValue( //
//
//
hkey,
;)"L"MySTR
RegCloseKey(hkey); //
)if(errorcheck == ERROR_SUCCESS
{
//
}
else
{
//
//
}
else
{
//
//
}
- MFC
www.jenab.persiangig.com
72
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
RegDeleteKey .
Mahtab_V1 HKEY_CURRENT_USER\Software .
;long errorcheck
errorcheck=RegDeleteKey( //
//
;)"HKEY_CURRENT_USER,L"Software\\Mahtab_V1
)if(errorcheck==ERROR_SUCCESS
{
//
}
else
{
//
}
RegEnumKeyEx .
HKEY_CURRENT_USER\Software CString .
;HKEY hkey
;DWORD dwIndex=0,dKeyNameBufSize=256
;}wchar_t cahrKeyName[256]={0
;]CString strKeyNames[100
))if(ERROR_SUCCESS==RegOpenKeyExW(HKEY_CURRENT_USER, L"Software", 0, KEY_ENUMERATE_SUB_KEYS, &hkey
{
))while(ERROR_NO_MORE_ITEMS!=RegEnumKeyExW(hkey ,dwIndex ,cahrKeyName ,&dKeyNameBufSize ,NULL ,NULL, NULL, NULL
{
;strKeyNames[dwIndex]=cahrKeyName
;dwIndex++
;dKeyNameBufSize=256
}
;)RegCloseKey(hkey
}
dwIndex
.
cahrKeyName .
dKeyNameBufSize -
) ERROR_MORE_DATA
( TCHARs
256 .
ERROR_NO_MORE_ITEMS .
- MFC
www.jenab.persiangig.com
73
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
RegEnumValue .
HKEY_CURRENT_USER\Software\Mahtab CString .
;HKEY hkey
;DWORD dwIndex=0 ,dRegNameBufSize=256
;}wchar_t cahrValueName[256]={0
;]CString strValueNames[100
))if(ERROR_SUCCESS==RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Mahtab", 0, KEY_QUERY_VALUE, &hkey
{
))while(ERROR_NO_MORE_ITEMS!=RegEnumValueW(hkey ,dwIndex ,cahrValueName ,&dRegNameBufSize ,0 ,0 ,0 ,0
{
;strValueNames[dwIndex]=cahrValueName
;dwIndex++
;dRegNameBufSize=256
}
;)RegCloseKey(hkey
}
dwIndex
.
cahrKeyName .
dKeyNameBufSize -
) ERROR_MORE_DATA
( TCHARs
256 .
ERROR_NO_MORE_ITEMS .
: RegEnumValue
) NULL (.
- )
(
.
- MFC
www.jenab.persiangig.com
74
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
MFC
Name ) ID_MMTIMER
(.
.
;)SetTimer(ID_MMTIMER, 1000, NULL
WM_TIMER .
1000 ) ( .
)
(.
WM_TIMER
. Class View )
- MFC
www.jenab.persiangig.com
75
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
KillTimer
;)KillTimer(ID_MMTIMER
- MFC
www.jenab.persiangig.com
76
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
MFC
.
) 79 .
:
100 400 100 4
.
.
:
79
.
6 6
79 " (6*31)"186 6
6 .
.1 6 : 31 ) 6 31 (.
31 .
.
.2 6 186 : 30 .
6 30 .
7 .
" "621 .
79
) ( .
- MFC
www.jenab.persiangig.com
77
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
11 10 .
.
. 30 ) 3 30 (.
9 30 .
10 .
622 ) . (
:VC++
typedef struct _SHAMSIDATE
{
;int iYear
;int iMonth
;int iDay
;}SHAMSIDATE
)SHAMSIDATE MiladiToShamsi(int iMiladiMonth,int iMiladiDay,int iMiladiYear
{
;int shamsiDay, shamsiMonth, shamsiYear
; int dayCount,farvardinDayDiff,deyDayDiff
;}int sumDayMiladiMonth[] = {0,31,59,90,120,151,181,212,243,273,304,334
;}int sumDayMiladiMonthLeap[]= {0,31,60,91,121,152,182,213,244,274,305,335
;SHAMSIDATE shamsidate
;farvardinDayDiff=79
))if (MiladiIsLeap(iMiladiYear
{
;dayCount = sumDayMiladiMonthLeap[iMiladiMonth-1] + iMiladiDay
}
else
{
;dayCount = sumDayMiladiMonth[iMiladiMonth-1] + iMiladiDay
}
)))if((MiladiIsLeap(iMiladiYear - 1
{
;deyDayDiff = 11
}
else
{
;deyDayDiff = 10
}
)if (dayCount > farvardinDayDiff
{
;dayCount = dayCount - farvardinDayDiff
)if (dayCount <= 186
78
www.jenab.persiangig.com
- MFC
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
{
switch (dayCount%31)
{
case 0:
shamsiMonth = dayCount / 31;
shamsiDay = 31;
break;
default:
shamsiMonth = (dayCount / 31) + 1;
shamsiDay = (dayCount%31);
break;
}
shamsiYear = iMiladiYear - 621;
}
else
{
dayCount = dayCount - 186;
switch (dayCount%30)
{
case 0:
shamsiMonth = (dayCount / 30) + 6;
shamsiDay = 30;
break;
default:
shamsiMonth = (dayCount / 30) + 7;
shamsiDay = (dayCount%30);
break;
}
shamsiYear = iMiladiYear - 621;
}
}
else
{
dayCount = dayCount + deyDayDiff;
switch (dayCount%30)
{
case 0 :
shamsiMonth = (dayCount / 30) + 9;
shamsiDay = 30;
break;
default:
shamsiMonth = (dayCount / 30) + 10;
shamsiDay = (dayCount%30);
break;
}
shamsiYear = iMiladiYear - 622;
}
shamsidate.iYear = shamsiYear;
shamsidate.iMonth = shamsiMonth;
shamsidate.iDay = shamsiDay;
- MFC
www.jenab.persiangig.com
79
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
; return shamsidate
;)CDialog aboutDlg(IDD_ABOUTBOX
;)(aboutDlg.DoModal
. a 0 255
255 . a 255
.
SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,
;)GetWindowLongPtr(this->GetSafeHwnd(), GWL_EXSTYLE) | WS_EX_LAYERED
;)SetLayeredWindowAttributes(0, a, LWA_ALPHA
)(Desktop
shlobj.h ) (.
""stdafx.h
""wininet.h
""TestMFC.h
""TestMFCDlg.h
><shlobj.h
><comdef.h
#include
#include
#include
#include
#include
#include
IActiveDesktop . h
private Dialog .
private:
;IActiveDesktop *pActive
80
- MFC
www.jenab.persiangig.com
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
: OnInitDialog
HRESULT hRes;
CoInitialize(NULL);
hRes = ::CoCreateInstance(
CLSID_ActiveDesktop,
NULL,
CLSCTX_INPROC_SERVER,
IID_IActiveDesktop,
(void**)&pActive);
if ( hRes != S_OK )
return FALSE;
: Button
if ( pActive->SetWallpaper(_T("C:\\A.jpg"),NULL) == S_OK )
{
pActive->ApplyChanges(AD_APPLY_ALL);
MessageBox(_T("Set Wallpapaer"));
}
::CoUninitialize();
Wallpaper C A Button
.
stdafx.h IActiveDesktop :
: wininet.h
// turns off MFC's hiding of some common and often safely ignored warning
messages
#define _AFX_ALL_WARNINGS
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
//************************************
//************************************
#include <wininet.h>
//************************************
//************************************
#include <afxdisp.h> // MFC Automation classes
OnInitDialog
CoInitialize
. COM COM
.
- MFC
www.jenab.persiangig.com
81
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
CoCreateInstance
. COM CoClass Interface
. COM Register .
bit 64 bit 128 . CoClass . COM
IUnknown NULL.
object . CLSCTX_INPROC_SERVER
. Object Dll .
id .
IActiveDesktop . Private .
GetLogicalDriveStrings .
strDriveName intDriveNum
;DWORD nBufferLength=100
;]wchar_t charDrive[100
;]CString strDriveName[20
;int intDriveNum=0, c=0, i
;)' '(for(i=0;i<100;i++) charDrive[i]=_T
;)GetLogicalDriveStringsW(nBufferLength,charDrive
;}wchar_t buf[5]={0
;i=0
))' '(while(charDrive[i]!=_T
{
;]buf[c]=charDrive[i
;c++
)if(charDrive[i]==0
{
;c=0
;strDriveName[intDriveNum]=buf
;++intDriveNum
}
;i++
}
;intDriveNum--
- MFC
www.jenab.persiangig.com
82
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
FindFirstFile FindNextFile .
D CString . i .
;]CString strFileName[256
;WIN32_FIND_DATA MyFileInfo
;HANDLE hFind
;"*\\wchar_t charPath[256]=L"D:
;BOOL bTest
;int i
;)hFind = FindFirstFile(charPath, &MyFileInfo
)if (hFind != INVALID_HANDLE_VALUE
{
;i=0
do
{
;strFileName[i]=MyFileInfo.cFileName
;)bTest=FindNextFile(hFind ,&MyFileInfo
;i++
;)}while(bTest!=NULL
;)FindClose(hFind
}
charPath * *.exe
. FindFirstFile FindNextFile
INVALID_HANDLE_VALUE . FindNextFile
.
MyFileInfo WIN32_FIND_DATA
cFileName
dwFileAttributes
FindClose .
SetFileAttributes . Test.TXT
D .
;)SetFileAttributes(L"D:\\Test.TXT",FILE_ATTRIBUTE_HIDDEN
GetFileAttributes
- MFC
www.jenab.persiangig.com
83
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
;DWORD dAttributes
;"wchar_t charPathAndFile[256]=L"D:\\Test.TXT
;)dAttributes=GetFileAttributes(charPathAndFile
)if((dAttributes&FILE_ATTRIBUTE_HIDDEN)==FILE_ATTRIBUTE_HIDDEN
{
;dAttributes=dAttributes ^ FILE_ATTRIBUTE_HIDDEN
;)SetFileAttributes(charPathAndFile ,dAttributes
}
DeleteFile -
ERROR_ACCESS_DENIED
ERROR_FILE_NOT_FOUND . -
. Test.TXT D .
;)"DeleteFile(L"D:\\Test.TXT