|
Does anyone know how i can change the drive letter of a cd drive. My company buys PC's pre configured but sometimes the CD drive comes mapped with the wrong drive letter.
Thanks.
|
|
|
|
|
You want to do this in general, or in code ? I am not sure you can do it, in C#
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yes i want to do it programatically inside my c# app. If c# doesn't contain any available functions is there a dos command i can call from my app. How does disk manager do it?
|
|
|
|
|
Dont know for CD's but for hard drives you can use Partition Magic.
Try shutting down the computer, pulling the power cable out of the CDROM and starting the computer. Then turn of the computer and put the power cable back in. This could work if, for an example, you have C: D: CDROM is E: and you get sometimes C: D: CDROM is F:
I hope it works and helps u.
Força Barça!
|
|
|
|
|
What on earth does this have to do with C# ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Really dont know Just trying to answer the question anyway
Força Barça!
|
|
|
|
|
Assuming you are using Windows, you can easily change the drive letter in "Computer Management" -> "Disk Management".
|
|
|
|
|
Can't be done with C#. You maybe able to do it by using unmanaged code within C# and using the functions built into the dlls that Disk Management uses.
Googling / pinvoke may help but unless your company is buying a large quantity of PCs it's probably not worth the effort - and if they are buying that sort of volume they should be able to instruct the suppliers to configure them to their requirements.
Edit:
Just found this[^] which you may find useful. Seems you may be able to create a script file in c# - save it - and then call Diskpart passing the script file as an argument???
Good luck!
Dave
|
|
|
|
|
That's the whole point, we are instructing the supplier to set the drive letter but sometimes they come to us set wrong. My application installs our system control software from our archive over the network and i want it to change the cd drive letter if it is wrong as well. Is there a windows shell utility i could call via a process?
|
|
|
|
|
Just edited my post above - check the edit.
Dave
|
|
|
|
|
Hi.
Im a student and in last year. I was developing an application for the finish of shool and it worked ok - on some computers.
I got an error on only some computers and the game (or app or quiz) wouldnt start!
The school sent my app. to an competition and what i feared the most happened. The application wont start at their computers I think i wont make this school ever if i dont get this application to start.
Im giving you the Event viewer log and also the whole source code of the application. Please, i just need to know how to fix this error and whats causing it. Please help me... or else im doomed Please try the source code and take some minutes of your time for me :/
The error log:
Code SnippetType: Error<br />
Event Source: .NET Runtime 2.0 Error Reporting<br />
Event Category: None<br />
Event ID: 5000<br />
Date: 13.5.2008<br />
Time: 9:59:51<br />
User: N/A<br />
Computer: NB-LAPTOP<br />
Description:<br />
EventType clr20r3, P1 gktqt2mlox0vylsaef5mvfgwad2nxlfr, P2 1.0.0.0, P3 4807be7e, P4 y5fr4pseyqcbmjndxt5gaczr22qigqo2, P5 1.0.0.0, P6 4807be7e, P7 105, P8 e, P9 system.typeinitialization, P10 NIL.<br />
<br />
For more information, see Help and Support Center at http:
Data:<br />
0000: 63 00 6c 00 72 00 32 00 c.l.r.2.<br />
0008: 30 00 72 00 33 00 2c 00 0.r.3.,.<br />
0010: 20 00 67 00 6b 00 74 00 .g.k.t.<br />
0018: 71 00 74 00 32 00 6d 00 q.t.2.m.<br />
0020: 6c 00 6f 00 78 00 30 00 l.o.x.0.<br />
0028: 76 00 79 00 6c 00 73 00 v.y.l.s.<br />
0030: 61 00 65 00 66 00 35 00 a.e.f.5.<br />
0038: 6d 00 76 00 66 00 67 00 m.v.f.g.<br />
0040: 77 00 61 00 64 00 32 00 w.a.d.2.<br />
0048: 6e 00 78 00 6c 00 66 00 n.x.l.f.<br />
0050: 72 00 2c 00 20 00 31 00 r.,. .1.<br />
0058: 2e 00 30 00 2e 00 30 00 ..0...0.<br />
0060: 2e 00 30 00 2c 00 20 00 ..0.,. .<br />
0068: 34 00 38 00 30 00 37 00 4.8.0.7.<br />
0070: 62 00 65 00 37 00 65 00 b.e.7.e.<br />
0078: 2c 00 20 00 79 00 35 00 ,. .y.5.<br />
0080: 66 00 72 00 34 00 70 00 f.r.4.p.<br />
0088: 73 00 65 00 79 00 71 00 s.e.y.q.<br />
0090: 63 00 62 00 6d 00 6a 00 c.b.m.j.<br />
0098: 6e 00 64 00 78 00 74 00 n.d.x.t.<br />
00a0: 35 00 67 00 61 00 63 00 5.g.a.c.<br />
00a8: 7a 00 72 00 32 00 32 00 z.r.2.2.<br />
00b0: 71 00 69 00 67 00 71 00 q.i.g.q.<br />
00b8: 6f 00 32 00 2c 00 20 00 o.2.,. .<br />
00c0: 31 00 2e 00 30 00 2e 00 1...0...<br />
00c8: 30 00 2e 00 30 00 2c 00 0...0.,.<br />
00d0: 20 00 34 00 38 00 30 00 .4.8.0.<br />
00d8: 37 00 62 00 65 00 37 00 7.b.e.7.<br />
00e0: 65 00 2c 00 20 00 31 00 e.,. .1.<br />
00e8: 30 00 35 00 2c 00 20 00 0.5.,. .<br />
00f0: 65 00 2c 00 20 00 73 00 e.,. .s.<br />
00f8: 79 00 73 00 74 00 65 00 y.s.t.e.<br />
0100: 6d 00 2e 00 74 00 79 00 m...t.y.<br />
0108: 70 00 65 00 69 00 6e 00 p.e.i.n.<br />
0110: 69 00 74 00 69 00 61 00 i.t.i.a.<br />
0118: 6c 00 69 00 7a 00 61 00 l.i.z.a.<br />
0120: 74 00 69 00 6f 00 6e 00 t.i.o.n.<br />
0128: 20 00 4e 00 49 00 4c 00 .N.I.L.<br />
0130: 0d 00 0a 00 ....
Have a nice day,
Matjaz
ps: sorry for my bad english
THE SOURCE is here in .RAR file - THE FILE
|
|
|
|
|
Is .NET installed on all these machines ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yes. I have included an installer with prerequisities : .NET Framework 2.0, DirectX 9.0C Redistributable, DivX and XvID codec. I think that the application only needs this software.
Força Barça!
|
|
|
|
|
OK - well, it seems to me you must be missing some dependancy, for it to work on some PCs and not others.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
So, how can i fix that? I would be very greatful if you'd take a look at the source code :/
Força Barça!
|
|
|
|
|
It's very very important for any developer to troubleshoot:
Add in a small routine to write to a log file or popup a messagebox for debug purpose. You can remove them in in the production version.
1. Has your application started at all? Add a debug message as the first line to execute. If the application has not been started at all, it should be due to missing dependency or the environment (.NET instalation etc).
2. If the application started, add in the debug message before and/or after the area where you think it may cause troubles. Slowly drill down to narrow down the trouble area.
3. Additionally, put a try catch block at the Application.Run and catch the exception and save the trace message to a file. You can read the trace message and try to find out where it went wrong.
|
|
|
|
|
The problem occurs when the user clicks on .exe file. Thats it.
And i have a problem, that the application works at my computer, only at some computers doesnt work :S So i cant test the application.
I thought that you can get at least some information out of the error log?
Força Barça!
|
|
|
|
|
|
Click on View Detail, on the View Detail popup, look at the first line of StackTrace and see where is the line at which the exception is thrown, then drill down from there.
Seems to me there's something wrong in your frmIME. You should step into the code of the initialization of that form (F11) and see where it went wrong.
|
|
|
|
|
Hi.
I did what you suggested.
Here is the copy of the error that was given. Not sure i quite understand how to fix it, since the problem is, as reported, in security??
System.TypeInitializationException was unhandled<br />
Message="The type initializer for 'Primoz_Trubar___Popotovanje.frmIme' threw an exception."<br />
Source="Popotovanje Primoža Trubarja"<br />
TypeName="Primoz_Trubar___Popotovanje.frmIme"<br />
StackTrace:<br />
at Primoz_Trubar___Popotovanje.frmIme..ctor()<br />
at Primoz_Trubar___Popotovanje.Program.Main()<br />
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)<br />
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)<br />
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)<br />
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()<br />
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)<br />
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)<br />
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()<br />
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br />
at System.Threading.ExecutionContext.runTryCode(Object userData)<br />
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)<br />
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
at System.Threading.ThreadHelper.ThreadStart()<br />
InnerException: System.Security.SecurityException<br />
Message="That assembly does not allow partially trusted callers."<br />
Source="Popotovanje Primoža Trubarja"<br />
StackTrace:<br />
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)<br />
at Primoz_Trubar___Popotovanje.frmIme..cctor()<br />
InnerException:
What to do next?
Oh, and is there a possibility to use the DLLs from my computer? I only use the DirectX.AudioVideoPlayback.dll (i think this is it, cus VS copies this file to the debug output as asked).
Força Barça!
|
|
|
|
|
Hey guys...
this is a bit of a brain fart... but is it possible to have more than one condition in a case statement?
eg...
switch (myString)
{
case "hehe" || "haha":
break;
}
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
Why don't you give it a try? If you are lazy opening Visual Studio for such simple tests, you can use snippet compiler, it's quite a handy tool.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
i did try...
just wrote that bit of code as an example of what i mean by multiple conditions
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
case "hehe":
case "haha":
break;
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|