کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

به اشتراک گذاری اطلاعات کسب شده در اکسس از سایت آفیس و سایت های تخصصی خارجی
کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

به اشتراک گذاری اطلاعات کسب شده در اکسس از سایت آفیس و سایت های تخصصی خارجی

گرفتن استرینگ آیتم های SystemMenu


در تصویر بالا تعداد آیتم ها عدد 6 است 


szItem As String*100
((szItem=String$(100,Chr(0
(hSysMenu=GetSystemMenu(hwnd
(hSysMenuItmCount=GetMenuItemCount(hSysMenu,0
For i=0 To hSysMenuItmCount
(ItemId=GetMenuItemId(hSysMenu,i
(Length=GetMenuString(hSysMenu,i,szItem,Len(szItem)+1,MF_BYPOSITION
(txt=Left$(szItem,Length
Debug.Print txt,ItemId,i
Next

درباره ی تابع GetMenuString 

If the function succeeds, the return value specifies the number of characters copied to the buffer, not including the terminating null character.

If the function fails, the return value is zero.

If the specified item is not of type MIIM_STRING or MFT_STRING, then the return value is zero.

Remarks

The nMaxCount parameter must be one larger than the number of characters in the text string to accommodate the terminating null character.

If nMaxCount is 0, the function returns the length of the menu string.



درباره تابع  GetMenuItemCount 


Return Value

Type: int

اگر عملکرد موفقیت آمیزباشدمقداربرگشتی تعداد آیتم های منو خواهدبود.

If the function succeeds, the return value specifies the number of items in the menu.

If the function fails, the return value is -1


درباره  تابع  GetMenuItemId


Return Value

Type: UINT

مقدار برگشتی شناسه ی آیتم منوی مشخص شده خواهد بود اگر شناسه ی آیتم منو نال یا شامل ساب منو باشد عدد برگشتی 1- است که اثبات و تست شده.  

The return value is the identifier of the specified menu item. If the menu item identifier is NULL or if the specified item opens a submenu, the return value is -1.


درباره تابع ModifyMenu



(idItem=GetMenuItemID(hmenu, uItemPos

ModifyMenu hmenu,idItem,MF_BYCOMMAND+MF_STRING,idItem, szItem


Return Value

Type: BOOL

اگر تابع ( عملکرد ) موفقیت آمیز باشد مقدار برگشتی عددی غیرصفر است خواه مثبت یا منفی  و در صورت عدم موفقیت صفر را برخواهد گرداند.

If the function succeeds, the return value is nonzero

If the function fails, the return value is zero

پیام WM_INITMENU برای چک مارک منو آیم



The following example has three menu items and moves the check mark of the menu item each time the menu is opened.



Public Function WndProc (HWND hWnd, UINT iMessage

( WPARAM wParam, LPARAM lParam,

 HDC hdc

PAINTSTRUCT ps

 static int count = 0

 Mes="Checks menu items in order every time the menu is

" opened

 Select Case iMessage

 case WM_INITMENU

  CheckMenuItem (HMENU) wParam

(IDM_MENU1,MF_BYCOMMAND | MF_UNCHECKED , 

,CheckMenuItem (HMENU) wParam, IDM_MENU2,m

( MF_BYCOMMAND | MF_UNCHECKED

CheckMenuItem ((HMENU) wParam, IDM_MENU3, MF_BYCOMMAND | MF_UNCHECKED)

count = (count +1)% 3

CheckMenuItem (HMENU) wParam, IDM_MENU1 + count, MF_BYCOMMAND | MF_CHECKED)

Wndproc=False

case WM_PAINT

(hdc = BeginPaint (hWnd, ps

(TextOut hdc, 10, 10, Mes,len(Mes

  (EndPaint (hWnd,ps

 WndProc=False

case WM_DESTROY

 PostQuitMessage (0

 WndProc=False

Case Else

(Wndproc=DefWindowProc (hWnd, iMessage, wParm,lParam

End Select

Exit Function