Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VS2005 WM5 C++ gets "not a valid Pocket CP application"

3 views
Skip to first unread message

Tim Johnson

unread,
Nov 12, 2005, 7:51:03 PM11/12/05
to
I've been unable to get some unmanaged C++ code to work on WM5 with the
evc4.0 compiler, so I bit the bullet and tried doing it with VS2005. I've
been informed when you build C++ code for a Smart Device in VS2005 you get
unmanaged code by definition, since you can't build managed C++ code for a
Smart Device.

After a bit of labor everything now compiles without warning and deploys ok,
a dll and a test harness exe that uses the dll. But when I run the test.exe
program built in VS2005 I get "test.exe is not a valid Pocket PC
application". Which is exactly what I got using evc4.0 on a WM5 PDA device.
So I'm no better off.

I also used VS2005 to rebuilt a .Net C# test app which does a P/Invoke into
some standard "flat" (non-class) functions in my C++ dll. It now gets
"Can't find P/Invoke DLL", even though it's right there in the same
directory.

Note that all these mechanism work fine with PocketPC 2003, evc4.0, and
VS2003.

Anybody know what I might be doing wrong in trying to get unmanaged C++ code
to work on a WM5 device? It's getting fairly ridiculous how much time I've
spent on a simple porting task.

--

Tim Johnson
High Point Software, Inc.
www.high-point.com
(503) 312-8625

cla...@gmail.com

unread,
Nov 15, 2005, 8:58:19 AM11/15/05
to
Tim,

Did you find a solution to this, all my existing applications C# and
VB.Net that worked on VS2003 calling DLL functions now no longer work
on VS2005.
I get Can't find PInvoke DLL "-----"

John

Matt

unread,
Nov 15, 2005, 10:59:28 AM11/15/05
to
Tim or John,

The same thing is happening to me. I am compiling an unmanaged C++
application and initially I would get not a Pocket PC application
error, or I would get an error that said it could not run the
application because it either cannot find all of the components or it
is not signed with a trusted certificate.

Basically when I would compile it using evc 3.0 it would run, but
because so much has changed I needed to use some of the new APIs. I am
getting really frusterated with this whole WM 5.0 port too.

Matt

Matt

unread,
Nov 16, 2005, 4:23:50 PM11/16/05
to
I am not really sure if either of you are still checking this thread
but I have some suggestions for you. What I did that got this to work
was a two step process. First try signing your dll with the developer
certificate. To do this to in to Project->Properties->Authenticode
Signing. There make sure that authenticode signing is set to yes and
use the developer certificate.

If that doesn't fix your issue try creating a new dll project. Then
put in all of the classes for the DLL and compile it. This is what I
needed to do to get this to work. One suggestion for this is to create
a simple application that calls something from the DLL. Then create a
simple DLL that just contains the object being called. When you get
this to work, then start bringing over the DLL classes.

This is what I did and my application runs(soft of). If you have any
questions, let me know and I will try to help out.

Matt

Tim Johnson

unread,
Nov 17, 2005, 12:13:54 AM11/17/05
to
No, I have no solution for this yet.

As for the thread this relates to (where I get the "trusted
cert...or...component not found"), I finally tracked that down to a stupid
error on my part. I had a .lib file like "x.lib", but due to some naming
shortcuts I took in creating it manually, internally it referenced "y.dll".
So it really was component-not-found after all. Once I built the .lib file
correctly I no longer go that error. Now I get the "Can't find error". I
can't make this go away in VS2005, and no one has said how to keep using
evc4.0 SP4 to build for WM5. So I'm still stuck.

--

Tim Johnson
High Point Software, Inc.
www.high-point.com
(503) 312-8625


<cla...@gmail.com> wrote in message
news:1132063099.8...@o13g2000cwo.googlegroups.com...

Matt

unread,
Nov 17, 2005, 9:18:31 AM11/17/05
to
When you say that you are getting a Can't find error. What exactly
does the error say?

Also, I am not really sure how you could build something with the wrong
lib. Typically when I would do that I would get an error saying it was
unable to open the x.lib or whatever the lib was named.

Matt

Tim Johnson

unread,
Nov 17, 2005, 10:09:31 AM11/17/05
to
The error message (stated earlier in the thread) is "Can't find P/Invoke
DLL". It's a legacy unmanaged C++ dll which I'm calling from .Net via
P/Invoke. All works great in PPC2003 with VS2003. Just not in WM5 with
VS2005.

The lib situation was that I linked with x.lib, which existed but internally
had references to y.dll. So at load time the system looked for y.dll which
didn't exist. The reason for the discrepancy was that I had created the
.lib manually from a "y.def" file using the LIB utility, creating a y.lib
file. But then I just renamed it to x.lib thinking that was ok, but it's
not - it still contains references to y.dll inside it from the original use
of lib.exe.

--

Tim Johnson
High Point Software, Inc.
www.high-point.com
(503) 312-8625


"Matt" <zimme...@hotmail.com> wrote in message
news:1132237111.8...@o13g2000cwo.googlegroups.com...

Matt

unread,
Nov 17, 2005, 10:26:50 AM11/17/05
to
oh, I get it. I am not too familiar with .Net, but can't you just
include the lib files in project->Properties->Linker->Input->Additional
Dependencies? That is what I did and it worked.

Matt

Matt

unread,
Nov 29, 2005, 2:27:11 PM11/29/05
to
Tim,

I am not really sure if you moved past this yet, but I may be able to
help. I think there was something wrong in the upgrade utility. If
you just create a new project and add all of your files to it and make
is similar to the old one, it should work. That is what I did and now
things are finally starting to work.

Matt

r_z_...@pen_fact.com

unread,
Nov 30, 2005, 3:10:42 PM11/30/05
to
On Sat, 12 Nov 2005 16:51:03 -0800, "Tim Johnson"
<tjoh...@high-point.com> wrote:

>I've been unable to get some unmanaged C++ code to work on WM5 with the
>evc4.0 compiler, so I bit the bullet and tried doing it with VS2005. I've
>been informed when you build C++ code for a Smart Device in VS2005 you get
>unmanaged code by definition, since you can't build managed C++ code for a
>Smart Device.

Are you targeting a Pocket PC or a Smartphone? Are you using MFC?

I'm just porting my programs to WM 5 for Pocket PC. I started with
apps built using eVC 3 and the Pocket PC SDK. Those executables
actually installed and ran. But I needed a few tweaks to get all the
controls placed properly in landscape mode and to eliminate the
extraneous vertical scrollbar. I now have executables that should run
on any Pocket PC from the original to WM 5. I'm using straight Win32.


>
>After a bit of labor everything now compiles without warning and deploys ok,
>a dll and a test harness exe that uses the dll. But when I run the test.exe
>program built in VS2005 I get "test.exe is not a valid Pocket PC
>application". Which is exactly what I got using evc4.0 on a WM5 PDA device.
>So I'm no better off.

Are you using the _proper_ Pocket PC menu functions (SHCreatemenu) or
the old Windows CE menu functions (CommandBar_Create)? And have you
included the extra menu structure (SHMENUBAR) in your resource script?


>I also used VS2005 to rebuilt a .Net C# test app which does a P/Invoke into
>some standard "flat" (non-class) functions in my C++ dll. It now gets
>"Can't find P/Invoke DLL", even though it's right there in the same
>directory.

I don't use any or these, so I can't help.


>
>Note that all these mechanism work fine with PocketPC 2003, evc4.0, and
>VS2003.
>
>Anybody know what I might be doing wrong in trying to get unmanaged C++ code
>to work on a WM5 device? It's getting fairly ridiculous how much time I've
>spent on a simple porting task.

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com

0 new messages