Being a newbie in multithreading concept, I'd like to better understand why multithreading and/or multi-cores CPU could be problematic while determining timing in a program. Suppose, for example, that I want to know the elapsed time since a user has clicked with a mouse on the PC screen. I understand that there should be an event handler, but I read on some websites that computing such a deltatime could be very tricky, especially for multithreading and/or multi-cores PC.
On the other hand, some people warns about using GetPerformanceCounter because of the multithreading and/or multi-cores...
I would like to understand why and the concepts behind ?
The first problem is that your thread might be executed by different cores, the OS might switch your thread from one core to another. There are several problems with this: the switch takes time, it might screw up per-core cache efficiency and another problem is that GetPerformanceCounter() uses the tick count of the processor that said to be problematic on some systems if your thread is jumping from one core to another. To force the execution of your thread to a specific core use SetThreadAffinityMask()[^]. With this you might want to force every thread in your program to a specific core to avoid the problems I described above.
We have been using SHBrowseForFolder which returns a LPITEMIDLIST. That return value is then passed to SHGetPathFromIDList to get the actual path. All good until now.
Until recently, we used mapped drives. Now our IT team have replaced those with Shell Objects (using ShellObjectEditor.exe). Now the value in the returned LPITEMIDLIST no longer represents a file systems object and the call to SHGetPathFromIDList either returns something with GUIDs (for the sehell object itself) or nothing (for any subdirectory within the shell object).
Any idea how to get the path for a shell object (or its subdirectory) after a call to SHBrowseForFolder?
Or, alternatively, is there a replacement for SHBrowseForFolder that supports retrieving the path of shell objects?
Sure. You got to the manual here[^], and then you can read which exceptions the Start method might throw, and why.
..and if you click on the Exception and read it, you'll find a nice exception-handler that gives some more detail;
System.Diagnostics.Process myProc = new System.Diagnostics.Process();
myProc.StartInfo.FileName = "c:\nonexist.exe"; //Attempting to start a non-existing executable
myProc.Start(); //Start the application and assign it to the process component.
In this particular case, I'd guess that Windows can't find the file - probably because it's not in the local path.
With what? You still have not answered any of the questions asked of you, nor have you given a clear explanation of what your problem is. If a specific API call is not available in Windows Mobile, then that is probably because it would serve no purpose.
my problem is kill a process in windows mobile.i have method that kill process but sometime occurd win32Exception,i have method for get processes and processID and start process but when i kill process it say win32Exception.do u want that send my sourcecode for u?
And once again I have to ask: "what is the exception detail"? You seem to think that people can guess what is happening on your system without any information, but I'm afraid they cannot. Unless you provide full information about what you are trying to do and the full details of what happens, then it's unlikely that anyone will be able to offer a suggestion.
System.ComponentModel.Win32Exception at System.Diagnotics.Process.Kill() at Process.frmMain.EndProject() at Process.frmMain.tmrstartstop_Tick(Object Sender,EvenArgs e) at System.Windows.FormsTimer._WnProc(WM wm,Int32wParam,Int32 lParam) at System.Windows.Forms.ApplicationThreadContextMessage(WM wm,Int32 wParam,Int32 lparam)
Try the manual, as I suggested. There's a reason why it's passing a NativeErrorCode. As stated;
"Win32 error codes are translated from their numeric representations into a system message when they are displayed. Use NativeErrorCode to access the numeric representation of the error code associated with this exception. For more information about the error codes, see "Win32 Error Codes" in the Platform SDK documentation"