473,800 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DllImport and Windows 2000

Hello, Newsgroupians:

I have created an unmanaged DLL using Visual Studio 2005, which was created
in Visual C++. I have some functions in the DLL that I am trying to call.
When I "dumpbin -exports ManipLib.dll" I can see all of my exported
functions, which I have defined in my definition file. They are not name
mangled or decorated.

Now, when I call the function in my C# program, I have the following
definition...

[System.Runtime. InteropServices .DllImport(@".\ ManipLib.dll", CharSet =
System.Runtime. InteropServices .CharSet.Unicod e)]
public static extern IntPtr UserFindWindowW (string lpszWndClass);

All UserFindWindowW does is call FindWindowEx(). Now, I know I can import
the user32.dll instead of this, but I have some other methods later that wrap
functionality of what I am going to do to the window, so this is just my base
case, and it doesn't work in Windows 2000.

When I run the program in WindowsXP, the function succeeds and returns an
IntPtr, or handle, to the window I'm looking for. However, when I run the
program in Windows2000, I am constantly receiving a
System.DllNotFo undException: "Unable to load DLL '.\ManipLib.dll ': The
specified procedure could not be found. (Exception from HRESULT: 0x8007007F)."

Now, I know the working directory contains the DLL that I have created, for
just prior to making my extern-call, I do a
MessageBox.Show (System.IO.Dire ctory.GetCurren tDirectory()); This shows my
current working directory correctly, which the directory also contains my
ManipLib.dll. As soon as I hit "OK," the exception is thrown as it tries to
call my DLL method.

What would make this program work for all versions of XP that I have tried,
but continually fail for every Windows 2000 version? I've tried 4 computers
with Windows 2000, each has SP4. Thank you for your help.
Trecius
Oct 31 '08 #1
1 3021
Not sure what's the issue here. Seems that there is difference in the
way the files are searched.

Try to use this (Remove ".\" before the dll's name)

[System.Runtime. InteropServices .DllImport(@"Ma nipLib.dll", CharSet =
System.Runtime. InteropServices .CharSet.Unicod e)]

-
Ashutosh

Trecius wrote:
Hello, Newsgroupians:

I have created an unmanaged DLL using Visual Studio 2005, which was created
in Visual C++. I have some functions in the DLL that I am trying to call.
When I "dumpbin -exports ManipLib.dll" I can see all of my exported
functions, which I have defined in my definition file. They are not name
mangled or decorated.

Now, when I call the function in my C# program, I have the following
definition...

[System.Runtime. InteropServices .DllImport(@".\ ManipLib.dll", CharSet =
System.Runtime. InteropServices .CharSet.Unicod e)]
public static extern IntPtr UserFindWindowW (string lpszWndClass);

All UserFindWindowW does is call FindWindowEx(). Now, I know I can import
the user32.dll instead of this, but I have some other methods later that wrap
functionality of what I am going to do to the window, so this is just my base
case, and it doesn't work in Windows 2000.

When I run the program in WindowsXP, the function succeeds and returns an
IntPtr, or handle, to the window I'm looking for. However, when I run the
program in Windows2000, I am constantly receiving a
System.DllNotFo undException: "Unable to load DLL '.\ManipLib.dll ': The
specified procedure could not be found. (Exception from HRESULT: 0x8007007F)."

Now, I know the working directory contains the DLL that I have created, for
just prior to making my extern-call, I do a
MessageBox.Show (System.IO.Dire ctory.GetCurren tDirectory()); This shows my
current working directory correctly, which the directory also contains my
ManipLib.dll. As soon as I hit "OK," the exception is thrown as it tries to
call my DLL method.

What would make this program work for all versions of XP that I have tried,
but continually fail for every Windows 2000 version? I've tried 4 computers
with Windows 2000, each has SP4. Thank you for your help.
Trecius
Nov 2 '08 #2

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

Similar topics

2
2366
by: Paul Duncan | last post by:
diggityduncs (Programmer) Nov 13, 2003 Hello, I'm tring to use a win32/api dll in c# The vendor I received the dll from doesn't know anything about .net I received two files ACGAPI.DLL +
15
4469
by: Jim | last post by:
I am extremely frustrated. I am building c# application for a call center and am using a third party API to access some hardware. When develop and test my class using the windows console the application runs flawlessly, but once I call the class from inside a c# windows application the program freezes, crashes etc... there must be a way to make this work inside a windows app as it run great as a command line app.
2
2422
by: pnp | last post by:
Hi all, i'm having a problem using DllImport with Win98. It works just fine with XP & 2000 but in 98 it prompts: "Unable to find xxxxx.dll". Any ideas? error is: System.DllNotFoundException: Unable to load DLL (etc\fectfmn.dll). Peter
1
4352
by: Whidbey Wave | last post by:
Hi , Of course sometimes, some of us have these weird DLLImport issues. I am using Net-snmp library from http://www.net-snmp.org. While creating a prototype as console application it worked fine, but as windows application it fails to respond correctly. Verified by sniffer, the windows app does not even reaches TCP/IP network layer, and it returns no error. The function which I imported from this library are: init_snmp, snmp_set and...
2
3699
by: | last post by:
Hi everyone, Can you have a quick look and tell me why the caret is not shown , any help will be greatly appreicated thank you. using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms;
2
10483
by: Brian Anderson | last post by:
Hello, is it possible to use DllImport to call a DLL in ASP.NET ? Or is it necessarry that my DLL has to be copied into \System32 ? My DLL is a native C++ 7.1 DLL (not managed, no COM, no regsvr32) and uses Assembler to make some math in SSE. The result is given out as an Int. Using a C# console app (code below) it work fine & fast.
0
1712
by: Nelson R. | last post by:
Greetings, I've already posted this message on aspnet.security group (think its related to security issues), but since didn't get any response, I post it here. -- I have a problem, and been around it for some days without finding a solution. I have an aspnet 1.1 application that works perfectly on Windows XP, Windows
1
4283
by: kardon33 | last post by:
Let me explain my problem, Im currently trying to use a Perl module that was built for a Windows OS that uses a .dll and .lib file. I have obtained the c header files that the modules were built with. I am trying to use SWIG to write my Perl mod with those files but I getting a bunch of errors with the "extern "C" __declspec(dllimport)" command kinda know that basics of the command, its used to declare vars from a .dll. If im wrong please...
0
1147
by: tomb | last post by:
Can anybody help me by checking if I have correct call signatures? In my C# Windows Form project (VS2008) I am using dll which has been written for Visual C++ 6.0: This function code is used to start receive active message of ioLogik 2000 Ethernet Module: C/C++ int Message2K_Start(  int iProtocol, WORD wPort, pfnCALLBACK& iProcAddress);
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10274
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10033
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7576
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.