How do I programmatically implement WinCE "open Folder Dialog"? Here will be related to the following to analyze the knowledge, dialog box is a special window, it in wince as the application and program users between the communication window, through the display and access to information to make people's communication more convenient, here first introduced the next wparam and lparam, For the mouse, LoWord (WParam) and HiWord (WParam) represent the x, y coordinates of the mouse position, and for menus and controls, the low bytes of both wParam are the respective IDs, that is, LoWord (WParam) is the ID. The high byte of both is 0 for the menu, the message code for the control (message code may also be 0) so it is not possible to judge whether the message comes from the menu or from the control by the wparam parameter, but it can be judged by lparam, for the menu lparam constant 0, For a control, it is a child window handle.
Its structure and dialog box are similar, divided into three kinds:
1. Predefined dialog box (provided by the system)
InputBox ()
MsgBox ()//use to know the meaning of the parameter
2. Customize dialog box (Customize dialog box)
3. The common dialog box (the system-provided Active X plugin) is not visible----runtime, and the common dialog object allows 6 display standards to be displayed in the program, as follows:
* Dialog box Message processing
The dialog box procedure handler format is:
1 BOOL CALLBACK dialogproc ( 2 HWND hwnddlg,3 UINT umsg, 4 WPARAM WPARAM,5 LPARAM LPARAM6 );
The return value is ture and false, which is the bool type. In the Windows header file is the int type.
The window procedure handler function is formatted as:
1 LRESULT CALLBACK procwinmain ( 2 34 5 );
The return value is lresult.
* Create dialog box
Here's a way to create a dialog box: (Treat the dialog box as a window)
The RegisterClassEx function registers the dialog template as a window class, and then creates a window that derives from the window class. The modified place is Stdwndclass.cbwndextra, which was originally null and is now changed to Dlgwindowextra. As follows
1 Stdwndclass.cbwndextra = Dlgwindowextra; 2 Stdwndclass.lpszclassname = ClassName; 3 Stdwndclass.cbclsextra = NULL;
Note here that the stdwndclass.lpszclassname corresponds to the name of the window class. This allows the dialog box to be treated as a window.
Call Function RegisterClassEx Register window class after you change it.
Then there is Hdlg=createdialogparam (hinstance,dlgname,null,null,null);
The non-modal dialog box handles the processing of the message in the program's message queue, which is the process of processing the program window.
The last is the improvement in the message loop: (IsDialogMessage to determine whether the message is a dialog box message, and to create a modeless dialog box with Createdialogparam)
1 while(GetMessage (&stmsg,null,0,0))2 {3 4 if(! IsDialogMessage (hdlg,&stmsg))5 { 6 7TranslateMessage (&stmsg);8DispatchMessage (&stmsg);9 Ten } One}
So speaking of the initial problem starting point, how to implement WinCE "Open Folder dialog box"? The final code is as follows:
1 browseinfo bi; 2 0 sizeof (Browseinfo)); 3 lpitemidlist idl=shbrowseforfolder (&bi); 4 if (idl==null) return ; 5 SHGetPathFromIDList (Idl,strfilepath.getbuffer (MAX_PATH));
Wince dialog Box Programming