|
Hello,
I have a very strange problem with the WebBrowser control... When the WebBrowser control have the focus, all my main menu strip shortcuts stop working, and when I set the focus to another control it start working correctly.
How can I solve that?
Your help would be greatly appreciated.
|
|
|
|
|
What do the menu items do? The Browser Control is not a "windows control" like a Edit control or List control. It is actually a pretty large "program" wrapped into an ActiveX control so you can't expect to work with it like a Edit control or Button.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
How could i read the CaptureBuffer into a MemoryStream and write it into SecondaryBuffer???
for reading the CaptureBuffer into an array (CaptureData) it works fine:
<br />
private void RecordCapturedData()<br />
{<br />
byte[] CaptureData = null;<br />
int ReadPos;<br />
int CapturePos;<br />
int LockSize;<br />
<br />
applicationBuffer.GetCurrentPosition(out CapturePos, out ReadPos);<br />
LockSize = ReadPos - NextCaptureOffset;<br />
if (LockSize < 0)<br />
LockSize += CaptureBufferSize;<br />
<br />
LockSize -= (LockSize % NotifySize);<br />
<br />
if (0 == LockSize)<br />
return;<br />
<br />
CaptureData = (byte[])applicationBuffer.Read(NextCaptureOffset, typeof(byte), LockFlag.None, LockSize);<br />
<br />
soundBuffer.Write(0, CaptureData, LockFlag.EntireBuffer);<br />
<br />
soundBuffer.SetCurrentPosition(0);<br />
<br />
soundBuffer.Play(0, BufferPlayFlags.Looping);<br />
<br />
NextCaptureOffset += CaptureData.Length;<br />
NextCaptureOffset %= CaptureBufferSize;
}<br />
|
|
|
|
|
I have put a lot of effort in order to build a class that encrypt ConnectionString or any other key/value arument in the App.config configuration file.
The problem I am facing is that the EncrypKey variable (string) I am using to hold the encryption key is shown in the ildasm utility as a part of the class assembly.
This issue was never a problem in C++ or VB as they are nativ programming languages, but the C# in .NET anvironment is an "open source code" to all whome consirn
I will apretiate very much a good solution in order to finnish the task I am facing of encryption of ConnectionString to a data-base.
I hope the solution will not be to write a DLL in nativ programming language such as C++ or VB and in this machine-code DLL to put the encription key I am using in the C# program. I do not have the knowladge for doing such a task (connecting between C# program and C++ DLL) and it is like saying that C# has a prity big disadvantege on native languages.
Here is what the ildasm showing when I look at the assembley of the encripting class.
Please notic that "SuperSecret" is the encryption key I am using in order to encrypt and decrypt ConnectionString value in App.config file.
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 46 (0x2e)
.maxstack 5
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: stfld class [System]System.ComponentModel.Container SetAppConfig.Form1::components
IL_0007: ldarg.0
IL_0008: call instance void [System.Windows.Forms]System.Windows.Forms.Form::.ctor()
IL_000d: ldarg.0
IL_000e: ldstr "App.config"
IL_0013: ldstr "ConnectionString"
IL_0018: ldstr "SuperSecret"
IL_001d: newobj instance void [iConUtils]iConUtils.appConfiguration::.ctor(string,
string,
string)
IL_0022: stfld class [iConUtils]iConUtils.appConfiguration SetAppConfig.Form1::AppConfig
IL_0027: ldarg.0
IL_0028: call instance void SetAppConfig.Form1::InitializeComponent()
IL_002d: ret
} // end of method Form1::.ctor
Regards
yoffir
|
|
|
|
|
|
yoffir wrote: facing of encryption of ConnectionString to a data-base
Why encrypt your connection string? If you are concerned about the database password, then using a "Trusted Connection" is the ticket.
|
|
|
|
|
|
Colin Angus Mackay wrote: And it is the recommended way to connect to a database.
And I don't even think of using any other way of connecting to a sql database than trusted connection
PJC
|
|
|
|
|
Hi!
You'll always have a problem keeping secrets secret, but there indeed is something you can do.
If you need a symmetric encryption (like in your case), then placing the key inside an assembly is not a good ides, you're right.
One solution that comes to mind is to create the key at runtime.
At any point in your application's life cycle, you'll have the connection string unencrypted. Then you could create a random key and store this key in a safe place (a protected registry key or an isolated storage). Now encrypt the string with the random key and write it to your config file.
For decrypting you can get the key from the registry or IS and you'll be fine.
That way you don't have to hardcode any secret inside your assemblies. But you have to be careful nevertheless that the method creating and storing the random key isn't being executed by an untrusted caller, or else this caller could easily manipulate the connection string (although it's not so easy to find out the secret key, but he doesn't have to - your method does all the "dirty work" for him).
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
I do not know how to invoke windows API in C# ,who can help me.
No begin no end.
|
|
|
|
|
www.pinvoke.net - now type in the API you want to invoke and search for it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hello,
i search a speech compression library for c# for my voice chat because transfering a .wav in realtime over internet is not very fast...
cu
|
|
|
|
|
MP3 / Vorbis?
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
do you have a library for MP3 / Vorbis ?
is it fast enough for a voice chat?
|
|
|
|
|
LAME[^] is the defacto open source compressor / decompressor for MP3
Vorbis[^] is the open source equivalent for Vorbis files, except this one is written by the people who maintain the standards.
Should be fast enough for chat although they are written in C / C++ so Interop is required unless you want to rewrite the algorithms into C#. You'll just have to mess around with the settings to find one that's quick enough for your requirements.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
Hi!
You could google for Speex. It's a codec designed for speech compression and gives very good compression rates.
I even remember seeing a J# implementation somewhere...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hello, sorry in advance if this question is too simple for this crowd. I'm new to much of this.
I'm building an ASP .NET 2.0 site with C# code behind. It includes calls to the Google Maps API.
One of the functions I need is a geocode function. It takes an address and returns lat/long coordinates. I can call it from the client or server with javascript (not preferred), or from the C# code-beside using an HTTP request like this:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("URIcodeString");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resStream = response.GetResponseStream();
The address and response type are coded into the URIcodeString. I can opt to recieve the response either as an object or as XML. The object looks like this.
I can get as far as reading resStream into a String. From there, I'm planning on converting it to XML and parsing it to extract the data elements I need. That will entail some learning on my part, as I don't know XML. That's ok, but it does seem like a brute-force solution.
Question: is there a way to receive the JSON object directly and extract the fields I need, to avoid having to parse strings and/or XML? If I can, should I, or is parsing a stream a safer solution when dealing with data sent over the web?
|
|
|
|
|
I think I may have answered my own question with a little more web searching. Looks like I should use the Deserialize() method of the XmlSerializer class to convert the XML string into an object type. I'm still a little shaky on OOP, but I can then cast the object into a custom defined type so I can extract the fields I need, right?
|
|
|
|
|
Hi All !
is there any example for SMS Server (using c#.net ).I want to get some info about SMS Server .
thanks a lot ,
s_mostafa_h
|
|
|
|
|
I am trying to implement a message queuing system in my applicaton.
I have a main application which dynamically loads plugins that implement a required interface.
In order to send out message to and from plugins I have an OnMessage() function that receives
any message sent to it. Here is how it works. The main application has a central object called lets
say System which the plugins have access to. One the the methods of system allows you to create a
message.
IMessage message = System.NewMessage()
...
message.Send();
All messages are to be created, dispatched, and disposed of my the system object.
How should I approach this problem. I'm sure I will need a message queue, but I am not sure
about the rest.
Any ideas welcome.
PS: I don't want to use MS Message queue and all communication is only on the local machine.
|
|
|
|
|
Rather than having IMessage implement the sending it'd probably be easier to let the plugin send the message since it should contain a reference to the "System" object. If all Plugins derive from a base-class then you can implement a "SendMessage" function which will accept an IMessage and simply call a routine on the System object to add the message to it's internal Queue (you can use a Generic Queue or whatever for this). So basically:
interface IMessage
{
}
abstract class Plugin
{
System parent;
virtual void SendMessage(IMessage message)
{
this.parent.OnMessage(message);
}
} Et voila, I know that you said all plug-ins implement a particular interface but might I suggest they instead derive from a base-class because then you can easily add stuff like the above to it. If you were only providing an interface then the plugin writer would have to write the SendMessage function each time they write a plugin.
If you need to store the messages then I think there's a Queue Collection in the System.Collections and System.Collections.Generic namespaces (first is "weakly-typed", secondly can be generically typed to IMessage).
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
Okay I follow what your saying and it has good merit. I am trying to find more info on the actual message queuing part of the process that you mention at the end of your comment.
So, the System has a message queue that messages get added to.
1. They need to be depatched
2. They need to be disposed of.
3. What to do it no one consumes the message ( send it again, ?)
4. Is dispatching done on a thread or timer or what?
I hope that makes sense.
|
|
|
|
|
Are your plugin objects sending messages to the System object from various threads?
Why do your message objects need to be disposed of?
|
|
|
|
|
I mentioned threads just because I am not sure how to implement what I am asking.
I was thinking that if the message queuing framework ran in a thread it wouldn't
bogg down the main application thread.
When I said disposed I was actaull thinking of several issues.
1) A message has a lifespan where it is considered useful.
If I send out a message once and none one consumes it, is
it considered end of life, or should it be re-sent a number of
times. (assuming that for reason someone may have missing receiving it.)
2) Some messages will target specific plugins where as some messages
may have several intended recipients. So the system must be in
control of when the message gets removed from the queue.
3) If a message object is created it should be disposed (menory freed). I know
garabe collection will eventually get it.
(Also my message consist of an object that I have ceated to pass data back and forth)
-- modified at 2:19 Sunday 25th June, 2006
|
|
|
|
|
smesser wrote: I mentioned threads just because I am not sure how to implement what I am asking.
I was thinking that if the message queuing framework ran in a thread it wouldn't
bogg down the main application thread.
Ok. My DelegateQueue[^] class may help out if you need a message queue. It's not a message queue per se, but it can provide basic functionality that you may need to build upon.
Sending messages from the plugin to your system object will be pretty straightforward. Each plugin has a reference to the system object so that it can send it messages. Sending messages from the system object back to the plugins may be a little more tricky. The system object will need to keep track of all of the plugins. If the system object is running in its own thread, it will need to marshal its events to the plugins' thread.
All this is kinda vague, though. Can you describe more of what you want to accomplish with the system and plugins sending messages back and forth? When are the messages sent? I guess I just need more details overall.
|
|
|
|