Issue of self-starting shell by WinCE

Source: Internet
Author: User

WinCECustomized running upon startupShellIs the basic requirement of many systems, and sometimes needs to be blockedWinCEBuilt-inShell.WinCEMediumProgramYou can modify the registry and add a self-starting shortcut. It is convenient to modify the Registry as follows:

[HKEY_LOCAL_MACHINE \ init]
"Launch70" = "myapp.exe"
"Depend70" = HEX: 14,00, 1e, 00

As longMyapp.exePackageNK, AndPlatform. RegAdd the preceding registry informationWinCEThe program runs automatically at startup. HoweverWinCEBuilt-inShellAlways come out first before runningMyapp.exeTo avoid this situation, we can modify the registry settings as follows:

[HKEY_LOCAL_MACHINE \ init]
"Launch50" = "myapp.exe"
"Depend50" = HEX: 14,00, 1e, 00

Starting soonAssumer.exeToMyapp.exe. This wayWinCEGo to the customShellInstead of startingAssumer.exe. However, new problems may be introduced.ShellIs based onMFCAnd useCfiledialogUnexpected situations will occur when you wait for the class library, as shown in:


Is not started Assumer.exe When you try to import the Registry file Assumer.exe There is no problem. This description CfiledialogDepends on Assumer.exe The details are not studied. But it indicates that it is not started. Assumer.exe , Based on MFC Of Shell Problems may occur during running. So Assumer.exe Must be started, but cannot appear WinCE Interface. To solve this problem, you naturally want to modify it. Assumer.exe . Wince5.0 And Wince6.0 .CodeAll of them are public. Wince6.0 Medium ShellThe related code in C: \ wince600 \ public \ shell \ oak \ HPC \ Explorer \ main Directory.

After reading this part of code, we found that we only need to modify the following two files to meet the requirements.

C: \ wince600 \ public \ shell \ oak \ HPC \ Explorer \ main \ Desktop. cpp

Code
Bool c0000topwnd: Create ()
{

ishellfolder * pshf;
foldersettings FS;
rect RC;
hresult hR = e_fail;
// get a shell folder for the desktop
hR = shget1_topfolder ( & pshf );
If (HR |! Pshf)
goto cleanup;

// Create a shell view for it
HR = pshf-> createviewobject (null, iid_ishellview, (lpvoid *)& _ PSV);
If (HR |! _ PSV)
Goto cleanup;

FS. viewmode = fvm_icon;
FS. fflags = fwf_desktop | fwf_alignleft | fwf_noscroll;

// ++ Changed by hjb
// Set the size of the desktop window to 0
// Setrect ( & Rc , 0, 0, getsystemmetrics (sm_cxvirtualscreen), getsystemmetrics (sm_cyvirtualscreen ));
Setrect ( & Rc , 0, 0, 0, 0 );
// -- Changed by hjb

// Create the desktop's View window (no need to addref since createviewwindow does it)
HR = _ PSV-> createviewwindow (null, & FS , (Ishellbrowser *) This, & Rc , & _ Hwnd );
If (HR |! _ Hwnd)
{
Release ();
Goto cleanup;
}

Registerdesktop (_ hwnd );

Cleanup:
If (pshf)
Pshf-> release ();

Return (hR = s_ OK );
}

C: \ wince600 \ public \ shell \ oak \ HPC \ Explorer \ main \ Explorer. cpp

Code
DWORD winapi createtaskbar (lpvoid pevent)
{
Handle hsyncevent = * (handle *) pevent );
Ctaskbar * ptaskbar = NULL;
Hwnd hwndtb = NULL;

Ptaskbar = new ctaskbar;

// ++ Added by hjb
// Force termination upon Task Bar Creation
If (ptaskbar)
{
Delete ptaskbar;
Setevent (hsyncevent );
Return 0;
}
// -- Added by hjb

If (! Ptaskbar)
{
Setevent (hsyncevent );
Return 0;
}

G_taskbar = ptaskbar;
If (! Ptaskbar-> Register (g_hinstance ))
{
G_taskbar = NULL;
Delete ptaskbar;
Setevent (hsyncevent );
Return 0;
}

Registertaskbar (ptaskbar-> getwindow ());
Setevent (hsyncevent );

DWORD dwret = ptaskbar-> messageloop ();

Delete ptaskbar;

Return dwret;
}

After modifying these two fields, compile the Directory and then recompile the entire system.(RunSysgen)It should be enough.Assumer.exeStill start, still can hearWinCEStartup sound,WinCEThe interface has been blocked. In this caseMFCOfShellIt can also work normally, as shown in:


In actual operation, I failed to modifySource codeCompile to complete this test. BecauseC: \ wince600 \ public \ shell \ oak \ HPC \ Explorer \ mainDirectory, it only generatesExplorer. Lib. Because it takes too long to recompile the entire systemAssumer.exeFile,Makeimg. There should be a quick compilation method here, but I don't know how to do it now.

After modificationWince6.0In the simulator, the expected results are achieved. This probably solves the problemMFCOfShellAndAssumer.exeIt is not clear whether there is any hidden danger between them. At present, it seems that there is no problem.

Note thatPublicAndPrivateMake sure to back up the files in the directory to avoid future problems.
ModifiedWince6.0OfAssumer.exeAnd Demo Video:

Http://files.cnblogs.com/we-hjb/WinCE_Shell.rar

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.