VC sculptor small technology set (3)
He Zhidan
1, the fixed window size, the maximum value is (600, 400), the minimum is also (600, 400).
Void CMAINFRAME :: ONGETMINMAXINFO (MinMaxInfo Far * LPMMI)
{
LPMMI-> PTMaxTracksize.x = 600;
LPMMI-> ptmaxtracksize.y = 400;
LPMMI-> ptmintracksize.x = 600;
LPMMI-> ptmintracksize.y = 400;
CframeWnd :: ONGETMINMAXINFO (LPMMI);
}
2. Close the dialog and window:
In fact, the destruction of the general window can be destroyed with DestoryWindow (), and the destruction of the dialog box can be enddialiog ().
EndDialog (IDOK);
The return value of Domodal () is IDOK, but does not execute the user-defined Onok.
As long as you send a WM_CLOSE message, there will be a function of responding.
SendMessage (WM_CLOSE);
Postmessage (WM_CLOSE);
Void ctestdialog :: onbutton1 ()
{
GetParent () -> DestroyWindow ();
}
Window and dialog box
Postmessage (WM_QUIT);
SendMessage (wm_quit); //
No mode dialog with destroyWindow ();
EndDialog
You have a problem with you open the original dialog.
3, the use of global variables:
C *** App Defines a cstring
when using it
Void cdlgdlg :: onbutton2 ()
{
((CDLGAPP *) AFXGetApp ()) -> str = "test";
}
Don't forget to include files
4, how to let the DOS program turn on automatically and not display
Automatically run the resolution, write the registry RUN value,
VC windows2000
Change Main to WinMain
5, clear automatic password history
In the browser:
Tools -> Internet Options -> Content -> Point "Automated (U)" button -> Clear password
http://tzsvc.xiloo.com/skill/sys/clear.htm
ShdeleteKey (HKEY_CURRENT_USER,
_T ("Software // Microsoft // Internet Explorer // IntelliForms));
6, execute an executable program
method one:
Shellexecute (this-> getsafehwnd (), "open", "f: //he.txt", null, null, sw_shownormal);
Method Two:
Process_information pi;
Startupinfo Si;
Si.cb = sizeof (startupinfo);
si.lpreserved = null;
Si.lpdesktop = null;
Si.lptitle = NULL;
Si.dwflags = 0;
Si.cbreserved2 = 0;
Si.lpreserved2 = NULL;
Bool Bres = CreateProcess (Null, "Test A.TXT B.TXT", NULL, NULL, FALSE,
Normal_Priority_Class,
NULL, NULL, & SI, & PI;
IF (BRES == FALSE)
{
AfxMessageBox ("CreateProcess Failed");
}
Else
{
CloseHandle (Pi.hthread); DWORD dwret = WaitForsingleObject (pi.hprocess, 1000 * 30);
Switch (dwret)
{
Case Wait_Object_0:
DWORD DWEXITCODE;
Bres = getExitcodeProcess (pi.hprocess, & dwexitcode);
TCHAR EXITMSGBUF [1024];
IF (BRES)
{
WSPrintf (Exitmsgbuf, "EXIT CODE:% D", DWEXITCODE);
}
Else
WSPrintf (Exitmsgbuf, "EXIT code failed to return");
AFXMESSAGEBOX (Exitmsgbuf);
Break;
DEFAULT:
AfxMessageBox ("exit for other reason";