2011의 게시물 표시

[STL] Insert Iterator Demo

이미지
Front Insert Iterator : 앞부분부터 삽입. 새치기하듯이 삽입되어서, 먼저 들어온 원소가 가장 마지막에 위치하게 된다. Back Insert Iterator : First Com First Serv.방식 온 순서대로 차례로 왼쪽에서 오른쪽으로 삽입된 결과를 나타낸다. Insert Iterator : Sequence Container에서는 원하는 index에 접근해서 삽입이 가능하다. 그러나 Associative Container의 경우 의미를 가지지 못한다. 따라서, 값이 정렬된 상태로 출력된다. #include <iostream> #include <list> #include <vector> #include <set> #include <string> #include <iterator> using namespace std; template<typename Container> void   PrintContainer ( string   strTitle,Container& cont ) ; int   main ( ) {       int   pArray [ 5 ]   =   { 9 , 1 , 4 , 7 , 2 } ;       //Front Insert Iterator     list<int> iList;     copy ( pArray,pArray +5 ,front_inserter ( iList ) ) ;     PrintContainer ( "Front Insert" ,iList ) ;       //Back Insert Iterator     vector<int> iVector;       for ( int   i= 0 ; i< 5 ; i++ ) {         back_inserter ( iVector )   = pArray [ i ] ;       }  

[Win32 API] WNDCLASSEX Structure

Contain window class information. It is used with the RegisterClassEx and GetClassInfoEx functions. The WNDCLASSEX structure is similar to the WNDCLASS structure. There are two differences. WNDCASSEX include the cbSize member, which specifies the size of the structure, and the hIconSm member, which contains a handle to a small icon associated withe the window class. Syntax typedef struct tagWNDCLASSEX { UINT      cbSize; UINT      style; WNDPROC   lpfnWndProc; int       cbClsExtra; int       cbWndExtra; HINSTANCE hInstance; HICON     hIcon; HCURSOR   hCursor; HBRUSH    hbrBackground; LPCTSTR   lpszMenuName; LPCTSTR   lpszClassName; HICON     hIconSm; } WNDCLASSEX, *PWNDCLASSEX; Members cbSize : The size, in bytes, of this structure. Set this member to sizeof(WNDCLASSEX). Be sure to set this member before calling GetClassinfoEx function. style : The class style(s). This member can be any combination of the Class Style. lpfnWndProc : A pointer to the w

[Win32 API] DefWindowProc Function

Calls the default window procedure to provide default processing for any window messages that an application does not process. This function ensures that every message is processed. DefWindowproc is called with the same parameters recieved by the window procedure. Syntax LRESULT WINAPI DefWindowProc( __in  HWND hWnd, __in  UINT Msg, __in  WPARAM wParam, __in  LPARAM lParam ); Parameters Same as WindowProc Function. Return Value The return value is the result of the message processing and depends on the message. Reference :  http://msdn.microsoft.com/en-us/library/ms633572(VS.85).aspx

[Win32 API] WindowProc

An application-defined function that processes messages sent to a window. the WNDPROC type define a pointer to this callback function. Syntax LRESULT CALLBACK WindowProc( __in  HWND hwnd, __in  UINT uMsg, __in  WPARAM wParam, __in  LPARAM lParam ); Parameters hwnd : a handle to the window. uMsg : The message For list of the system-provide messages. see System-Defined Message. wParam : Additional message information. The contents of this parameter depend on the value of th uMsg parameter. lParam : Additional message information. The contents of this parameter depend on the value of th uMsg parameter. Return Value  The return value is the result of the message processing and depend on the message sent. Reference :  http://msdn.microsoft.com/en-us/library/ms633573(VS.85).aspx

[Win32 API] MessageBox Function

Display a modal dialog box that contain a system icon, a set of buttons, and a brief application-specific message, such as status or error information, The message box returns an integer value that indicates which button the user clicked. Syntax int WINAPI MessageBox( __in_opt HWND hWnd, __in_opt LPCTSTR lpText, __in_opt LPCTSTR lpCaption, __in UINT uType ); Parameters hWnd : A handle to the owner window of the message box to be created.If this parameter is NULL, the message box has no owner window. lpText : The message to be displayed. If the string consist of more than one line, you can separate the lines using a carriage return and/or linefeed character between each line. lpCaption : the dialog box title. If this parameter is NULL , the default title is Error. uType: The contents and behavior of the dialog box. This parameter can be a combination of flags from the following group flags. 너무 많다. Link :  http://msdn.microsoft.com/en-us/library/ms645505(VS.85

[Win32 API] MSG Structure

Contain message information from a thread's message queue. Syntax typedef struct tagMSG { HWND   hwnd; UINT   message; WPARAM wParam; LPARAM lParam; DWORD  time; POINT  pt; } MSG, *PMSG, *LPMSG; Members hwnd : A handle to the window whose window procedure receives the message. This member is NULL when the message is a thread message. message : The message identifier.Applications can only use the low word; the high word is reserved by system. wParam : additional information about the message.The exact meaning depends on the value of the message member. lParam : additional information about the message.The exact meaning depends on the value of the message member. time : The time at which the message was posted. pt : The cursur position,in screen coordinates, when the message was posted.

[Win32 API] TranslateMessage()

Translate virtual-key messages into character messages. The character messages are posted to the caling thread's message queue, to be read the next time the thread call the GetMessage or PeekMessage function. Syntax BOOL WINAPI TranslateMessage( __in  const MSG *lpMsg ); Parameters lpMsg ; A pointer to an MSG structure that contains messgae information retrieved from the calling thread's message queue by using the GetMessage or PeekMessage function. Return Value If the message is translate, the return value is nonzero(true). otherwise, the return value is zero(false) If the message is WM-KEYDOWN,WM_KEYUP,WM_SYSTEMDOWN,or WM_SYSTEMUP, the return value is nonzero, regardless of the translation. conceptual :  Message and Message Queues example :  Using Message and Message Queues. Reference :  http://msdn.microsoft.com/ko-kr/library/ms644955.aspx?appId=Dev10IDEF1&l=KO-KR&k=k(CMFCPROPERTYGRIDFONTPROPERTY);k(DevLang-

[Win32 API] GetMessage Function()

Retrieves a message from (only) the calling thread's message queue. Syntax BOOL WINAPI GetMessage( __out     LPMSG lpMsg, __in_opt  HWND hWnd, __in      UINT wMsgFilterMin, __in      UINT wMsgFilterMax ); Parameters lpMsg : A pointer to an MSG structure that recives message information from the thread's message queue. hWind : A handle to the window whose message are to be retrieved. The Window must belong to the current thread. If hWnd is NULL, GetMessage retrieves message for any window that belong to the current thread, and any messages on the current thread's message whose hwnd value is NULL. Therefore if hWnd is NULL, both window massages and thread messages are processed. wMsgFilterMin : The integer value of the lowest message value to be retrieved. ex) Use WM_KEYFIRST(0x0100) to specify the first keyboard message or WM_MOUSEFIRST(0x0200) to specify the first mouse message. wMsgFilterMax : The integer value of the highest message value to be retri

[Win32 API] ShowWindow Function

Set the specified windows's show state. Syntax BOOL WINAPI ShowWindow( __in  HWND hWnd, __in  int nCmdShow ); Parameter hWin : A handle to the window. nCmdShow : Controls how the window is to be shown. This parameter can be use one of the following values. Value Meaning SW_FORCEMINIMIZE 11 Minimizes a window, even if the thread that owns the window is not responding. This flag should only be used when minimizing windows from a different thread. SW_HIDE 0 Hides the window and activates another window. SW_MAXIMIZE 3 Maximizes the specified window. SW_MINIMIZE 6 Minimizes the specified window and activates the next top-level window in the Z order. SW_RESTORE 9 Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window. SW_SHOW 5 Activates the window and displays it in its current size and position.

[Win 32 API] GetStockObject Function

The GetStockObject function retrieves a handle to one of the stock pens,brush,fonts, or palettes. Syntax HGDIOBJ GetStockObject( __in  int fnObject ); Parameters The type of stock object. This parameter can be one of the following values. Value Meaning BLACK_BRUSH Black brush. DKGRAY_BRUSH Dark gray brush. DC_BRUSH Solid color brush. The default color is white. The color can be changed by using the  SetDCBrushColor  function. For more information, see the Remarks section. GRAY_BRUSH Gray brush. HOLLOW_BRUSH Hollow brush (equivalent to NULL_BRUSH). LTGRAY_BRUSH Light gray brush. NULL_BRUSH Null brush (equivalent to HOLLOW_BRUSH). WHITE_BRUSH White brush. BLACK_PEN Black pen. DC_PEN Solid pen color. The default color is white. The color can be changed by using the  SetDCPenColor  function. For more information, see the Remarks section. NULL_PEN NULL pen. The null pen draws nothing. WHITE_PEN White pen. ANSI_FIXED_FONT Windows fixed-pitch (