.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

WMI: how to get modem init and hangup strings?

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :.NET Framework


Is there a way in WMI to get a modem's init and hangup strings?  The Win32_POTSModem class exposes lots of useful properties, but I was disappointed to discover that it doesn't offer properties for these strings.  I know that I can read the registry (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96D-E325-11CE-BFC1-08002BE10318}\0002\Init and ...\Hangup) to get these settings, but I would rather use WMI to do this.  Any suggestions?


View Complete Post

More Related Resource Links

Use a Windows Mobile Phone as a Bluetooth Modem

Many Windows Mobile Pocket PC Phones and Windows Mobile Smartphones can be connected to a Windows PC via Bluetooth for use as a wireless dial-up modem. If your Windows Mobile device supports Bluetooth Dial-Up Networking, or Bluetooth DUN, and your Windows PC Bluetooth-enabled, you have everything you need.

In this tutorial, we'll show you how to use Windows Mobile Pocket PC Phones or Smartphones as a Bluetooth modem for Windows XP PCs.

How to check for null/empty strings on dynamic objects?


What is the proper way to check for null or empty strings on dynamic objects? This is the only solution I've found so far:

if (admin.PasswordHash.GetType() == typeof(DBNull) || admin.PasswordHash == string.Empty)

If the field is null, the object returned is DBNull.Value, but if the field is empty string, it's return as a System.String object. This makes it impossible to do regular "admin.PasswordHash == DBNull.Value" check, as that will fail whenever the field has been set to empty string. Is my example the right (and only) way to go?

Protect It: Safeguard Database Connection Strings and Other Sensitive Settings in Your Code


Protecting application secrets, such as database connection strings and passwords, requires careful consideration of a number of pertinent factors such as how sensitive the data is, who could gain access to it, how to balance security, performance, and maintainability, and so forth. This article explains the fundamentals of data protection and compares a variety of techniques that can be used to protect application settings. The author discusses what to avoid, such as hiding keys in source code and the use of Local Security Authority. In addition, he presents some effective solutions such as the Data Protection API.

Alek Davis

MSDN Magazine November 2003

ActiveX and Visual Basic: Enhance the Display of Long Text Strings in a Combobox or Listbox


The combobox and listbox controls in Visual Basic have no built-in support for displaying text strings that are too long to fit in the visible area of either control. This article describes several techniques to improve the readability of long strings in each control. The first technique uses tooltips to display a combobox or listbox item. The other techniques, which use various Windows APIs, include adding a horizontal scrollbar for a listbox and determining the necessary width of the longest string given the font attributes of the text. The required steps are described for both comboboxes and listboxes.

John Calvert

MSDN Magazine December 2000

quotes in xml strings


I need to post an xml string to another website.  I can't create an xml file, because some of the content is dynamically created.  The two lines that are causing me problems are

sPostData = sPostData & "<?xml version='1.0'?>"
sPostData = sPostData & "<?qbmsxml version='4.1'?>"

The receiving site expects to see

<?xml version="1.0"?>
<?qbmsxml version="4.1"?>


<?xml version='1.0'?>
<?qbmsxml version='4.1'?>

The conversion from double quotes to single quotes isn't being accepted.  So how can I send the string so that the versions are surrounded by double quotes?

WCF over mobile modem link - performance help needed

I am looking for ways to improve the performance of my WCF communications over a mobile modem. I have a system where the clients are connected to the internet via a mobile (GPRS/3G/HSDPA) connection. This is NOT a windows mobile client, it is a full XP Professional system running .Net4.0. The clients basically use a USB mobile modem (SIM card etc) to get their internet connection. The server is connected directly to the internet via broadband. My WCF interface has 2 main methods, one sends 2 int values from the client to the server and the other sends 3 images (JPGs) to the server. As you can see one is going to take less than a second and the other is going to take maybe 30-60 seconds depending on the images size and connection speed. If we have a good mobile modem connection to the internet then everything works perfectly. The problem I have is a lot of the time I do not have a good connection. The timeout on the WCF binding is set to 120 seconds. This gives the images enough time to get across even if the connection is a bit slow.  The problem comes when the connection stops - this is a network (mobile network) problem, something like the signal drops etc. Communications never recovers. At this point after about 10 seconds of inactivity (no communications) I know that the connection will never recover. At this point the best thing I have found to do it res

Does SQL Server have to load and init statics every time a SQL/CLR managed proc is invoked?

We are working with SQL/CLR stored procedures, triggers etc and it seems that all assemblies we use are unloaded/loaded every time a proc or trigger or TVF is called. Is this true? Is there any way to retain data between invocations of procs? for example can I create some static struct or object that I can setup once and then just refer to after that, so that unless we terminate SQL server, the static data is always in memory? Thanks PS: This was originally posted here, but that forum seems to be rarely frequented.  

PropertyOf and INotifyPropertyChanged.PropertyChanged without strings

When coding applications using design patterns such as MVP (Model-View-Presenter) or MVVM (Model-View-ViewModel), you'll find yourself using data binding and the INotifyPropertyChanged interface all over the place. This means referencing properties quite a lot. For example, when you want to notify that the value of a property has changed, you can write NotifyPropertyChange("SomeProperty") where NotifyPropertyChange is a method that invokes the INotifyPropertyChanged.PropertyChanged event. The major inconvenience of using a string to reference a property name, as in NotifyPropertyChange("SomeProperty"), is that it's a very brittle approach. If the name of the property changes or the property is removed during some refactoring operation on the source code, then it's easy to forget to update all the "string references". Luckily, solutions exist to avoid this kind of issues. infoof => PropertyOf, FieldOf, MethodOf, ConstructorOf We don't have propertyof or infoof operators in C# (see 1, 2, 3 or 4), but we can use things such as PropertyOf thanks to expression trees. You can learn more about such an approach on the C# FAQ blog and Patrick Smacchia's blog. Here is the source code, derived from the above articles, that I use in a utility class: Snippet public static MethodInfo MethodOf<T>(Expression<Func<T>> expression){  var&

Error calling WCF service that is returning list.".Debugging resource strings are unavailable ......

Ok.this is just making me frustrated... Here is step by step of what I am trying to do (& not able to) 1. I am calling WCF service hosted in a SharePoint 2010 site from a silverlight app in same domain (So no cross doman I guess). 2. I use Linq to Sharepoint for querying the DB. 3. I am having a list "machines" in Sharepoint 2010 that is having a lookup column from Other list called "part" 4. My WCF method GetAllMachines() works perfectly well when it skips the lookup column "partname" & returns List of type machineitem. 5. But problem occurs when I add machineitemobject.parts.partsname in my Linq to Sharepoint query . My service gives the error not found Async_ExceptionOccurred] Arguments: Debugging resource strings are unavailable." 6. Note that return type of my Method is List<machinesitem> 7. The point to note here is that I use SPMETAL tool to generate the LINQ class that maps the lists . So When I try to query the lookup column it tries to add List item of the type class & that is what causing the error. Is it because I am not using datacontract in my service (but it returns the strings & all private members of machines list e.g. name,title etc) Is it making the attribute Serialisable will solve the error ??? I am kind of lost in it ...Plss help!!   Thanks

page init event

In the book pro asp.net it mentions:"In addition, if the page is not being requested for the firsttime (in other words, if it's a postback), ASP.NET deserializes the view state information and appliesit to all the controls.At this stage, the Page.Init event fires. However, this event is rarely handled by the web page,because it's still too early to perform page initialization. That's because the control objects may notbe created yet and because the view state information isn't loaded.""ASP.NET deserializes the view state information and applies it to all the controls."and "That's because the control objects may not be created yet and because the view state information isn't loaded."seems contradictory as if the view state is not loaded how come it is applied to the control?

Can not init SPSite for claims based authenticated site

Hi, trying to write a simple console application i was not able to init a claims based authenticated site with API nor with the Managed Client OM. Opening a site with only windows authentication is working. Running on a Windows Server 2008 R2 and SP 2010 server and logged in as the buildin Administrator account. Administrator is Site Collection Admin. static void Main(string[] args) {     ClientContext context = new ClientContext("http://mypc:300");     Web web = context.Web;     context.Load(web);     context.ExecuteQuery();     ... } throws "The remote server returned an error: (403) Forbidden.". Setting credentials for the context is also not working. or same problem with     static void Main(string[] args) {     using (SPSite spSite = new SPSite("http://mypc:300"))     {         ... throwing FileNotFound-Error. Any idea? Greetings Peter  

Subtracting from Strings

I am writing a windows form which requires putting all the words in a textbox in an array. Everything is fine except the backspace function. Obviously, when the user hits backspace, I want it to remove the last character typed; however, I keep getting errors when I subtract from a string... here's the code (it's in c++ but I'm fine if I get code samples in other programming languages from you) it is in a key down event handler for textBox1   if(e->KeyCode != Keys::Space && e->KeyCode != Keys::Back && e->KeyCode != Keys::ShiftKey) { input[j] += e->KeyCode.ToString(); } if(e->KeyCode == Keys::Back) { if(input[j] == "") { j--; } else { String^ theText = input[j]; int i = theText->Length - 1; input[j] = input[j] - theText[1].ToString(); } } if(e->KeyCode == Keys::Space) { j++; } //j is an int and input is a string array  

Simple Regex. Select 2 strings in a sentence

Hello,  I am a begginer in Regular expressions. I am trying to write a regex to print out a specific string in a sentence.  For example:  "We've found questions similar to yours" I would like to create a regex for the word "found" and "yours". whenever found is matched OR yours is matched print the word.  Basically i just need to know how the OR statement works in this case.  regex.match("found" OR "yours")  ??? Thank you -Klevis

Strings stripped of leading whitespace when using MTOM message encoding

Hello, I have a problem which I believe is actually caused by a bug in WCF 4 (.Net 4). I have a WCF service exposes two basicHttpBinding endpoints identical in everything but the message encoding used, one uses "text" and one "mtom" (i.e. the values for the messageEncoding attribute on the binding configuration). If I send a string with leading whitespaces to the "text endpoint" it is delivered to the service application code exactly as sent. If I send the string to the "mtom endpoint" it is stripped of the leading whitespaces before being handed over to the service application code. I have confirmed that the leading whitespaces are included in the message on the wire and using an IDispatchMessageInspector I have also confirmed that the whitespaces are still present after decoding the message (Message.ToString()). The whitespaces seem to disappear between this stage and when the message is deserialized. My current workaround is an IDispatchMessageInspector with the following AfterReceiveRequest method: public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext) { // Doing this roundtrip over MessageBuffer removes the problem // (i.e. leading whitespaces are not removed) request = request.CreateBufferedCopy(int.MaxValue).CreateMessage(); return null; } Am I missing something he
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend