Archive: CreateShortCut on Pocket PC


CreateShortCut on Pocket PC
Hi, I have been using NSIS for quite a while now to package my Pocket PC application. For some reason I cannot get the CreateShortCut to work for me.

This is the code I have been tring to use:

SetOutPath "$INSTDIR"
CreateShortCut "$INSTDIR\sync.lnk" "$INSTDIR\sm_server.exe"

I really want my short cut to be in the following directory:
My Device\Windows\Star Menu\Programs

But I can't even get it to create a shortcut in the Install direcory.

Does anyone ahve any experience with this or have a solution for me?

Thanks


If you want to create shortcuts on the device itself, you'd probably want to call CeSHCreateShortcut instead of using the normal method. If you create a shortcut using the normal method, it'd probably result with a target that tells your PC how to find that executable instead of a target that tells the device how to find it.

!include LogicLib.nsh

System::Call "rapi::CeRapiInit() i .r0"

${If} $0 == 0 # S_OK

System::Call "rapi::CeSHCreateShortcut(t'shortcut', t'target')"

System::Call "rapi::CeRapiUninit()"

${Else}

DetailPrint "error initializing rapi interface"
DetailPrint "make sure the device is connected"

${EndIf}

Hi, I added the following code in my .nsi project:

!include LogicLib.nsh

System::Call "rapi::CeRapiInit() i .r0"

${If} $0 == 0 # S_OK

System::Call "rapi::CeSHCreateShortcut(t'Sm Server', t'sm_server.exe')"

System::Call "rapi::CeRapiUninit()"

${Else}

DetailPrint "error initializing rapi interface"
DetailPrint "make sure the device is connected"

${EndIf}

And still nothing. I did a search in the NSIS help and it did not list anything about the CeSHCreateShortcut.

I'm using version 2.0.

Thanks


Try specifying full paths for CeSHCreateShortcut. I don't think it automatically creates shortcuts on the start menu. MSDN doesn't mention that.


I put in the following path:
My Device\Windows\Star Menu\Programs\

Still no luck. I did notice thought, the the root directory, My Device that there are news files being added.
They are named as so:
??????????????????


Are you sure \My Device is the correct path? Sounds to me like the path is for your PC as it refers to the device and not to itself. Using CeGetSpecialFolderPath to get the path would probably be a better idea. That'd also make sure it works, even if it the user changes the start menu paths.


I will try that. I did a search on CeGetSpecialFolderPath and CeSHCreateShortcut and came up empty. Do you know where I can find documentation on these?


I found some documentation, sorry, I thought these were NSIS commands.


Hey, do you have an example on how to use and display the results of CeGetSpecialFolderPath?

thanks


System::Call "rapi::CeGetSpecialFolderPath(i2,i${NSIS_MAX_STRLEN},t.r0)"
DetailPrint $0

hey, thanks for the example, it was pretty close to what I was tring. I still must be doing something wrong. the DetailPrint does nothing. Have you ever tried this using NSIS?

Thanks


Haven't tried it. I don't have a Pocket PC and I never installed the emulator.

According to MSDN, the line I gave you above should work. There's not much to get wrong there. You can add i.r1 at the end and get the return value to $1. The only possible problem I could think of is that RAPI is not initialized. That could happen if it's called before CeRapiInit.


Hi,
I tried the following and it returns 0


System::Call "rapi::CeGetSpecialFolderPath(CSIDL_PROGRAMS,i${NSIS_MAX_STRLEN},i .r4)"

Any ideas?


As far as creating the shortcut on the device, i'm pretty sure, when you are compiling your CAB file you can specify the shortcuts in there along with any Reg values etc.

Not sure if it is new in the CAB wizard that comes with Visual Studio 2005, I haven't tested it myself yet.


Hi, originaly, I thought the same. I looked at all of the properties in the cabwiz and cannot find anything about a shortcut. I will keep hunting.

Thanks


Got it! Finally! In case anyone reads with a simialr problem here is the solution.
In .NET 2005, after you created your cab project and added the project output, double click on the primary output. In the left pane (File System) right cvlcik and add a special folder. In the right pane add project output. Re build and install your cab and you will have a shortcut.
Thanks to all that have helped.


i.r4 should be outside of the parenthesis. It's the return value, not another function parameter.