[Q] Open a Programm twice parallel? - General Questions and Answers

Hi everybody,
is it possible to open a programm twice parallel? I want to open the coreplayer twice, one time for music and another time for audiobook. Is that possible?
thx, mic

It's probably not too hard to write a script for it.
trying talking to either vijay or oldsap.

Depends on the code in the program itself. In the shell code created by Embedded C++ in the InitInstance function there is the following code:
Code:
hWnd = FindWindow(szWindowClass, NULL);
if (hWnd)
{
// set focus to foremost child window
// The "| 0x01" is used to bring any owned windows to the foreground and
// activate them.
SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));
return 0;
}
In other words when the application starts, it looks for another active process with the same name as itself. If it finds one, it activates it, then kills itself.

thx for try to help me - that means it is not possible?

The original PPC programming guidelines by Microsoft stipulated that only one copy of a program should be running at any one time. In later versions of Windows CE/PPC a lot more processes are allowed to run simultaneously. They may have changed their tune over this since. Try and launch it twice, then go to Settings->System->Memory and see if there is more than one copy in Running Programs. If there is only one, then I'm afraid the answer is no.
P.S. If you create a Windows Mobile Win32 program in C++ under Visual Studio 2008, it still has the process checking code in it by default.

Related

Programming/Development question

I hope this doesn't get lost in the sea of other questions.
Im working on a little program for my Visual Basic 08 class. Im going a bit further with it and making a windows mobile version of it. (currently using the WinMo 5 SDK) The program works fine in the windows platform, however when i copied the code over to the WinMo version, there was a few issues with the code. Most of it i manage to find the new syntax for and get it working on the WinMo emulator, however there is one problem that persists. TabControl.focus. This function does not seem to work in the WinMo development. Any Code i input that looks for what tab has focus, is ignored, like it doesn't know to look for the focus. Here is what im trying to do.
I have a program, with 2 tabs, and one button. I need that one button to execute two separate code blocks, depending on which tab is active. However i cannot get it to recognize, or do not know the proper function to get it to see which tab has focus, and execute the proper code accordingly.
Now, the simple fix for this would to just make another button, and place one each inside the tab, but i wanted to avoid that for as much as possible, and since it workers fine on the windows end, i know there has to be a way to get it working on the winmo end. By the way, im doing this in VB because im learning VB for a class, and the more coding practice i get the better ill do in class. Im sure there is a better way to do this in C# or whatever else.
Anyone know the workaround for this?
Im currently using Visual Studio 2008 Pro with the WinMo 5.0 SDK.
Your two tab pages are already part of a tabcontrol object. Use that to find the active tab with its property tabControl1.SelectedIndex This will return a zero based index integer for each tab paged attached to it. The object names used here are the default ones created by the IDE
Sorry, I only code in c#, but the VB code will be almost identical.
In the code for the button click event -
if(tabControl1.SelectedIndex == 0)
{
// tabPage1 active
}
else
{
// tabpage2 active
}
c sharp's double equals is the same as VB's single equals, in the sense that it means 'is equal to'.
There is not "active" property in vb (atleast not in vb mobile code) so that doesnt work
Im somewhat fimiular with c++, so i can atleaast understand the code when you put it in C format, but i have a bit of trouble converting C code to vb format. In this case, in normal (non-mobile) the .focus would be enough to make it work...
Here is what i tryed to make work..
Code:
'Changes what the "Roll" button does depending on which program tab is selected.
Select Case True
Case xTabPageCombatRoll.Focus
Call RollCombat()
Case xTabPageRandomRoll.Focus
Call RollRandom()
Case Else
MessageBox.Show("The Tab Control code didnt work")
End Select
both tab pages are part of xTabPageCombatRoll object
I'd suggest asking Development questions in the Dev&Hack section.
(yes, new rules)
Here's the screen shot and the c# application to go with it. Its in VS2005 but VS2008 will open it and convert the solution and project files to 2008 format. Once that happens VS2005 will not be able to open it.
The lines starting // in the code in the previous post above are comments. Same as VB's ;
thanks steph, i have 2005 installed along with 2008 so i just ran 05 . That code does work. But i still cant find anyway to translate that into VB (as .SelectedIndex is not valid in VB code)
ugh.. the more i work with VB the more i like C based code. But im in a VB class so im trying to keep doing stuff in VB so i can pass the class.
SelectedIndex is a property of the TabControl, a .NET framework object It does not matter which language you use to access it. VB, C#, C++, take your pick .
To prove the point here is the same project in VB. I had had to do this on another machine, as I only have C++ and C# installed on this one.
It only had the WM 2003 SDK on it. If your machine has the .NET CF 2.0 the .EXE should work, if you drop it on your device.
Another trick is to use Red Gate's .NET Reflector. If you point it at the original exe generated by the C# project in the previous post above, it decompiles it in C# as
Code:
private void button1_Click(object sender, EventArgs e)
{
switch (this.tabControl1.SelectedIndex)
{
case 0:
this.label1.Text = "Page1 is active";
break;
case 1:
this.label1.Text = "Page2 is active";
break;
}
}
If you decompile it as VB instead you get :
Code:
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Select Case Me.tabControl1.SelectedIndex
Case 0
Me.label1.Text = "Page1 is active"
Exit Select
Case 1
Me.label1.Text = "Page2 is active"
Exit Select
End Select
End Sub
Ahh..
I got it to work now.. My problem was i wasnt specificly using Case 0 and Case 1, but instead using Case Tabpage1, and Case Tabpage2, which wasn't working.
Thank you VERRRY much.. The program is working like it should now and it makes me verry happy

Combobox with Smartphones vs. WinMo

With the help of the peeps here, i got my little program working on the WinMo (touch screen) platform. Now im working on converting it into the Smartphone (non-touchscreen) platform. Seems with each medium im go, its more and more restrictive :|
anyway. I have a combobox on the screen. I has a few numbered values used to generate a random number. On the windows and winmo verson, i can just select the number from the drop down combobox, and it will generate a random number based on the selected item..
However in the Smartphone version, despite having the combobox and dispite selecting a number from it, when i hit the generate button (ie the enter button) it brings up a window with all the values in the combo box, asking me to select one from it. One when i pick one and hit "Done" does it process.
How can i get it to pull from the combobox list and Not bring up the extra screen?
Also, When the program first starts, despite me defining a default index, there is no number displayed in the combobox when it first starts up. And ideas on how to fix this?
Thanks in advance.
Good fun isn't it?
When you move from PPC to Smartphone some of the .NET objects dissappear and others behave completely differently.
OK lets do these one at a time. The Enter/Action key causes the ComboBox to display its list of contents, as a new window. It is coded into the object itself. To bypass it, you have to trick it into thinking it has already been dealt with. On the KeyDown event of the ComboBox add
Code:
private void comboBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == System.Windows.Forms.Keys.Enter)
{
e.Handled = true;
}
}
Voila!
The enter key is ignored and nothing happens. Add any processing code here to deal with the selected item if required, as the control itself will never see that the 'Enter' key has been pressed.
To get the box to display its value when your application starts, use :
Code:
private void Form1_Load(object sender, EventArgs e)
{
comboBox1.SelectedIndex = 0;
}
It doesn't actually change anything as it zero to start with, but it will trigger the ComboBox to redraw itself as it thinks it has changed.
Good luck.
The "comboBox1.SelectedIndex = 0;" ive tried already, didn't seem to help. Ill try the other when i get a moment..
I should also mention ( thought i did before, sorry) that im working with VB (for school) tho converting that code to vb shouldn't be too hard
OK I'll code it up in VB and post it. But it will have to wait until I can get to a suitable machine on which to do it. Monday onwards....... Watch this space.
Here it is. VS 2005. (2008 will update it). Both problems mentioned in the original post are corrected. All the extra lines of code added by VS for the KeyDown event have been removed.

running multiple instances of a software

Hello all.
I use Windows mobile 6.1.
I would really like to be able to run mobipocket reader (and some other software) concurrently. Running multiple instances of a program at once is really useful as we dont have to close something just to open another document.
Can anybody tell me if there is a way to do this?
It depends on the software itself. The original Pocket PC methodology as published by MS was that only one copy of a program should be in memory at one time, and that it should only open one document at a time. If you create a shell C++ application in VS Studio, it contains the following code in the InitInstance function.
Code:
//If it is already running, then focus on the window
hWnd = FindWindow(szWindowClass, NULL);
if (hWnd)
{
// set focus to foremost child window
// The "| 0x01" is used to bring any owned windows to the foreground and
// activate them.
SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));
return 0;
}
The comments are inserted by the VS code wizard.
Basically the application looks for another instance of itself in memory. If it finds one, it activates that copy before terminating itself.
By starting a second copy of the program, you merely reactivate the first one.
WinCE has a 32 process limit but this is set to change with WinCE 6.0. we will probably have to wait until at least WinMo 7 for this to filter through.
thanx stephj
do you know if anyone has created such a shell already?
I have heard of js hexmaster but couldn't find it anywhere, besides it's for application developers
TIA
Haali Reader is an ebook reader I use (and prefer over mobipocket) that supports multiple instances.
thanks noidtluom, I knew that, but i'm in too deep with mobipocket.
Do you know any other good ebook readers that can open prc format created by mobipocket?
Would really be great if there were...
cheerz
any updates on hacks to run multiple instances of the same program at the same time?
you seem to be able to do this on PC:
http://www.makeuseof.com/tag/how-to-run-multiple-versions-of-the-same-program-on-your-pc/
and here:
http://filesharefreak.com/2008/08/08/how-to-run-multiple-instances-of-utorrent-v177-v18/

[Q] How to retrieve image from sql server into window phone?

I had error ArgumentNullException was unhandled when run my coding.
Code:
public class ImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
byte[] buffer = value as byte[];
[B]Stream memStream = new MemoryStream(buffer);[/B]
WriteableBitmap wbimg = PictureDecoder.DecodeJpeg(memStream);
return wbimg;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
The bold line is where the error occur..
Any solution to this error or any other suggestion for me to retrieve image into window phone? Thank you.
Well...
Well, I guess you enter your method with value as null. Your code snippet does of course not show just why value might be null.
Pardon me this innocent question: Why don't you just take the whole thing into the debugger and watch what happens?
Either value is null, or value is not a byte[].
It would be better to just cast it to byte[] instead. That way you would get a different error if it's not a byte[], than if it's null. This would be of some diagnostic value but as another poster mentioned your best bet is to run this in a debugger to see what's going on.
save the image name in database,
Sorry, may i know how to test it in debugger mode?Thank you.
Too early?
hueikar said:
Sorry, may i know how to test it in debugger mode?Thank you.
Click to expand...
Click to collapse
I don't want to offend you, and of course you are free to do whatever you like, but I think it's too early for you to build a full and maybe complicated WP7 app. Do you know the saying "First you have to learn to crawl before you can try to walk"? I think you should learn the fundamentals of using Visual Studio and programming for WP7 from some nice book or online tutorial first.
Even working with complete code samples, as you seem to try, does not help, if you ask me. At least it always was like that when I tried it myself: If in the past I tried to get some code samples to work that I did not understand myself, the first trivial problem already stopped me dead in my tracks. I only had success after my knowledge had progressed to a point where I could read and understand the samples.
Sorry. Yes. I admit that i am too rush to do a win7 app. This is my first time doing window phone app and so with the language c#. But i kinda run out of time to do learning..My first mistake is choose wrong title to do window phone app as my final year project..Luckily so far i manage to do the CRUD for the app.but this is the most difficult problem i am facing now..
Well, in answer to your question, Visual Studio has a Debug button. Select whether you want to debug on the emulator or on your phone (the latter requires that the phone be connected to the PC and Zune be running) and give it a try. If you want to use the media library while debugging, you'll need to use the WPConnect program (it's part of the dev tools, I believe) which allows you to close Zune after you establish the connection, thus unlocking the media library on the phone.

Link contact adress to Nokia Drive

I use my7rom on my Omnia 7.
Is there anyway to link a contacts adress to Nokia Drive instead of Maps (stock wp7 app). It would be much more practical if Nokia Drive opened a navigation session instead.
Anyone up for the challenge? A reg-tweak perhaps?
// Manneman
Skickat från Windows Phone 7.8
There's two parts here. The first is identifying the correct "filetype" or URI scheme that is used for navigation. That shouldn't be too hard; a little digging in HKCU should reveal it. We already know about ones like callto: and http: and I'm actually (slowly) working on an app to allow people to easily change them. The second part is finding the correct command to load that address or route in the Nokia Maps app. If the app supports pinning routes or destinations to Start, this is probably possible. If not, it may not be possible in the app. Most apps aren't designed to accept command-line parameters, so even if you make them the default handler for a given filetype or URI scheme, they ignore the value you send them and just start as though launched from Start.
GoodDayToDie said:
If the app supports pinning routes or destinations to Start, this is probably possible.
Click to expand...
Click to collapse
Nokia Drive supports pinning to start so it should be possible. Unfortunately I can't tell you exact command line parameters 'cause my Lumia 900 still "in jail"
Let me see if I have a copy of the Nokia Drive XAP handy. I'll need to decompile it to figure out the correct parameters for launching it with the intent of navigating to a specific location. Note also that this might not be possible directly - for example, the app might store a list of locations internally, and the tiles only provide an index into that list rather than providing the location directly - but that just requires another layer of indirection.
In that case, you create an app that gets registered as the navigation handler, and in response to a navigation request, it writes the requested location into the Nokia Drive app and then chain-launches Nokia Drive with the index of the newly written location. That's just an example of one way that this might go wrong, but overall, the odds are actually pretty good. Obviously, all of this will require, at a minimum, write access to the HKCR hive in the registry.
Ah, guys! You are so kind helping me out. I´m really certain alot of members in the WP7 section would love for this to work!
// Manneman
GoodDayToDie said:
I'll need to decompile it to figure out the correct parameters for launching it with the intent of navigating to a specific location
Click to expand...
Click to collapse
GoodDayToDie, you may try much simpler solution. Just create assembly (dll) to show startup parameters in message box, and replace main Nokia Drive dll (but pin some location first).
That's actually harder than it sounds; even if the app is sideloaded (which would mean I already have the DLL) my fake would have to mimic the internal structure of the real app to a degree (namespaces, class names, default actions, etc.). That's not hard, but decompiling .NET is pretty trivial too.
AFAIR, Nokia Drive is obfuscated (but I'm not 100% sure). Also, you don't need to duplicate all names and structures; just a stuff mentioned in WMAppManifest (I hope so). BTW, I forgot: I still have unlocked handset; if I'll found time, will try today later.
Update: tried but without of luck What I did:
- installed Nokia Drive first;
- downloaded map and pinned current location;
- created fake app with same app guid and namespace name ("Drive"), and performed app update (that operation completely override whole solution but NokiaDrive tile still pinned to the start screen);
- tried a few different page names (_default.xaml, QuickStartPage.xaml, DestinationPickerPage.xaml, FavoritesPage.xaml) with code
Code:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
MessageBox.Show("Hello from fake dll");
if (e.NavigationMode == System.Windows.Navigation.NavigationMode.New)
{
string[] keys = NavigationContext.QueryString.Keys.ToArray();
string[] values = NavigationContext.QueryString.Values.ToArray();
string param = "";
for (int i = 0; i < keys.Length; i++)
{
param += keys[i] + " -> " + values[i] + "\n";
}
MessageBox.Show("parameters: " + param);
}
}
But result always the same: app doesn't start from the pinned tile
Update 2: Finally, I did it
The trick is:
- do the same as I've described above (you should have pinned tile from ND);
- add following code to the start page:
Code:
public MainPage()
{
InitializeComponent();
var appTile = ShellTile.ActiveTiles.Last();
if (appTile != null)
{
//MessageBox.Show(appTile.NavigationUri.OriginalString);
EmailComposeTask emailTask = new EmailComposeTask();
emailTask.Subject = "NokiaDrive pinned parameters";
emailTask.Body = appTile.NavigationUri.OriginalString;
try
{
emailTask.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK);
}
}
}
- run app as usual (not from tile);
We allset - all params are sent to our email (I'm too lazy to manually copy all stuff )
Here we are (start parameters; bold values are changed for privacy reason ):
/_default?destination.name=200 SomeName Street&destination.latitude=49.5255378801376&destination.longitude=-72.4296837244183&destination.address.street=SomeName Street&destination.address.houseno=200&destination.address.district=&destination.address.county=&destination.address.city=SomeCity&destination.address.state=&destination.address.country=USA&destination.address.postcode=05720&destination.hashCode=371767793destination.address.statecode=MA&pinnedFrom=Favorites
P.S. Just found: Navigon also has ability to pin address to the start tile So, if you find the way to modify map protocol (or how it calls), it will be a really nice hack! BTW, could you remind me: do we have ability to launch assembly by GUID (on the full-/policy-unlocked phones)? If "yes", it's possible to write a real nice "proxy" app to handle map requests
I don't know about launching assemblies directly, but it's certainly possible to launch apps by GUID. It doesn't even require anything more than dev-unlock in fact (although of course you can only launch apps that you could launch anyhow). So yes, a proxy app is totally possible. That's actually what I'm working on (started as a project to make a Kindle ebook file loader, that would pur .mobi/.prc file in the Kindle app's folder and then launch the app).
GoodDayToDie, could you please, take a look to the registry, for default map protocol handler and figure out how to change that stuff? I'm pretty busy these days (and probably will be extremely busy couple of next months) but we can cooperate and create this app...
I'll investigate, but you're not the only one busy. If you've noticed a lack of software from me recently, it's due to the nex job I got some months back; I love it, but it leaves me with a lot less time for phone hacking if I want to still have a life outside of that.
With that said, this actually ties into the work I'm already doing with things like filetype handling and default browser switching. I can send you my HKCRlib, at a minimum; it's a library that simplifies interacting with HKCR, including creating backups of important values when they change, and reverting the backups.
GoodDayToDie, truly, I'm not much interested (personally) in that hack 'cause I can't use it for my Lumia 900. So it's only for the community needs but because of lack of time, I believe, we may put it on hold.

Categories

Resources