473,505 Members | 15,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Big in Framework 2.0 with wmi?

Hello,

this is my code with vs20005:

ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM Win32_Printer");

foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_Printer instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("Name: {0}", queryObj["Name"]);
}

I use wmi for found all printer name.
This is my exception:
Unable to find an entry point named 'GetCurrentApartmentType' in DLL
'wminet_utils.dll'.

The code work well in vs2003 but in vs2005 i have the exception.
I think there is a problem with the framework 2.0.

If you have any idea or info!

Best regards,

Wavemill

May 12 '06 #1
6 3371
wavemill wrote:
Hello,

this is my code with vs20005:

ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM Win32_Printer");

foreach (ManagementObject queryObj in searcher.Get())
{


Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_Printer instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("Name: {0}", queryObj["Name"]); }

I use wmi for found all printer name.
This is my exception:
Unable to find an entry point named 'GetCurrentApartmentType' in DLL
'wminet_utils.dll'.

The code work well in vs2003 but in vs2005 i have the exception.
I think there is a problem with the framework 2.0.

If you have any idea or info!


Is that the complete code? It works fine here under both vs2003 and vs2005.
Are you referencing the correct version of System.Management.dll?
--
Tom Porterfield

May 12 '06 #2

"wavemill" <wa******@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
Hello,

this is my code with vs20005:

ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM Win32_Printer");

foreach (ManagementObject queryObj in searcher.Get())
{

Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_Printer instance");

Console.WriteLine("-----------------------------------");
Console.WriteLine("Name: {0}", queryObj["Name"]);
}

I use wmi for found all printer name.
This is my exception:
Unable to find an entry point named 'GetCurrentApartmentType' in DLL
'wminet_utils.dll'.

The code work well in vs2003 but in vs2005 i have the exception.
I think there is a problem with the framework 2.0.

That code works fine for me in VS2005. By the way have you seen the WMI
branch on the server explorer in VS2005. You can drag the printer object
onto a component and it will create the typed object wrappers for you. Then
you can use something like

foreach (Printer ptr in Printer.GetInstances())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_Printer instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("Name: {0}", ptr.Name);
}

David
May 12 '06 #3
Tom Porterfield wrote:

Is that the complete code? It works fine here under both vs2003 and
vs2005. Are you referencing the correct version of System.Management.dll?


I know, bad form replying to myself.

You might try the following instead as it should run faster than WMI calls:

foreach (string printer in
System.Drawing.Printing.PrinterSettings.InstalledP rinters)
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("Printer instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("Name: {0}", printer);
}

--
Tom Porterfield

May 12 '06 #4
Hello!

Thank you for your answer!

I want use wmi not just for printer name...

I have try to open the WMI
branch on the server explorer in VS2005 but i have the same exception:
Reason: Unable to find an entry point named 'GetCurrentApartmentType' in DLL
'wminet_utils.dll'.

I don't know why!

If you have an idea!

Best regards,

Wavemill
May 12 '06 #5

"wavemill" <wa******@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
| Hello,
|
| this is my code with vs20005:
|
| ManagementObjectSearcher searcher =
| new ManagementObjectSearcher("root\\CIMV2",
| "SELECT * FROM Win32_Printer");
|
| foreach (ManagementObject queryObj in searcher.Get())
| {
|
Console.WriteLine("-----------------------------------");
| Console.WriteLine("Win32_Printer instance");
|
Console.WriteLine("-----------------------------------");
| Console.WriteLine("Name: {0}", queryObj["Name"]);
| }
|
| I use wmi for found all printer name.
| This is my exception:
| Unable to find an entry point named 'GetCurrentApartmentType' in DLL
| 'wminet_utils.dll'.
|
| The code work well in vs2003 but in vs2005 i have the exception.
| I think there is a problem with the framework 2.0.
|
| If you have any idea or info!
|
| Best regards,
|
| Wavemill
|

Looks like your .NET install is broken, could you verify the version of
'wminet_utils.dll', it should be 2.0.50727.42 with size on disk 28.672
bytes? Another option is to run depends.exe or dumpbin.exe to verify whether
'GetCurrentApartmentType' is exported.

Willy.

May 12 '06 #6
Hello!

Thank you for your answer!

The siez and the version of wminet_utils.dll are ok.
But i have reinstall the dotnet framework and now it's ok.

Tanks for your help,

Best regards,

Wavemill
May 12 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2006
by: Ravindra | last post by:
Well I installed the framework provided by microsoft , the problem is I am able to activate the smart tag in the doc file but when I Click on the Show Detils option in the information bridge the...
3
20625
by: CMan | last post by:
Hi, We are currently trying to install .Net Framework v.1.1 on a server which already has v1.0. We are receiving the following error. Error 1704.An installation for Microsoft .NET Framework...
18
2995
by: Cameron Laird | last post by:
QOTW: "... So I started profiling the code and the slowdown was actually taking place at places where I didn't expect it." -- Guyon Mor?e (and about twenty-three thousand others) " suggestion...
6
2065
by: Joseph Geretz | last post by:
I recently upgraded my server to Windows 2003. The first thing I noticed is that my sample WebService pages no longer worked. The Invoke test button is missing. This is addresed by the following KB...
9
3184
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My...
1
2237
by: Harry Simpson | last post by:
I know I drilled down into the Windows folder\Microsoft.net\Framework\v1.1.4322 folder and looked at the version of Mscorcfg.dll to get the SP level from the version number: Mine shows...
3
3054
by: Shadow Lynx | last post by:
At the bottom of the default Error page that appears when Unhandled Exceptions occur, what exactly is the difference between the "Microsoft ..Net Framework Version" and the "ASP.NET Version"? I...
3
6599
dmjpro
by: dmjpro | last post by:
plz send me a good link which can clearify me how the J2EE framework works i want the details information .... plz help thanx
13
6613
by: dancer | last post by:
I have made a new post because when I try to respond to another, I get the error, "Article Rejected -- Ill-formed message id" This is in response to the advice of Juan Libre to install Net...
8
1894
by: Blasting Cap | last post by:
I'm using VS 2005, and have a dll in some code (system.core.dll) that was included in something someone sent me to run on my system. I have production on a server using Framework 2.0 that I want...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.