473,466 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem using DllImport on DLL that calls a 16-bit app

I am having major problems accessing some API's and I believe the
problem is a 16-bit app.

I originally had an application written in Borland Builder C++ 6
(32-bit)that loaded some API's for a specific database environment I
use. Everything worked great.

I am now trying to do the same thing in C# with the same DLL's but am
having a problem with one API call in particular. To begin using these
API's I have to start the environment by making an Init call. After
this, I can use any of the API calls I want. This Init call is what is
failing. Supposedly this call is responsible for starting up a 16-bit
EXE, which is the database environment. Could the .NET environment be
stopping this 16-bit app from being run from the DLL?

The funny thing is that if I start up my Borland app, and just let it
sit in the background, then I run my C# app, it works great! The Init
routine runs and works and all other calls work great. Obviously it is
because my Borland app has already run this 16-bit app and the C# call
doesn't have to.

Is there any way to force C# to run this 16 bit app from the DLL?

Any help would be greatly appreciated,

Scott

Nov 17 '05 #1
3 1753
Scott,

From what I know, it shouldn't prevent you from running the old 16-bit
application. Is it possible that the borland program performs calls to
initialize the C runtime (I remember something about this when using ATL),
or some other libraries that need to be initialized before the call to Init
is made (calls which would be inserted by default in a Borland app perhaps,
but not by default in .NET).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<sc*************@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
I am having major problems accessing some API's and I believe the
problem is a 16-bit app.

I originally had an application written in Borland Builder C++ 6
(32-bit)that loaded some API's for a specific database environment I
use. Everything worked great.

I am now trying to do the same thing in C# with the same DLL's but am
having a problem with one API call in particular. To begin using these
API's I have to start the environment by making an Init call. After
this, I can use any of the API calls I want. This Init call is what is
failing. Supposedly this call is responsible for starting up a 16-bit
EXE, which is the database environment. Could the .NET environment be
stopping this 16-bit app from being run from the DLL?

The funny thing is that if I start up my Borland app, and just let it
sit in the background, then I run my C# app, it works great! The Init
routine runs and works and all other calls work great. Obviously it is
because my Borland app has already run this 16-bit app and the C# call
doesn't have to.

Is there any way to force C# to run this 16 bit app from the DLL?

Any help would be greatly appreciated,

Scott

Nov 17 '05 #2
Thanks for the reply. I have gone through my Borland app with a fine
tooth comb and still cannot find what would make it any different from
my C# app.

I wonder if there is some sort of Project setting in .NET that I am
missing? It just seems funny that it cannot start the app, yet it can
use its API's no problem. It just pauses for a few seconds before
erroring out so it is obviously trying to start.

For the time being I have written a Borland app to do some interim work
for me. Hopefully I can get this working soon and get rid of the
Borland apps all together.

Thanks,
Scott

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Nov 17 '05 #3
I found the problem! As it turns out, the directory I was creating my
project in is about 4 subfolders under My Documents. This path is way
too long for a 16-bit app. As soon as I moved my EXE out to a shallow
directory, directly under c:\, it worked perfectly!

Thanks for the reply and I hope that this helps someone else out there.

Scott

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Nov 17 '05 #4

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

Similar topics

3
by: Schorschi | last post by:
Can someone please point out why I am getting an 87 error? I am sure it is obvious, but I am new to C# and seem to be having a lot of stress understanding managed versus unmanaged code when API...
3
by: Webdiyer | last post by:
I want to integrate SecurID two-factor authentication system of the RSASecurity.inc into our asp.net application,but I get into trouble when trying to call the API functions of the ACE Agent,I got...
9
by: Ole Christensen | last post by:
I'm trying to make a sort of conditional compilation in my C# code because my app is intended to run on both a Pocket PC and on a normal desktop PC. My code uses a call to an API function that on...
0
by: B Vidyadhar Joshi | last post by:
I'm trying to implement a Bluetooth client application. But I get an error when I try to "bind" the socket created with "socket" function. Here is the code I'm using: public class BTClient {...
0
by: ponchorage | last post by:
I'm trying to read the toc of an audio cd programmatically using the ASPI functions in C#. I've Dllimported the necessary functions. I can get all kinds of information about the drives but I can't...
1
by: Don.Leri | last post by:
Hi, I have a logger.dll (unmanaged c++ dll compiled in vs2005). I have a C# interop to use that dll in managed code implemented in Interfaces.dll (used by other C# dlls). I also have a...
13
by: Javad | last post by:
Hello I know that I should get the information of windows internet connections by using "rasapi32.dll" library, and I also have some sample codes, but I can't make them work. My exact need is to...
3
by: Rene | last post by:
Hello to all! For a long time I have been "fighting" a problem compiling an OpenGL program which uses GLUT. First I have put a question in a Watcom group (I want to use this compiler) to which I...
10
by: =?Utf-8?B?TWF0dA==?= | last post by:
I am using the following code to connect to and download files from an ftp server, but the Symantec anti-virus software on some of my customers machines tells them that their computers are...
1
by: JohnCox | last post by:
I have a simple Win32 DLL I wrote named "SimpleLib" that exports two functions. It is written in C++ and compiled with __stdcall (/Gz) and with the preprocessor definition _MBCS (not Unicode). ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
1
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
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
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
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...
0
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...

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.