|
I am using System.Management.Managementobjectsearcher in C# to read processor Number. Internally it uses COM objects.
So it gives error that System.Runtime.Interopservices.COMException and error message is Com object is not registerd.
This error comes only in windows98. It works well with 2000,xp,2003 etc...
So tell me how to solve this error..
Nilesh Gambhava,
Life is NP-Complete so don't use Algorithm but use Heuristics
|
|
|
|
|
I think the error message speaks for itself. You're trying to create a COM object (you didn't say which one) that isn't registered on the machine.
Either the .DLL that supplies this object isn't registered properly, or you're assuming that the machine has whatever COM .DLL you need and has it registered, when in fact it doesn't. You could also be trying to create a COM object that doesn't have the version you need installed on the machine.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Write to the event log..
Anyone know it?
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
Hi,
I have a problem with MSMQ, i need to check queue existanc on a remote machine.
can any one have idea!!!!
regards
Chinna
|
|
|
|
|
Hello,
Why is it that oftentimes the SubTypes of my forms/usercontrols in the .csproj file are changed from SubType="Form" or "UserControl" --to-> SubType="Code" ? It's annoying as I need to open the .csproj in a text editor and manually change everything again from "Code" to "Form"/"UserControl"
Thanks for the help!
~Rafferty
|
|
|
|
|
Expert:
I am writing a C# application, How to automatically detect or notified when there is a new device plug in such as Adapter, PCI card, etc.
Thanks!
Hang
|
|
|
|
|
I have the SystemMonitor ActiveX control on a form and I try to register a custom performance counter.
I expect that after registering the counter with the OS, the user would be able to add it through this System Monitor ActiveX control on the form.
Yet, the Add dialog of this ActiveX does NOT contain the already registered counter.
Does anyone know what might be wrong?
Code snippet follows at the end.
BTW if I have the code that registers the counter in a separate executable, then the ActiveX has my counter. But if they're in one and the same executable, the ActiveX doesn't have it !?!
Ivan
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Diagnostics;
namespace WindowsApplication1
{
public class Form1 : System.Windows.Forms.Form
{
private AxSystemMonitor.AxSystemMonitor axSystemMonitor1;
private System.ComponentModel.Container components = null;
[STAThread]
static void Main()
{
CounterCreationDataCollection CCDC = new CounterCreationDataCollection();
CounterCreationData ccd = new CounterCreationData(
"MyCounterName",
"Some Help",
PerformanceCounterType.NumberOfItems32
);
CCDC.Add( ccd );
if (PerformanceCounterCategory.Exists("MyCategoryName") )
PerformanceCounterCategory.Delete("MyCategoryName");
PerformanceCounterCategory.Create("MyCategoryName", "Some Help", CCDC);
Application.Run(new Form1());
}
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.axSystemMonitor1 = new AxSystemMonitor.AxSystemMonitor();
((System.ComponentModel.ISupportInitialize)(this.axSystemMonitor1)).BeginInit();
this.SuspendLayout();
this.axSystemMonitor1.Enabled = true;
this.axSystemMonitor1.Location = new System.Drawing.Point(0, 0);
this.axSystemMonitor1.Name = "axSystemMonitor1";
this.axSystemMonitor1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSystemMonitor1.OcxState")));
this.axSystemMonitor1.Size = new System.Drawing.Size(328, 272);
this.axSystemMonitor1.TabIndex = 0;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(344, 269);
this.Controls.Add(this.axSystemMonitor1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.axSystemMonitor1)).EndInit();
this.ResumeLayout(false);
}
#endregion
}
}
|
|
|
|
|
I have an MFC MDI application in VC++ which is active document server application which allows opening document in container like internet explorer.
Is it possible to create the active document server application using .NET framework and allow to open document in internet explorer?
Any tips on the same will be helpful.
Thanks.
|
|
|
|
|
Hello,
I'm trying to use Microsoft Web Browser Control coding on c# (framework 1.1), what is the purpose of the wrapper used tlbimp utility.
1) I've load web page using Navigate method
2) then when i got the document, I’m running thru all the elements and make a "hooks" or register delegates on the events I’ve needed.
When I’m using OnClick event - all is OK,
but in others case ( e.g. OnActivate ) - the error occurred
When I’ve implemented such code using winAPI - the code done the right result.
On my opinion there is an error in .NET Framework, i.e. during implementing COM object wrapper.
Answer please what has happened;
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using AxSHDocVw;
using mshtml;
namespace WindowsApplication1
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private AxSHDocVw.AxWebBrowser myWebBrowser;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.myWebBrowser = new AxSHDocVw.AxWebBrowser();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.myWebBrowser)).BeginInit();
this.SuspendLayout();
//
// myWebBrowser
//
this.myWebBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.myWebBrowser.Enabled = true;
this.myWebBrowser.Location = new System.Drawing.Point(0, 48);
this.myWebBrowser.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("myWebBrowser.OcxState")));
this.myWebBrowser.Size = new System.Drawing.Size(664, 288);
this.myWebBrowser.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(16, 8);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "Navigate";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(104, 8);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(104, 23);
this.button2.TabIndex = 2;
this.button2.Text = "ProcessElements";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(664, 342);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.myWebBrowser);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.myWebBrowser)).EndInit();
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
object o = 0;
object o1 = "";
object o3 = new byte[]{};
object o4 = "";
myWebBrowser.Navigate("http://127.0.0.1/test/index3.html", ref o, ref o1, ref o3, ref o4 );
}
private bool procesTextElementClick()
{
MessageBox.Show ("Click");
return false;
}
private void procesTextElementActivate()
{
MessageBox.Show ("Activate");
}
private void button2_Click(object sender, System.EventArgs e)
{
HTMLDocumentClass myDocument = (HTMLDocumentClass) myWebBrowser.Document ;
IHTMLElementCollection myHtmlElementCollection = myDocument.IHTMLDocument2_all;
MessageBox.Show(myHtmlElementCollection.length.ToString() ) ;
IEnumerator enumeratorOfMyCollection = myHtmlElementCollection.GetEnumerator();
do
{
// String href;
Object o = enumeratorOfMyCollection.Current;
if (o is HTMLInputElementClass)
{
HTMLInputElementClass inputElement = o as HTMLInputElementClass;
switch (inputElement.type)
{
case "submit":
// inputElement.HTMLButtonElementEvents_Event_onclick +=new HTMLButtonElementEvents_onclickEventHandler(clickOnButton);
break;
case "text":
inputElement.HTMLInputTextElementEvents_Event_onclick +=new HTMLInputTextElementEvents_onclickEventHandler(procesTextElementClick);
inputElement.HTMLButtonElementEvents_Event_onactivate +=new HTMLButtonElementEvents_onactivateEventHandler(procesTextElementActivate);
break;
case "checkbox":
// inputElement.HTMLButtonElementEvents_Event_onclick +=new HTMLButtonElementEvents_onclickEventHandler(clickOnButton);
break;
case "radio":
// inputElement.HTMLButtonElementEvents_Event_onclick +=new HTMLButtonElementEvents_onclickEventHandler(clickOnButton);
break;
}
}
} while (enumeratorOfMyCollection.MoveNext());
}
}
}
|
|
|
|
|
Hi Room,
I have a small query.
I have an exe that is linked dynamically to another dll built in the .NET.
Now the exe was built in the VC6.0 environment but later shipped to (built in) to the .NET environment.
Now I have a class that inherits CProgressCtrl in both.
I checked the size of CProgressCtrl calss at runtime in both the exe and the dll and find that class's size in exe is 4 bytes smaller than the one in dll.
Could it be because the different environments both are being built on.
The problem is that the size of CProgressCtrl in the exe and the dll is different by 4 bytes that gives me a null CWnd pointer for my progress bar ctrl in the dll(I pass this pointer from my exe to this dll).
Please anyone suggest as to how do i solve this discrepency.
I think that there is a difference in the definition of the CProgressCtrl class in the "AFXCMN.H" of the VC6.0 anmd VC7.0(.NET) environment.
MoQuisha
|
|
|
|
|
Hello!
I have a simple code that registers wake up event and executes an application, with CeRunAppEvent:
[System.Runtime.InteropServices.DllImport ("coredll.dll")]
public static extern bool CeRunAppAtEvent(string AppName, int WhichEvent);
bool rv = CeRunAppAtEvent("\\My Programs\\program.exe", NOTIFICATION_EVENT_WAKEUP);
Now I need to check if that event was registered previously, in order to prevent multiple registers of the same thing... but I dont find any useful function.
Note: CeRunAppAtEvent returns true altough actual event is already registered. It will only return false if there is any failure.
|
|
|
|
|
I have developed a Compact-Framework compliant .NET control (derived from System.Windows.Forms.Control) and would like to host this control in an HTML document on a Pocket PC. On the desktop, the following HTML code works fine:
<html>
<body>
<p>Hello World Control</p>
</body>
<object id="HelloWorldControl1"
classid="http:HWControl.dll#HWControl.HWControl"
height="500"
width="200" VIEWASTEXT>
</object>
</html>
However, on the Pocket PC, the control is not shown... Is it not possible to host.NETCF controls on Pocket IE?
Greets,
Ray
|
|
|
|
|
what r the classes of .net for GPRS and how the grps.
ddd
|
|
|
|
|
There is no GPRS support, or TAPI support for that matter, built into the .NET Framework BCL. If you really need to use the lower level functions of GPRS, you'll have to write wrapper classes for this yourself.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to put my referenced assemblies in a subfolder of \bin .. like \bin\assemblies. My application is in \bin.
By fefault .NET puts my app/assembly in same folder as my referenced assemblies. i use "Local Copy" of all references.
Is there a way to tell .NEt to use other locations?
//Maw
|
|
|
|
|
You may try using config file for that.
- ashish
|
|
|
|
|
any idea of how to use it?
//maw
|
|
|
|
|
I'm using THE api(SendMessage or PostMessage) to send a custom message between 2 C# exe's. The called exe is subclassed to listen to the custom message. In the calling exe, I'm trying to pass a string in the 4th parameter. At this stage the 2nd exe is already running. The api call keeps crashing the 2nd exe. Can it be done across exe's or only within the same exe, thanks.
thanks for your apply or provide sample code( the best )
you are welcome to visit my blog
|
|
|
|
|
Using SendMessage API to control external app:
have an external application that I need to be able to control. I've tried using SendKeys but due to the obvious limitations of this function the behavior is erratic. I know you can do this using the SendMessage API ( find the handle of the external application's window ,first ) ,but I'm not sure how to do it.
can you provide the sameple code to me ,please?
you are welcome to visit my blog
|
|
|
|
|
By trying using SendMessage API i got:
C:\Projecti\test\Form1.cs(77): 'System.Windows.Forms.Control.SendMessage(int, int, int)' is inaccessible due to its protection level
This API is from Platform SDK and i think it doesn't support in C#.
To get handle, you can call GetActiveWindow or FindWindow
|
|
|
|
|
I can do it now
I can use FindWindow,GetWindow and SendMessage to send message to a notepad app,just like this:
hWnd1 = FindWindow(null, "Untitled - Notepad");
hWnd2 = GetWindow(hWnd1, GW_CHILD);
sText =this.textBox1.Text;
SendMessage (hWnd2, WM_SETTEXT,sText.Length, sText);
but I don't know how to excute a word app's dictate by another app,help me please ,thank you!
you are welcome to visit my blog
|
|
|
|
|
I'm learning to program in C# w/ VisualStudio.NET 2003.
I've just bought a MCAD Certification book (70-316) Kalani.
Just started reading the self-assesment portion:
Here's some questions...
What the heck is the difference between the Framework SDK and VisualStudio.NET??
How do I "practice" working with the Framework SDK, as suggested in the book??
I know I'll get hammered for this Q. but so what...would I know the difference just by looking at the screen?
--thanks
|
|
|
|
|
Anonymous wrote:
What the heck is the difference between the Framework SDK and VisualStudio.NET??
The Framework SDK can be downloaded without buying VS.NET. It comprises everything you need to write programs in C# using a text editor and the command line, or a third party IDE, of which one or two exist ( free ware ).
Anonymous wrote:
How do I "practice" working with the Framework SDK, as suggested in the book??
Write code.
Anonymous wrote:
I know I'll get hammered for this Q. but so what...would I know the difference just by looking at the screen?
The difference between what ? The Framework SDK and VS.NET ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I know I'll get hammered for this Q. but so what...would I know the difference just by looking at the screen?
The difference between what ? The Framework SDK and VS.NET ? YES.
The study guide said make sure you practice with BOTH VS.Net and
The Framework SDK.
|
|
|
|
|
Anonymous wrote:
The difference between what ? The Framework SDK and VS.NET ? YES.
OK, then I did answer that, and rgraham explained it in more depth than I did.
Christian Graus - Microsoft MVP - C++
|
|
|
|