|
I using theis code to disover new registre
**********************************************************************************8
if(OurKey !=null)
{
//find all the subkeys
daemonKey = OurKey.GetSubKeyNames();
//how many found?
numElements = daemonKey.Length.ToString();
count=Convert.ToInt32(numElements);
for(int i=0;i<=count-1; ++i)
{
newDKey=newDKey+daemonKey[i];
//label1.Text=newDKey; //LABEL 1
//reopen the registry with new path
RegistryKey OurKey1 = Registry.LocalMachine;
OurKey1=OurKey1.OpenSubKey(newDKey,true);
string status =(string)OurKey1.GetValue("Alive");/////line A
label1.Text = status; //Line B
}
***********************************************************************************************
The new path is read correct with (label1.Text=newDKey)
I am trying to read a DWORD value define by the DWORD key "Alive"
If I compile the program, no errors are reported but still cannot read the DWORD value into the label1.
Any help is greatly appreciated
|
|
|
|
|
Hello everybody !
Can you help me about that problem? Thanks to you ! I want to retrieve conversation text from Yahoo Messenger by APIs of C#. How can I do? Thanks
Phong
-- modified at 1:14 Saturday 29th April, 2006
|
|
|
|
|
I started developing a web part but am having some security issues with it. I am trying to do some really simple stuff as shown below.
<br />
SPWeb mySite = SPControl.GetContextWeb(Context);<br />
output.WriteLine(SPEncode.HtmlEncode(mySite.Users.Count.ToString()));
It is the SPWeb line that is giving me the security error which is:
Request for the permission of type Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c failed.
I started by making the webpart safe in the wss_minimaltrust.config file by using the Public key. That didn't work so I upgraded the trust level to Medium in the web.config file just to see what would happen. it still broke so I upgraded the trust level to Full. It still broke!
This code is used by many others all over the web but I haven't seen them having any issues. Full trust should allow everything so why am I still getting a security error?
Oh, and I did iisreset between each security change just to be sure it took hold.
Thanks for any help!
|
|
|
|
|
Ok, so duh...
I was editing the web.config located in Program Files\Common Files\Microsoft Shared\web server extensions\60\CONFIG when the web.config that needs to be edited is in the web root under Inetpub.
|
|
|
|
|
Hi,
I was just wondering if anybody else has same problem -> I can't seem to get this to work on other than UI thread. So this works if you call it directly on form
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand,
string strReturn, int iReturnLength, IntPtr hwndCallback);
private void OnSomeButtonClick()
{
PlaySound(new object[] {"c:/sound.mp3", this.Handle});
}
private void PlaySound(object soundToPlay)
{
string soundToPlay = ((object[])data)[0];
Handle handle = ((object[])data)[1];
string sCommand = "open \"" + soundToPlay + "\" type mpegvideo alias MediaFile";
mciSendString(sCommand, null, 0, IntPtr.Zero);
sCommand = "play MediaFile wait";
mciSendString(sCommand, null, 0, handle);
string sCommand = "close MediaFile";
mciSendString(sCommand, null, 0, IntPtr.Zero);
}
But if you say:
private void OnSomeButtonClick()
{
ThreadPool.QueueUserWorkItem(new WaitCallback(PlaySound), new object[] {"c:/sound.mp3", this.Handle});
}
It won't play sound... anyone?
Tnx in advance
|
|
|
|
|
Hi!
I am trying to develop the messenger-like program and i need to make possible for clients to make the audio conversation to each other! Do i need to use RTSP or what? How is this option implemented in other popular messengers(MSN Messenger)!? Any help would be very very appreciated!
|
|
|
|
|
RTSP = TcpClient for control, UdpClient for communication is ql idea.
However you'll need a way to record wave and play it on other side... these two articles should help you do that pretty easily:
http://www.codeproject.com/cs/media/cswavrec.asp
http://www.eggheadcafe.com/articles/20050611.asp
Enjoy
|
|
|
|
|
But if i use TcpClient for control, doesn`t it mean i must use TCP for data transmition as well!?
And about recording and playback sounds, couldn`t that do with DirectX9 classes?
Thankx!
|
|
|
|
|
For TcpClient -> of course not. You can use TcpClient for recieving control commands ("START_SESSION", "END_SESSION"), and use UdpClient for data transport (it's faster)...
You can do recording with DX9.. but then all of your clients need to have DirectX 9 installed.
|
|
|
|
|
How can i implement RTP in c#!? I couldn`t find anybody to have done that! Why not use RTP protocol? I thought the RTP protocol was made for that kind of work!
|
|
|
|
|
|
Thanx!!! Where did you find this code!? Did you wrote it, maybe!? Thanx anyway!
|
|
|
|
|
Can you please tell me where I can find this C# RTP code?
The link posted here is not valid anymore
|
|
|
|
|
I have a C# 2005 program with Page Setup, Print & Preview Dialogs. Only problem is that if I invoke Page Setup repeatedly, (even without doing anything else) the margins are halved each time! If I run the print WITHOUT invoking Page Setup, it uses larger margins (on which I fail the print 'cos of insufficient space). I have downloaded and run a Microsoft MSDN example - and that does the same. I thought that Page Setup should start with the defaults and retain changes. What am I missing (please!)?
Pensioner Graham Dean
|
|
|
|
|
Nothing. That's a bug. I think it is culture dependant - are the borders displayd in millimeters instead of inch on your machine? The dialog is just not able to handle this cleanly.
Here is the workaround (with a slight rounding error):
PageSettings pageSettings;
PageSetupDialog dlg = new PageSetupDialog();
Margins curMargin = pageSettings.Margins;
pageSettings.Margins = new Margins(
ConvInchToMm(curMargin.Left), ConvInchToMm(curMargin.Right),
ConvInchToMm(curMargin.Top), ConvInchToMm(curMargin.Bottom));
dlg.PageSettings = pageSettings;
dlg.PrinterSettings = pageSettings.PrinterSettings;
if (dlg.ShowDialog() != DialogResult.OK)
{
pageSettings.Margins = curMargin;
}
Basically the dialog converts the metrics when leaving the dialog (only with Ok not with Cancel) but doesn't do it when entering which is causing the decrease.
If you have any other metric then millimeter you surely have to adjust the conversion:
private int ConvInchToMm(int hundrInch)
{
return (int)(hundrInch * 2.54);
}
|
|
|
|
|
Thanks a lot Robert - exlains everything, and I am glad it's Microsoft not me that got it wrong!
Yes, my machine settings are in mm. Problem is to know what the measurements are on the 'client' machine, and I also note that the Dialog has an Enable Metric property.
Gives me plenty to look at, and hopefully will now get everything working. Thanks again.
Pensioner Graham Dean
|
|
|
|
|
hello every body, I usually work with sql server so if anybody may help with MS Access I'd be thankful.
here 's my C# potion of code:
string selectId = "select categoryId from Category where categoryName = @catName";
myCommand = new OdbcCommand(selectId,myConn);
myCommand.Parameters.Add("@catName",categoryName.ToString());
myCommand.prepare();
myReader = myCommand.ExecuteReader();
at this level an exeption is thrown at the level of the odbc driver it says not enough parameters or something. 1 parameter missing. In my string i'm having only one parameter and it's @catName.
in the definition of the Add()function it says that the second parameter is the value of the named parameter. The function that contains this code receives the value of categoryName however it's not set! can anybody help pls
|
|
|
|
|
Should be this...?
myCommand.Parameters.Add("catName",categoryName.ToString());
|
|
|
|
|
I'm having a problem with the XmlSerializer in .NET 2.0 (I never had this problem in 1.1).
I have a class which currently contains only a bool property and a string property that I'm trying to serialize using the XmlSerializer. My Serialization code is simple and I've used it 100 times before:
XmlSerializer xout = new XmlSerializer(typeof(MyClass));
StreamWriter sout = new StreamWriter(fname);
xout.Serialize(sout, this);
sout.Close();
The problem is that as soon as I try and execute the first line the program hangs. I even tried to use [XmlIgnore] attributes on both of my properties to try and track down if one of them is causing a problem but that doesn't even work. I'm totally mystified. My class has two public properties (bool and string), two private fields (bool and string) a default parameterless constructor and two methods (one to serialize and one to deserialize). What could possibly be wrong?
|
|
|
|
|
Jon, try replacing typeof(MyClass) with new(MyClass)MyClass().GetType() and see if that helps?
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
-- modified at 9:49 Sunday 30th April, 2006
|
|
|
|
|
|
|
Thanks for the suggestion. I tried this.GetType() instead of typeof(MyClass) and that didn't seem to work either. I can't figure out what it's got against my class?
|
|
|
|
|
|
The XmlSerializer always worked for me in .NET 1.1 (or at least I could eventually get it working after figuring out all the tiny problems that tended to cause it to throw exceptions). This is the first time I've tried it in .NET 2.0 and it isn't even throwing an exception, it just hangs.
|
|
|
|