WINCE6.0 Storage memory和Program memory调整引起异常问题

WINCE6.0系统下ROM-only FileSystem,在控制面板下有系统这项:

WINCE6.0 Storage memory和Program memory调整引起异常问题_第1张图片

图1

只要稍微一拖动就跑到最右边,选择OK后,如果我打开桌面的IE,弹出无法执行“iesample”

WINCE6.0 Storage memory和Program memory调整引起异常问题_第2张图片

图2

 

重启后恢复为设置之前的,现在我想要的效果就是让它保留,但禁止拖动或是拖动无效,如何解决!有几种办法:

 

1.      修改源代码

 

相关代码在\WINCE600\PUBLIC\WCESHELLFE\OAK\CTLPNL\CPLMAIN\system.cpp文件的MemoryDlgProc函数中,只需要在WM_INITDIALOG消息处理部分禁止IDC_TRACKBAR刻度条的窗口对mouse和keyboard输入的响应,通过调用:

::EnableWindow(hwndSlider , FALSE)

来实现,相关代码如下:

extern "C" BOOL APIENTRY MemoryDlgProc (HWND hDlg, UINT message, UINT wParam, LONG lParam)
{

    MemoryState *pMemoryState;

    pMemoryState = (MemoryState *)GetWindowLong(hDlg,DWL_USER);

    // if we don't have our state, don't process
    if(message != WM_INITDIALOG && !pMemoryState)
        return FALSE;

    switch (message)
    {
	    case WM_INITDIALOG:
	    {
			TCHAR  szTemp[100];
	    	DWORD PageSize, TotPages, StoreUsed, RamUsed, StorePages;
			GetMemoryInfo(PageSize, TotPages, StoreUsed, RamUsed, StorePages);

            pMemoryState = new MemoryState;
            if(!pMemoryState)
            {
                ASSERT(0);  // Couldn't create persistant storage
                return FALSE;
            }
            else
            {
                ZEROMEM(pMemoryState);
                SetWindowLong(hDlg,DWL_USER,(LONG)pMemoryState);
            }
            
			pMemoryState->fSliderMoved = FALSE;

			// save this for restore if we fail
			pMemoryState->orgStorePages = StorePages;
			
			// Init the slider
			HWND hwndSlider = GetDlgItem(hDlg, IDC_TRACKBAR);
			::EnableWindow(hwndSlider , FALSE);//kandi add at 2013.12.26
			WORD wMax = (WORD) (TotPages / TICK_RESOLUTION);
			SendMessage(hwndSlider, TBM_SETRANGE, TRUE, MAKELONG(1, wMax)); 
			SendMessage(hwndSlider, TBM_SETTICFREQ, (wMax / 75), 0L);			  // tick freq.
			SendMessage(hwndSlider, TBM_SETPAGESIZE, 0L, 3);			  // page up/dn size
			SendMessage(hwndSlider, TBM_SETPOS,TRUE, StorePages / TICK_RESOLUTION);	  

			// init the current allocations
			_snwprintf(szTemp, ARRAYSIZE(szTemp) -1, CELOADSZ(IDS_SYSTEM_MEMKBYTE), StorePages * PageSize);
			szTemp[ARRAYSIZE(szTemp) -1] = 0;
			SetDlgItemText(hDlg, IDC_STATIC_LEFT, szTemp);

			_snwprintf(szTemp, ARRAYSIZE(szTemp) -1, CELOADSZ(IDS_SYSTEM_MEMKBYTE), (TotPages-StorePages) * PageSize);
			szTemp[ARRAYSIZE(szTemp) -1] = 0;
			SetDlgItemText(hDlg, IDC_STATIC_RIGHT, szTemp);

			// init timer so we can update
			pMemoryState->idTimer = SetTimer(hDlg, 2, 1500, NULL);
			MemoryDlgOnTimer(hDlg,pMemoryState);

            AygInitDialog( hDlg, SHIDIF_SIPDOWN );
			return 1;
		}

		case WM_TIMER:
			MemoryDlgOnTimer(hDlg,pMemoryState);
			return TRUE;
		
		case WM_HSCROLL:			// track bar message
			switch LOWORD(wParam) {
				case TB_BOTTOM:
				case TB_THUMBPOSITION:
				case TB_LINEUP:
				case TB_LINEDOWN:
				case TB_PAGEUP:
				case TB_PAGEDOWN:
				case TB_TOP:
					pMemoryState->fSliderMoved = TRUE;
					MemoryDlgOnSlider(hDlg);
					return (TRUE);
				}
			break;

	    case WM_COMMAND:
            switch (LOWORD(wParam))
            {
				case IDOK:
				{
					if(pMemoryState->fSliderMoved) {
						MemoryDlgOnOK(hDlg, pMemoryState->orgStorePages);
					}
					if (pMemoryState->idTimer)  {
						KillTimer(hDlg, pMemoryState->idTimer);
						pMemoryState->idTimer = 0;
					}
					return TRUE;
		    	}
		    }
			break;
		case WM_SYSCOLORCHANGE:
			// fwd the syscolorchange to our trackbar
			SendMessage(DI(IDC_TRACKBAR), message, wParam, lParam);
			break; // return FALSE anyway so DefDlgProc handles it for ourselves

	    case WM_DESTROY:
            // we won't get this far if the 
		    delete pMemoryState;
		    SetWindowLong(hDlg,DWL_USER,0L);
		    break;
	}
    return (FALSE);
}


 

编译办法:

F:\WINCE600\PUBLIC\WCESHELLFE\OAK\CTLPNL-----Rebuildand clean sysgen

Rebuild current BSP and Subprojects----------ok,但如果此步选择是makerun-time image,则控制面板下部分程序显示的是英文。

 或是直接采用来替换掉windows目录下的文件cplmain.cpl,不需要重启。

2.      修改rc文件

 

对应文件为\WINCE600\PUBLIC\WCESHELLFE\OAK\CTLPNL\CPLMAIN\cplmain.rc文件,相关内容如下:

//@CESYSGEN ENDIF

//@CESYSGEN IF CPLMAIN_SYSTEM
//
// System dialogs
//
IDD_MEMORY DIALOG DISCARDABLE  0, 0, 132, 140
STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
BEGIN
    LTEXT        "Move slider to the left for more memory to run programs. Move it to the right for more storage space.", IDC_STATIC,5,2,120,26
    LTEXT        "Only unused RAM (black portion of the slider bar) can be adjusted.",IDC_STATIC,5,30,120,16
	//orinigal
	//CONTROL        "",IDC_TRACKBAR,"msctls_trackbar32",TBS_AUTOTICKS |
	//  			TBS_TOP | TBS_ENABLESELRANGE | WS_TABSTOP,3,47,124,22
	
	//kandi change at 2013.12.26
    	CONTROL        "",IDC_TRACKBAR,"msctls_trackbar32",TBS_AUTOTICKS |
    			TBS_TOP | TBS_ENABLESELRANGE | WS_TABSTOP|WS_DISABLED,3,47,124,22

                
    LTEXT        "Storage",IDC_STATIC_STORAGE,12,70,64,8
    LTEXT        "memory",IDC_STATIC_MEMORY1,12,78,64,8
    LTEXT        "Program",IDC_STATIC_PROGRAM,81,70,64,8
    LTEXT        "memory",IDC_STATIC_MEMORY2,81,78,64,8
    LTEXT        "1,000KB",IDC_STATIC_LEFT,5,89,29,8
    LTEXT        "1,000KB",IDC_STATIC_RIGHT,72,89,29,8
    LTEXT        "total",IDC_STATIC_ALLOC_LEFT,34,89,27,8
    LTEXT        "total",IDC_STATIC_ALLOC_RIGHT,101,89,27,8
    LTEXT        "in use",IDC_STATIC_IN_USE_LEFT,34,98,33,8
    LTEXT        "in use",IDC_STATIC_IN_USE_RIGHT,101,98,33,8
    LTEXT        "640KB",IDC_IN_USE_LEFT,5,98,27,8
    LTEXT        "640KB",IDC_IN_USE_RIGHT,72,98,29,8
END


只需要在下面设置刻度条属性基础上或上WS_DISABLED即可

CONTROL       "",IDC_TRACKBAR,"msctls_trackbar32",TBS_AUTOTICKS |

                                  TBS_TOP| TBS_ENABLESELRANGE | WS_TABSTOP,3,47,124,22

修改之后:

CONTROL       "",IDC_TRACKBAR,"msctls_trackbar32",TBS_AUTOTICKS |

                                  TBS_TOP| TBS_ENABLESELRANGE | WS_TABSTOP| WS_DISABLED,3,47,124,22

 

编译办法:

F:\WINCE600\PUBLIC\WCESHELLFE\OAK\CTLPNL-----Rebuildand clean sysgen

Rebuild current BSP and Subprojects----------ok,但如果此步选择是makerun-time image,则控制面板下部分程序显示的是英文。

 

但这种办法对于英文系统是有效的,对于非英文系统控制面板下大部分程序,包括这次修改的显示都是英文。

 

3.      修改res文件

比如对应英文系统,在\WINCE600\PUBLIC\WCESHELLFE\OAK\LIB\ARMV4I\RETAIL和\WINCE600\PUBLIC\WCESHELLFE\OAK\LIB\ARMV4I\RETAIL、0409下都有systeml.res文件,都要同时修改,比如修改显示的内容做了下面的编译测试都无效,目前还不知道原因,先备忘:

 

修改systeml.res文件

F:\WINCE600\PUBLIC\WCESHELLFE-----sysgen

Clean sysen整个工程

-----不OK

 

F:\WINCE600\PUBLIC\WCESHELLFE-----sysgen

sysen整个工程

--------------不行

 

 

F:\WINCE600\PUBLIC\WCESHELLFE\oak-----sysgen

make run-timeimage----------------------------

-----不行

 

总结:采用第1种办法,直接修改源代码,这样对于其他语言都有效,但如果对于RAM and ROM 文件系统来说,如何要兼容,就要知道RAM and ROM文件系统多了下面的注册表信息:

; HIVE BOOT SECTION

[HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\ObjectStore]

   "Dll"="filesys.dll"

   "Paging"=dword:1

   "LoadFlags"=dword:1

   "BootPhase"=dword:0

   "MountPermanent"=dword:1

    ; Only mountObjectStore FS as root if PRJ_ENABLE_FSMOUNTASROOT is NOT set

    ; in order topreserve backwards compatibility (ObjectStore is root of

    ; virtual filesystem by default).

   "MountAsRoot"=dword:1

; END HIVE BOOT SECTION

或是通过其他办法

 

你可能感兴趣的:(WINCE6.0 Storage memory和Program memory调整引起异常问题)