command Public Class Commandchange Implements Command { Private TV mytv; Private Int Channel; Public Commandchange (TV, Int Channel ){Mytv = TV; This . Channel = channel;}Public Void Execute (){Mytv. changechannel (Channel );}} // It can be seen as a remote control. Public Class Control { Private Command oncommand, offcommand, changechannel; Public Control (command on, command off, Command Channel ){
;}Public void off (){System. Out. println (description + "stereo off ");}
}
Public class simpleremotecontrol {Command [] oncommands;Command [] offcommands;Command undocommand;Static final int number = 7; Public simpleremotecontrol (){Oncommands = new command [7];Offcommands = new command [7];Command nocommand = new nocommand ();For (INT I = 0; I {Oncommands [I] = nocommand;Offcommands [I] = nocommand;}Undocommand = nocommand;}Public void setcommand (INT slot, command
);}
Okay, now we can compile it. What, good?However, you soon discovered that my program was not closed? Yes. The main window is hidden and has not been closed yet. Originally, when all windows are closed, the main window should also be
Disabled. So I chose cchildframe: onclose () and sent a message to the main window to check whether there is a cchildframe window:
Void cchildframe: onclose (){Cframewnd: onclose ();Afxgetmainwnd ()-> postmessage (wm_command, id_close_child, 0); // id_close_chil
high, as a result, the development cost of this software is too high, and the company cannot survive. Therefore, balancing usability and software bugs becomes an artistic thing. Different scenarios have different requirements and must not be perfect for perfection. The following describes how to use outputdebugstring to output debugging information to the development platform.
The outputdebugstring function declaration is as follows:
WinbaseapiVoidWinapiOutputdebugstringa (_ In lpcstr lpoutput
Setwindowpos (
_ In hwnd,
_ In_opt hwnd hwndinsertafter,
_ In int X,
_ In int y,
_ In int CX,
_ In int cy,
_ In uint uflags );
Hwnd is the handle of the window.
Hwndinsertafter is the Z sequence attribute of the window.
X is the position of the window on the X axis.
Y is the position of the window in Y.
CX is the window width.
Cy is the window height.
Uflags is the flag for selecting settings.
An example of calling this function is as follows:
#001 //
#002 // response command.
#003 // Cai juns
.
TeststringIs a plain text string, but can contain the following extensible components.CondpatternIs conditional pattern,That is, One is applied to the current instanceTeststringRegular Expression,That is,TeststringIt will be calculated and thenCondpatternMatch.Rewritecond % {http_user_agent} ^ Mozilla .*
Rewriterule ^/$/homepage.max.html [l]
Rewritecond % {http_user_agent} ^ lynx .*
Rewriterule ^/$/homepage.min.html [l]
Rewriterule ^/$/homepage.std.html [l]
Rewriteengine
Syntax: rewrite
, tb_buttonstructsize, sizeof (tbbutton), 0 ); // Add the button to the toolbar : Sendmessage (hwndtb, tb_addbuttons, (uint) 5, (lparam) tbarray ); So far, a cool tool bar is basically created, and then you can call the showwindow () function: Showwindow (hwndtb, sw_showmaximized ); When you click the button, the toolbar sends the message to the parent window, and the parent window responds to the message. ToolbarThe button ID is included in the wparam parameter of the message function. You
Use the commandname and commandargument attributes on the ASP. NET page:
You may be confused about the commandname and commandargument attributes in the linkbutton component. In fact, they play a very important role. Example:
If there are 100 linkbuttons in one of your pages, you need to determine on the server end which is being pressed. Without these two attributes, you can assign values to the text attribute of each linkbutton and check the text attribute value to determine which linkbut
, from here you can do whatever you like to do.First we make a new class file and name it Main (including the Capital)Now we remove the constructor because we dont need any, the entrypoint is called as an other method.Ok i just fast forward this part because its small and i will just post a bare bone template for the Main.csCode:
public class Main : VInjDn.IInjectable{ public int OnCommand(VInjDn.LiquidCommand command) { return 1; }
Command ConcreteCommandpublic class CommandChange implements Command {private TV myTv; private int channel; public CommandChange (TV TV, int channel) {myTv = TV; this. channel = channel;} public void execute () {myTv. changeChannel (channel );}}
// It can be viewed as the remote Control Invokerpublic class Control {private Command onCommand, offCommand, changeChannel; public Control (Command on, Command off, Command channel) {
. xul files must be added, and the id can be set at will
// Declare the. js file to be used// Declare the attribute multi-language string to be used// Add the xul element to the firefox Interface// For the xul element features, refer to the xul tutorial.// Reference: http://developer.mozilla.org/en/XUL_Tutorial
Insertafter = "context-selectall" oncommand = "onCmdDownloadAll (event)"/>
Accesskey = " download_link_text.accesskey;" insertafter = "cont
()2) In the. cpp file,
Except (CMainFrame, CFrameWnd) // {AFX_MSG_MAP (CMainFrame) ON_WM_CREATE () ON_COMMAND (IDM_CHANGMENUITEM, OnChangmenuitem) // Add it here. Note that ';' //} else () void CMainFrame: OnChangmenuitem () {// write the code to be processed here ......}Other methods:
If the menu ID value is continuous, it is best to use ON_COMMAND_RANGE to map the message processing function. You can process all messages within a range in a function.
When you press a menu item, a WM_COMMAND
functions after MFC implements on1_msg for cwnd.CodeNo need to change.
In this step, the border window tries to process the message.
If the border window object is not processed, it is sent to the applicationProgramObject processing. The on1_msg of the ctapp is called. Because the ctapp and its basic cwinapp do not actually overwrite on1_msg, the function c1_target: on1_msg is actually called. Because the current object is an MFC Application object, the on1_msg function searches for the m
,OnbubbleeventThere are two parameters, because the event originated outside the control; the second parameter provides the source.
So far, this topic explains how the control responds to a bubble event. The following section shows how to create a control that defines a bubble event. Define a bubble event
If you want the control to enable event bubbling for the event defined by it, the control mustOnEventnameMethod callRaisebubbleevent. You do not need to do any additional work in this co
{events. addhandler (commandeventkey, value );}Remove {event. removehandler (commandeventkey, value );}}
Protected virtual void oncommand (commandeventarg E){Commandeventhandler handler = event [commandeventkey] As commandeventhandler;If (handler! = NULL) handler (this E );Raisebubblerevent (this, e );}
The commandeventargs event data class exposes the commandname and commandargument attributes to maintain the command name and command parameters.Send
i S to ' delete this './/Never explicitly call ' delete ' in a CFrameWnd, use DestroyWindow insteaddelete this; _afxwin_inline HWND Cwnd::getsafehwnd () const{return this = = NULL? Null:m_hwnd; }///********************cmywinapp::onnew () line 44_afxdispatchcmdmsg (CCmdTarget * 0x00531c88 class CMyWinApp theApp, unsigned int 40001, int 0, void (void) * 0x00401046 cmywinapp::onnew (void), void * 0x00000000, unsigned int, afx_cmdhand Lerinfo * 0x00000000) line 88ccmdtarget::oncmdmsg (unsigned int
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.