.


:




:

































 

 

 

 


,




combobox , listbox edit. SendMessage, , , , .

  • windows.h , combobox. CB_.

 

( scrollbar)

, , WM_COMMAND. , , WM_VSCROLL WM_HSCROLL.

  • lParam . lParam NULL, ,
  • wParam .

. . , , GetSystemMetrics:

  • GetSystemMetrics(SM_CYHSCROLL) ,
  • GetSystemMetrics(SM_CXVSCROLL) .

, :

SetScrollRange(hWndScroll, SB_CTL,iNewMin,iNewMax,bRedraw);

, , . , , , WS_TABSTOP CreateWindow.

. hWnd hWndScroll , :

static int min_sb=1,max_sb=100,pos_sb=20;

SetScrollRange(hWndScroll,SB_CTL,min_sb,max_sb,TRUE);

SetScrollPos(hWndScroll,SB_CTL,pos_sb,TRUE);

, :

case WM_VSCROLL:

{

//

int nScrollCode=(int)LOWORD(wParam);

//

short int nPos=(short int)HIWORD(wParam);

// NULL

HWND hwndScrollBar=(HWND)lParam;

 

int old_pos_sb=pos_sb;

switch(nScrollCode)

{

case SB_PAGEDOWN: pos_sb+=10; break;

case SB_PAGEUP: pos_sb-=10; break;

case SB_LINEDOWN: pos_sb+=1; break;

case SB_LINEUP: pos_sb-=1; break;

case SB_THUMBPOSITION: pos_sb=nPos; break;

case SB_THUMBTRACK: pos_sb=nPos; break;

default: return 0l;

}

if(pos_sb<min_sb) pos_sb=min_sb;

if(pos_sb>max_sb) pos_sb=max_sb;

if(old_pos_sb!=pos_sb)

SetScrollPos(hWndScroll,SB_CTL,pos_sb,TRUE);

}; return 0l;

 

, .

, ID : IDD_DIALOG1

:

DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), hWnd, Dialog1);

hInst , MAKEINTRESOURCE(IDD_DIALOG1) , hWnd -, Dialog1 .

 

: Windows

 

Windows , , .

Windows , Windows WM_TIMER, .

Windows:

, .

, , , .

- . , .

.

SetTimer. , , Windows WM_TIMER.

KillTimer. KillTimer WM_TIMER.

. , SetTimer 1000 , ( ). , WM_TIMER .

, SetTimer.

Windows WM_TIMER . SetTimer :

SetTimer(hWnd, iTimerID, dwTimer, NULL); :

hWnd , WM_TIMER.

iTimerID - , , . , 1.

dwTimer 32- , .

NULL .

WM_TIMER ( WM_TIMER), :

KillTimer(hWnd, iTimerID);

, SetTimer.

. .

WM_TIMER, wParam , lParam 0.

, , :

#define TIMER_SEC 1 #define TIMER_MIN 2... SetTimer(hWnd, TIMER_SEC,1000,NULL); SetTimer(hWnd, TIMER_MIN,60000,NULL);

wParam WM_TIMER.

WM_TIMER :

case WM_TIMER:{ UINT wTimerID = wParam; switch(wTimerID) { // case TIMER_SEC:... break; // case TIMER_MIN:... break; }}; return 0;

. , KillTimer SetTimer.

Windows .

, , (call-back). , Windows. Windows , Windows .

, CALLBACK, Windows . .

, , . Windows .

TimerProc, ( WM_TIMER):

void CALLBACK TimerProc(HWND hWnd,UINT iMsg,UINT iTimerID,DWORD dwTime){ // WM_TIMER...} :

hWnd , SetTimer.

iMsg WM_TIMER, .. Windows TimerProc WM_TIMER.

iTimerID .

dwTime .

WM_TIMER ( ), SetTimer :

SetTimer(hWnd,1,1000,(TIMERPROC)TimerProc);

, , hWnd SetTimer NULL, ( ) . ID ( NULL, ):

UINT iTimerID=SetTimer(NULL,0,1000,(TIMERPROC)TimerProc);

KillTimer NULL. , SetTimer:

KillTimer(NULL, iTimerID);

. , SetTimer, , .


0. , , :

1. , : _? ,

2. - +, -

3. , , ( , ).

4. - ( 2) , 2

5. , . : ; (, , ); : / . .

6. , , . , . , . ( ):

7. , :

8. , : ( ); ( ); (); (2 radio); (checkbox).

9. , - 33, 44. (33 44) , -. , 2 : .

10. , 0 100, , , . , 35. 20, , .. .





:


: 2016-03-27; !; : 478 |


:

:

- , , .
==> ...

1580 - | 1382 -


© 2015-2024 lektsii.org - -

: 0.02 .