Windows. h

Source: Internet
Author: User
Code

# Include <windows. h>
# Include <windowsx. h>
# Include "resource. H"
# Include <wchar. h>

Void button_oncommand (hwnd, int ID, hwnd hwndclt, uint codenostrap)
{
Switch (ID)
{
Case idok:
Wchar_t lpsz [max_path];
Wmemset (lpsz, 0, max_path );

// Control macro
Edit_gettext (getdlgitem (hwnd, idc_edit1), lpsz, max_path );
MessageBox (hwnd, lpsz, l "OK", null );
Break;
Case idcancel:
MessageBox (hwnd, l "Click cancle! ", L" cancle ", null );
Break;
}

}

Lresult callback procmain (hwnd hdlg, uint MSG, wparam, lparam)
{
Switch (MSG)
{

// Message delivery method
Handle_msg (hdlg, wm_command, button_oncommand );

// Traditional Method
Case wm_initdialog:
Break;
Case wm_close:
Postquitmessage (0 );
Break;
// Case wm_command:
// The button will send the wm_command message to the parent window. parameters:
// Loword (wparam) is the Child Window ID.
// Hiword (wparam) is the notification code.
// Lparam is the sub-window handle.
/*
Switch (loword (wparam ))
{
Case idok:
MessageBox (hdlg, l "click OK! ", L" OK ", null );
// Enablewindow (hwnd) lparam, false );
Break;
Case idcancel:
MessageBox (hdlg, l "Click cancle! ", L" cancle ", null );
Break;
}
*/
// Break;
Case wm_destroy:
Postquitmessage (0 );
Break;
// Default:
// Return defwindowproc (hdlg, MSG, wparam, lparam );

}

Return 0;
}

Int winapi winmain (hinstance, hinstance hprevinstance, lpstr lpcmdline, int nshowcmd)
{
Dialogboxparam (hinstance, makeintresource (idd_dialog1), null, (dlgproc) procmain, 0 );
Return 0;
}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.