473,665 Members | 2,827 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unsupported function problem - WinCE

Hello all,

I'm trying to run a small program on both PPC and CE devices.
I am calling SHGetAutoRunPat h only when running on a PPC platform.
However, since this function depends on aygshell.dl, which doesn't
exist on the CE platform, the program does not run at all on the CE
platform.
if(lstrcmpi(lpC mdLine, _T("install")) == 0)
{
// Card has been inserted. We NEVER get here on a CE platform!

TCHAR szSDAutorunFull Path[MAX_PATH+1]; // Compact Flash path
SHGetAutoRunPat h(szSDAutorunFu llPath);
......
}

Is there a way to make the program run on both platforms without
recompiling it?

Thanks a lot,

Yoav.
Oct 2 '08 #1
5 2304
yoavrofe wrote:
I'm trying to run a small program on both PPC and CE devices.
I am calling SHGetAutoRunPat h only when running on a PPC platform.
However, since this function depends on aygshell.dl, which doesn't
exist on the CE platform, the program does not run at all on the CE
platform.
if(lstrcmpi(lpC mdLine, _T("install")) == 0)
{
// Card has been inserted. We NEVER get here on a CE platform!

TCHAR szSDAutorunFull Path[MAX_PATH+1]; // Compact Flash path
SHGetAutoRunPat h(szSDAutorunFu llPath);
.....
}

Is there a way to make the program run on both platforms without
recompiling it?
C++ language Standard defines the language so that the portability
requirement is satisfied on the *source code* level, not on the binary
level. No other guarantees exist from the platform point of view WRT
the executables you can produce from that code. Now, if your platform
chooses to give you some additional guarantees, e.g. that the executable
can run on two platforms if built with certain settings, then it's the
choice of the *platform*, not the language. IOW, you need to ask about
those things in the *platform* newsgroup, not the language newsgroup.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 2 '08 #2
Thanks, Victor.

What I wanted to ask is if it's possible to declare the function only
when I intend to use it.
Oct 2 '08 #3
yoavrofe wrote:
What I wanted to ask is if it's possible to declare the function only
when I intend to use it.
What's "intend to use it" mean. What would be the point of declaring it
if you don't intend to use it?

I am reaching here, but have you heard of "conditiona l compilation"? I
mean the #ifdef or #if blocks... It's not going to solve your "no
recompilation to run on the other OS" problem, though.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 2 '08 #4
yoavrofe wrote:
Hello all,

I'm trying to run a small program on both PPC and CE devices.
I am calling SHGetAutoRunPat h only when running on a PPC platform.
However, since this function depends on aygshell.dl, which doesn't
exist on the CE platform, the program does not run at all on the CE
platform.
if(lstrcmpi(lpC mdLine, _T("install")) == 0)
{
// Card has been inserted. We NEVER get here on a CE platform!

TCHAR szSDAutorunFull Path[MAX_PATH+1]; // Compact Flash path
SHGetAutoRunPat h(szSDAutorunFu llPath);
.....
}

Is there a way to make the program run on both platforms without
recompiling it?
Define a semantically abstract interface to represent the underlying
platform. Implement this interface separately for each platform you
support, defining each such implementation in a separate source code module.

Your main routine, the client of the platform access modules, should
access the platform only through the abstract interface. Your build
system can then select the correct, platform-specific implementation to
link into your application for each build target. If you find there is
a lot of common code among the platform-specific modules, factor it into
a separate "platform support" module.

IOW, your driver routine probably shouldn't be calling something like
SHSomeHorridLoo kingFunctionNam e directly, anyway. Instead, it should be
calling platform.cardIn serted, where "platform" is of a type defined by
the build system. If you want to stick with the C-like coding style
above, you might just declare:

void platformCardIns erted();

Multiple compiled object modules can define platformCardIns erted, as
long as the build system links exactly one into your application for any
given build target.

Victor suggested #ifdef'ing out the platform-specific line. If it
really is just a very small amount of platform-specific code, that may
be the best thing to do; however: (1) it still requires target-specific
behavior in the build system, to pass -DPLATFORM=WHATE VER, and (2) as
Victor pointed out, it requires a separate compilation, rather than a
separate link, for each platform.
Oct 2 '08 #5
First, this belongs more in comp.os.ms-windows.program mer.win32

Next, the function is declared:

BOOL WINAPI SHGetAutoRunPat h(LPTSTR pAutoRunPath);

Which is a normal C declration. So, to make life easy, first we make a function pointer typedef. How to do that is more c/c++ than win32. And we declare an instance of that new type and initialize it.

typedef BOOL(WINAPI* PFNSHGETAUTORUN PATH)(LPTSTR);
PFNSHGETAUTORUN PATH pSHGetAutoRunPa th = NULL;

Now, the win32 part. We load the function pointer from the relevent platform dll.

HMODULE hAygShell = LoadLibrary(TEX T("aygshell.dll "));
pSHGetAutoRunPa th = (PFNSHGETAUTORU NPATH) GetProcAddress( hAygShell,"SHGe tAutoRunPathW") ;

Now, you can test pSHGetAutoRunPa th to see if it was loaded or not before calling it with code similar to this:-

TCHAR szBuf[MAX_PATH]={0};
if(pSHGetAutoRu nPath) {
pSHGetAutoRunPa th(szBuf);
} else {
// fake it on platforms that dont have it.
}

One last note: "SHGetAutoRunPa thW" has the W on the end because most win32 functions exist in W or A suffix versions which are used when you build for Unicode or Ansi support. Because the platform in question might be unicode only, the W might not be necessary. If the GetProcAddress call fails on the platform it should succeed on, try the other variations.
Oct 3 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
34661
by: DJ Craig | last post by:
I keep getting this error: Fatal error: Unsupported operand types in /usr/local/etc/httpd/htdocs/djtricities/kat/bpmchart/chart.php on line 58 I've looked for hours for some type of error, and tried lots of different things, but I can't get it to work. I did a google search for "unsupported operand types" and for most of the people getting this error, it was something to do with the version of PHP that they were running, but I can't...
0
1930
by: //\\//\\RLe | last post by:
We are testing one of the CASIO hand device on WinCE and wireless module... while trying to run any Oracle Forms in web browser found that we need JavaInitiator for WinCE and... can't find any on web... !?! If someone use forms on wireless device probably stuck with same problem.... If there is any Java product on market please provide me some more info, also all experience would be appreciated... //\//\.
10
3230
by: Vavel | last post by:
Hi all! I want to insert the record into the table by using an application program that includes the following statements: EXEC SQL BEGIN DECLARE SECTION; long hvInt_Stor; long hvExt_Stor; EXEC SQL END DECLARE SECTION; hvInt_Stor = MMDB_STORAGE_TYPE_INTERNAL; hvExt_Stor = MMDB_STORAGE_TYPE_EXTERNAL;
1
2285
by: Beyers | last post by:
Hi We are using active sync to connect VS.NET to a WinCE hardware platform for debuggging the application we are writing for this platform. It worked well for a month, and now all of a sudden we cannot connect to debug anymore! We have tried re-installation of our whole platform, from operating system (XP Prof) to VS.NET, but we still cannot connect to the WinCE platform via activesync.
2
1369
by: parth_mca | last post by:
i want to start WinCE programming in vb.net... which version of visual studio.net supports winCE programming for PocketPC ? and where should i start from...?
2
1615
by: bokiteam | last post by:
Hi All, I am developing a WinCE project, when I include datagrid, it says no define.. could you please advice? it works on Win32 project by the same code... Thank you very much for you help!
3
2731
by: pcm | last post by:
Hi, Has anyone ever worked on a Python-WinCE-based program that involved serial port management ? Regards, Philippe
1
2473
by: TheSebaster | last post by:
I wrote the following lines of code under Microsoft Visual Studio 2005: I compile my WinCE c++ application importing MyInterop.tlb generated file. The MyInterop.tlh generated file do not contain my interface definition. Does anyone could help me?? (Aditional info) -When I open tlb file with visual studio and I expand MyInterop Library, I don't see any interface - I generate Interop.tlb with REGASM.EXE myinterop.dll /tlb:MyInterop.tlb...
2
1848
by: clintonG | last post by:
Okay I'm lazy (today) and asking without doing a lot of searching for the moment but does the framework run on a device using WinCE and can IIS run on that same device perchance? Finally will WPF applications run on WinCE devices?
0
8438
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.