Facing Issue while finding a file on my handheld device through my Desktop App - IDEs, Libraries, & Programming Tools

Hi,
I am facing issue while finding a file (CeFindFirstFile(..)) on my handheld device through my Desktop application. My Desktop application is VB.NET application and OS is Windows 7. On the other hand, OS on handheld device is Windows CE. Every time CeFindFirstFile() returns -1 and error#18 with the getlasterror().
Have used function like:
lngRetVal = CeFindFirstFile(str_path, sCE_Find_Data)
and used path string for the variable str_path in several different ways. Let me know in case you need further information.
Appreciate your help in this regard.
Thanks,
JP

Related

Writing a Device Driver for XDA I or II

I am attempting to write a simple Stream device driver. Although I can't find any sample driver code, the following link: http://www.cegadgets.com/wincedevfaq.htm#5.7 leads to a simple device driver (intended for detecting power-down, which is irrelevant to my problem).
Taking this code and making it into a project for Pocket PC gives me a Device Driver which works fine in the emulator, and fails on the XDA itself.
Specifically, when my test application calls RegisterDevice(L"PWR", 0, L"PWRDLL.DLL", 0) it fails (returns 0) and GetLastError returns 2 (File not Found).
My test application and the DLL are both in the root directory. When I try this on the emulator it works fine; if I move the DLL to a different directory it still works provided I put the full path in the RegisterDevice call.
If anyone has a stream device driver sample which actually works on the XDA - or any practical advice - I would be delighted to receive it.
look at msdn
David,
have a look at msdn.microsoft.com/embedded/ Here you'll find most of the things you need. If you have a broadband connection you can download all tools and source codes MS has to offer. If you don't have a fast connection they'll send out an evaluation DVD [key code is valid for 120 days] with current Visual C++ (4.0) embedded compiler and the source code for their current CE release as long as the copyrights are left with them. I enjoy wading through the code and look for ideas or implementations.
Give it a try instead of browsing the internet for sources you'll not find.
Kind regards
Udo

Leading underscore in function name

Hi!
I try to integrate an external library into my vs2005 project while using the Windows Mobile 6 SDK. Of course, I added the additional directories and dependencies to the project settings, but I get some LNK2019 errors anyway.
So I created a dump of the *.lib files using "dumpbin.exe" and discovered that all function names start with a leading underscore. I found some precompiled parts of the library where there are no leading underscores in the function names and I can call them without any problems. But if I build those parts of the library on my own, there again are the LNK2019 errors and the "_functionname()" convention in the *.lib files.
Is there either a way to avoid those underscores when compiling the library or to call those function out of a windows mobile application?
Thanks in advance!
This looks a bit odd.
C++ decorates exported functions unless you add a def file to the project, but there is always way more garbage in the names.
What I don't understand is, why do you have a problem using a function that starts with an underscore?
Such names are perfectly acceptable in C / C++, in fact some C native functions like _wfopen start with an underscore.
What language are you programming in?
Also it might help find the solution, if you tell us what library you are using. Is it something available for download or your own creation?
Thanks for your quick reply.
I am working on a porting of the intel openCV computer vision library and I try to include it into a VS2005 C++ projekt created with the wizard for windows mobile 6.0 sdk for testing.
It seems that the problem appears when I switch the system to "/SUBSYSTEM:WINDOWSCE". Otherwise the library works perfectly.

[help needed] NEC PC9801 Emulator [updated]

Hi,
I have a touch HD (blackstone) and I wanted to run the Pocket PC official port of "Neko Project" on it :
http://retropc.net/yui/np2wce.html
It a NEC PC9801 Emulator (an old japanese PC like computer, with a lot of cool games ).
Two problems :
- the mouse module is disabled, probably because the target Pocket PC dont have a touch screen, the code looks like this (WinCE/MOUSEMNG.CPP)
BYTE mousemng_getstat(SINT16 *x, SINT16 *y, int clear) {
*x = 0;
*y = 0;
(void)clear;
return(0xa0);
}
Its clearly different from the file Win9x/MOUSEMNG.CPP for the win32 port
- the second problem, there is no 800x480 resolution support, this could be corrected in this file I think : WinCE/NP2.H
My request, can anyone (with a good experience on Windows Mobile coding) help me correct these two problems ? the source code is available on the link above (the file np2_081as.zip).
I'm somewhat good at coding in Win32 API but have never coded on Pocket PC...
Thanks in advance
Bye
UP please ?
Hi, here's a little update,
I managed to change the resolution to 480x800, no need to use wvgafix now
I even managed to detect the exact mouse position, but when I click nothing happens
Here is the source code, can anyone take a look and help me correcting the mouse part ? I tryed to copy the code from the win9x source but it didnt work...
http://rapidshare.com/files/185069548/np2.zip
Thanks in advance
UP please ?

[Q] Android as an external (text) display: Linux/ADB/USB?

Hi everyone,
I would like to write an application (chain) like that:
MyLinuxApplication->FloatNumber->CallOfALibrary->SendToUsb->AndroidAsUsbDevice->AndroidAppToDisplayThatFloatNumber
All in all I want to send that float number about 30 times per second to Android as a live monitor/display for that value.
Is anyone aware of any other threads/tutorials/similar open source applications to avoid building such a solution from scratch?
I am aware of the iDisplay app. But it is too slow and it is Windows. The rest of our system is Linux and there is no chance to change it. Moreover I do not need any graphical content to be transmitted. Just a float number.
For the "SendToUsb->AndroidAsUsbDevice" part I could think of using ADB. Is there any example out there how to do "ADB->AndroidAppToDisplayThatFloatNumber" with the required speed? Any good ideas for "CallOfALibrary->Adb" otherwise I might end up abusing the adb shell interface.
If ADB does not work: There is an example of how to get data from an USB endpoint to an Android app on developers.android.com. However, does anyone have an example of "FloatNumber->CallOfALibrary->SendToUsb->UsbEndpoint"?
I did usb driver programming for windows about 5 years ago with the DDK and it was not fun. I fear it will be even worse in Linux. Anyone having experience with that?
Thanks for your help,
Simon

[Q] for "jwoegerbauer" about installing "autorun" manually

hi, I was hoping that you are able to help .... i am permanently mounting my my wince6 Apical AT12X gps within a replica sunvisor in my car ... i want the igoPrimo program on the gps to start as soon as the engine is running, without any interaction from me or pressing any menu buttons on the touchscreen ... so essentially, unlike most people i want to lock my device ... i do not need file or video viewers, mp3 players or games, just iGo Primo which has detailed raster maps ... youtube[dot]com/watch?v=urX3rERYZf4
looking at the MioPocket4fv installation script, a section codes adding an entry into the "init" section of the registry to detect whether an SD card is inserted, and if it is, autorun a program
this would be a good way to directly run Primo, without hacking the GPS software too much, and removal of the SD would return the GPS device's operation to factory default
can you advise what the registry settings should be if i were to do this manually ... i do not fully understand the index number concept... a screenshot of my registry is attached, i am quessing the ceSd2577 program should be stored on the NandFlash partition, and the SDMMC / sd card would have the autorun / mortscript calling primo.exe
thanks in advance from New Zealand
antdavison said:
hi, I was hoping that you are able to help .... i am permanently mounting my my wince6 Apical AT12X gps within a replica sunvisor in my car ... i want the igoPrimo program on the gps to start as soon as the engine is running, without any interaction from me or pressing any menu buttons on the touchscreen ... so essentially, unlike most people i want to lock my device ... i do not need file or video viewers, mp3 players or games, just iGo Primo which has detailed raster maps ... youtube[dot]com/watch?v=urX3rERYZf4
looking at the MioPocket4fv installation script, a section codes adding an entry into the "init" section of the registry to detect whether an SD card is inserted, and if it is, autorun a program
this would be a good way to directly run Primo, without hacking the GPS software too much, and removal of the SD would return the GPS device's operation to factory default
can you advise what the registry settings should be if i were to do this manually ... i do not fully understand the index number concept... a screenshot of my registry is attached, i am quessing the ceSd2577 program should be stored on the NandFlash partition, and the SDMMC / sd card would have the autorun / mortscript calling primo.exe
thanks in advance from New Zealand
Click to expand...
Click to collapse
Adding an SD-Autorun feature to your GPS (which is running WinCE 6.0) indeed makes sense, because the app you start via "Autorun" simply overlaps default app as was intended by OEM. Means, it doesn't hurt anything.
Now to your questions:
1. ceSD2577.exe (extracted from MioPocket 4.0 FV package) must be installed on your GPS's nandflash in <nandflash-folder>.
2. With a Windows registry editor ( use CeRegEditor ) you simply import to your GPS's registry a .REG-file you created with Notepad with contents as following:
Code:
Windows Registry Editor Version 5.00
[COLOR="Red"]<-CR Carriage Return[/COLOR]
[HKEY_LOCAL_MACHINE]
[HKEY_LOCAL_MACHINE\init]
"Launch255"="<nandflash-folder>\ceSD2577.exe" [COLOR="Red"] <- <nandflash-folder> here is placeholder for the folder you created[/COLOR]
[COLOR="Red"]<- CR Carriage Return[/COLOR]
[COLOR="Red"]<- CR Carriage Return[/COLOR]
3. On SD-card in its root create folder 2577, and put there the package containing "Autorun.exe","Autorun.mscr" & Mortscript.exe
4. If SD-card is left in GPS, everytime GPS is booted and SD-card gets initialzed, then Autorun.exe present in folder \2577 of SD-card will be executed.
thank you so much
for taking time to reply soooo quickly ... i did not really understand the launch and dependency indices, but your MP4fv code was, and suggested regedit will, be very useful ...
check out my raster maps on youtube if you have time ... new zealand government have just released hi-res (< 1m) aerial orthophotos for 95% of the country for the cost of the hard drive they send it to you on, so could be porting these to iGo Primo for years
thanks again, I am very grateful
works flawlessly, you are a genius ... thank you
the OEM menu is now totally invisible until i exit iGoPrimo
just need to make some matching green-theme splash screens for power up and iGoPrimo loading screen, and my life will be perfect
so i am looking for some "green theme" Apical menu bitmaps, the menu looks like the attached image
the 800x480 menu files i am looking for are
residentflash2-bin-Main-Fore2-*.bmp
residentflash2-bin-Main-Animate2-*.bmp
residentflash2-bin-Main-MainLayer2-*.bmp
and maybe any *.ini file relating to GPSAni*.bmp
mine (AT12/atlasVI) are all archived into a single *.bin file, which i cannot unarchive, but in earlier versions of this shell (maybe AT10/atlasV), they are separate files ... these files will give me enough menu elements to make some matching splash screens for power-on and igoPrimo load .... i don't need to modify the apical menu itself
davison[dot]antony[at]gmail[dot]com
----
hi-res aerial orthophotos in igoPrimo (150km x 130km area, <1m per pixel resolution)
youtube[dot]com/watch?v=urX3rERYZf4
understanding the launch and dependancy indices
from
austech[dot]info/gps/31080-gps-launching-program-6.html
source is
blogs[dot]msdn[dot]com/b/mikehall/archive/2007/01/04/ce-6-0-booting-processes-with-command-line-options.aspx
==================================================================================
CE based devices have a couple of options for booting applications at startup.
1. The Registry.
The first option is to use the registry to launch processes during the boot process of the device, the registry key for launching applications is HKEY_LOCAL_MACHINE\Init - the registry approach has a couple of drawbacks - the first issue is that there is a dependency chain within the boot process, processes are started and need to signal back to the o/s that the process has launched (using the SignalStarted API) so that other dependent processes can also start - here's how this looks in a snippet from a device registry.
[HKEY_LOCAL_MACHINE\init]
"Launch20"="device.dll"
"Depend20"=hex:0a,00
"Launch30"="gwes.dll"
"Depend30"=hex:14,00
"Launch50"="explorer.exe"
"Depend50"=hex:14,00, 1e,00
Take a look at the "Launch50" line, this launches "explorer.exe", the standard Windows CE shell that looks somewhat similar to the Windows desktop shell - The Explorer process has dependencies on hex:14 (20 decimal) and hex:1e (30 decimal), this maps directly to the Launch20 and Launch30 processes - explorer.exe will not be started until the processes associated with Launch20 and Launch30 are started and have signaled the o/s that that have started, an application started through the registry must call SignalStarted to allow any dependent applications to also launch - an application launched through the registry gets its launch number (50 in the case of the Explorer shell) passed as a command line parameter - this is of course passed as a string, not a number, the SignalStarted API needs to pass a DWORD value as its parameter, so a process would use SignalStarted similar to the following.
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
// Do some work here...
SignalStarted(_wtol(lpCmdLine));
The second drawback is that processes launched through the HKLM\init registry key cannot be passed any additional command line options beyond the launch key value which is then passed to SignalStarted by the launched application.
2. Startup Folder
The second option is to drop your application (or a shortcut to an application) in the operating system Startup folder (this is only implemented in the Windows Explorer shell) - The code that walks the Startup folder looking for processes to start can be found here - C:\WINCE600\PUBLIC\SHELL\OAK\HPC\EXPLORER\MAIN\exp lorer.cpp - take a look at the ProcessStartupFolder() function, it should be fairly easy to lift this code and implement your own startup folder code.
The advantage of using the Startup folder is that the applications don't need to know about the boot sequence of the o/s, don't need to be aware of the launch dependency chain, and could (if a shortcut is used) be passed command line options.
The downside of using the Startup folder is that all processes within the startup folder are launched at the same time - there isn't a dependency chain, or time delta betweeen processes launching - this could be an issue in some circumstances - let me give you an example - you may want to boot a CE device image and then connect to that device image from VS 2005 (so you can deploy/debug some managed or native applications), if you were to launch ConManClient2 and CmAccept from the startup folder you would have three minutes to configure VS 2005 with the correct IP address and then connect VS 2005 to the device - you might want to delay the launch of ConmanClient2 and CmAccept until the device has a valid and active IP address.
3. (did I say there were a couple of options?) SvcStart Services Sample.
John Spaith posted on the launch issue back in December 2004 - John wrote a sample called SVCSTART whose sole purpose in life is to start other applications with a delay period that can be configured through the registry - this sample was initially added to the CE product back at CE 4.1 and is still available today in CE 6.0 - C:\WINCE600\PUBLIC\SERVERS\SDK\SAMPLES\SERVICES\SV CSTART - it could be a little fiddly to get this built/added to your o/s image if you are just getting started with CE 6.0 development.
4. Project Socrates - AutoLaunch
To assist students taking part in the ImagineCup 2007 competition (and also to make it easier for any developer to launch applications on their device with delay, command line options, and also waiting until the device has a valid IP address) Jim Wilson and I have developed a simple application called AutoLaunch - the AutoLaunch application comes in a handy Sub-Project form so can easily be added to an existing CE 6.0 workspace. The functionality is similar to the SvcStart sample written by John Spaith but does have a couple of minor differences - the first is that the AutoLaunch program is launched through the HKLM\Init registry keys (much like any typical startup process) - the registry keys for adding AutoLaunch to the startup sequence are included in the sub-project .reg file, so you don't need to worry about this.
The second difference is that the AutoLaunch process waits until the device has a valid IP address before launching any processes - the reason why this is useful is that we wanted students to use their reference boards without needing a second monitor, keyboard or mouse (in effect the device is booting headless even though the CE desktop or launch application is being displayed) - in this case we want to launch the CE Remote Display application (CERdisp.exe) on the device with the command line "-c" (connect) which then broadcasts the device IP address/name to a listening desktop CE Remote Display application.
The CE Remote Display application can be found in the CE 6.0 catalog by searching for "cerdisp", the SYSGEN for the component is (strangely enough) SYSGEN_CERDISP. The desktop CE Remote Display application can be found here - C:\WINCE600\PUBLIC\COMMON\OAK\BIN\I386\cerhost.exe [NOTE: The CE Remote Display application is not the same as RDP/Remote Desktop, although RDP is supported as a client side application on CE 6.0 (SYSGEN_RDP)].
In the sample below we're launching the CE device side Remote Display application (cerdisp) with the command line "-c" to start connected, with a timeout of 0x1388 (5000ms, 5 seconds), and also starting the CE command prompt (cmd.exe) with a delay of 0x1f40 (8000ms, 8 seconds) - it would of course be trivial to also add ConmanClient2 and CmAccept to the launch process list.
[HKEY_LOCAL_MACHINE\Startup]
"Process1"="cerdisp -c"
"Process1Delay"=dword:00001388
"Process2"="cmd"
"Process2Delay"=dword:00001f40
Here's how the desktop CERHost.exe application looks when the device boots and runs the "cerdisp -c" command - notice the name of the device and the device IP address are both displayed in the Remote Host application (the IP address being displayed here is very useful for plugging into the VS 2005 Device Properties dialog!).
And to round off the blog post here's the Remote Display application running on my Vista desktop showing the CE 6.0 desktop - note that I can now use my desktop mouse and keyboard to remotely control the CE 6.0 device!
Using AutoLaunch and the CE Remote Display for hands on labs/training that use reference boards instead of the Device Emulator may be quite useful!
antdavison said:
works flawlessly, you are a genius ... thank you
Click to expand...
Click to collapse
Glad to hear this. Thank you.

Categories

Resources