473,383 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Help with finding entry point (

I know that this function IS in this dll that comes with windows xp
that allows bidirectional printing (you can search "bidispl.dll" on
MSDN). However, I keep getting the same error all day, go to bed, get
up, get the same error over and over.
PLEASE Help! Here is the code and I'm just trying to get the FIRST
function to work and there are three more:
IBidiRequest Methods
Method - Description
SetSchema Sets the bidi schema string.
SetInputData Sets the data to send to the device.
GetResult Gets the result code.
GetOutputData Gets the output data coming back from the device.
GetEnumCount Gets the number of output items.

#region Using directives

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Data;
#endregion

[StructLayout(LayoutKind.Sequential)]
public struct DOCINFO
{
[MarshalAs(UnmanagedType.LPWStr)]
public string pszSchema;
[MarshalAs(UnmanagedType.LPWStr)]
public string hr;
[MarshalAs(UnmanagedType.LPWStr)]
public string pDataType;
}
namespace PInvoKe1
{
partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{

string str1;

DOCINFO di = new DOCINFO();

string shipping1 = (@"\\Web1\Shipping1");
str1 = shipping1;
Win32.SetSchema(str1);
// Win32.MsgBox(0, "", str1, 0);
// Win32.MsgBox(0, hPrinter, str1, 0);

}
}

public class Win32
{
[DllImport("User32.dll", EntryPoint = "MessageBox",
CharSet = CharSet.Auto)]
public static extern int MsgBox(int hWnd, String text, String
caption, uint type);

[DllImport("bidispl.dll")]
public static extern void SetSchema(string Param);

// hr = CoInitialize (NULL);
}

public class TestPInvoke
{

}
}

Thanks for your help!
Trint

Nov 16 '05 #1
5 3690
Trint,

I have no experience with this particular DLL, but two resources that I've
found helpful for P/Invoke work are:

www.pinvoke.net

.... and the book, ".NET and COM -- The Complete Interoprability Guide" (SAMS
Publishing -- by Adam Nathan)

For anyone to give you specific help you're going to need to indicate
exactly what error you get, and where. But as an offhand observation, I
don't see where you're actually passing the DOCINFO struct to anything, or
populating it or using it in any way beyond declaring it, so I have some
doubt that you understand how to call these functions in the first place.

By the way, P/Invoke is for when you don't have a managed class that already
wraps Win32 functionality. So just use Windows.Forms.MessageBox.Show()
instead of P/Invoking directly to the Win32 equivalent.

--Bob
"trint" <tr***********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I know that this function IS in this dll that comes with windows xp
that allows bidirectional printing (you can search "bidispl.dll" on
MSDN). However, I keep getting the same error all day, go to bed, get
up, get the same error over and over.
PLEASE Help! Here is the code and I'm just trying to get the FIRST
function to work and there are three more:
IBidiRequest Methods
Method - Description
SetSchema Sets the bidi schema string.
SetInputData Sets the data to send to the device.
GetResult Gets the result code.
GetOutputData Gets the output data coming back from the device.
GetEnumCount Gets the number of output items.

#region Using directives

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Data;
#endregion

[StructLayout(LayoutKind.Sequential)]
public struct DOCINFO
{
[MarshalAs(UnmanagedType.LPWStr)]
public string pszSchema;
[MarshalAs(UnmanagedType.LPWStr)]
public string hr;
[MarshalAs(UnmanagedType.LPWStr)]
public string pDataType;
}
namespace PInvoKe1
{
partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{

string str1;

DOCINFO di = new DOCINFO();

string shipping1 = (@"\\Web1\Shipping1");
str1 = shipping1;
Win32.SetSchema(str1);
// Win32.MsgBox(0, "", str1, 0);
// Win32.MsgBox(0, hPrinter, str1, 0);

}
}

public class Win32
{
[DllImport("User32.dll", EntryPoint = "MessageBox",
CharSet = CharSet.Auto)]
public static extern int MsgBox(int hWnd, String text, String
caption, uint type);

[DllImport("bidispl.dll")]
public static extern void SetSchema(string Param);

// hr = CoInitialize (NULL);
}

public class TestPInvoke
{

}
}

Thanks for your help!
Trint

Nov 16 '05 #2
Bob,
Thanks for your response...I'm looking at pinvoke.net right now. The
main thing is, I'm just trying to find a way to wrap bidispl.dll. If
you get some time, could you please take a look at this? It exists in
the system32 directory of xp (all versions, I think). I'm just
dumbfounded on how to get it to work at all...any help is very
appreciated.
Thanks,
Trint

Net programmer
tr***********@gmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3

"trint" <tr***********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I know that this function IS in this dll that comes with windows xp
that allows bidirectional printing (you can search "bidispl.dll" on
MSDN). However, I keep getting the same error all day, go to bed, get
up, get the same error over and over.
PLEASE Help! Here is the code and I'm just trying to get the FIRST
function to work and there are three more:
IBidiRequest Methods
Method - Description
SetSchema Sets the bidi schema string.
SetInputData Sets the data to send to the device.
GetResult Gets the result code.
GetOutputData Gets the output data coming back from the device.
GetEnumCount Gets the number of output items.

#region Using directives

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Data;
#endregion

[StructLayout(LayoutKind.Sequential)]
public struct DOCINFO
{
[MarshalAs(UnmanagedType.LPWStr)]
public string pszSchema;
[MarshalAs(UnmanagedType.LPWStr)]
public string hr;
[MarshalAs(UnmanagedType.LPWStr)]
public string pDataType;
}
namespace PInvoKe1
{
partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{

string str1;

DOCINFO di = new DOCINFO();

string shipping1 = (@"\\Web1\Shipping1");
str1 = shipping1;
Win32.SetSchema(str1);
// Win32.MsgBox(0, "", str1, 0);
// Win32.MsgBox(0, hPrinter, str1, 0);

}
}

public class Win32
{
[DllImport("User32.dll", EntryPoint = "MessageBox",
CharSet = CharSet.Auto)]
public static extern int MsgBox(int hWnd, String text, String
caption, uint type);

[DllImport("bidispl.dll")]
public static extern void SetSchema(string Param);

// hr = CoInitialize (NULL);
}

public class TestPInvoke
{

}
}

Thanks for your help!
Trint


I told you before you CAN'T call these functions using PInvoke, they are no
exported C-style functions, these are COM (IUnknown) interface methods, so
you have to create an instance of the COM object before you can call them.
There is no typelib nor an IDL file available, so you can't build an interop
assembly either, so they are meant to be used from C/C++.
While you can handcraft the COM interop signatures yourself [1], your best
option is to write a Wrapper using MC++.

[1] Here is what I mean... Note that this is only an incomplete, untested
sample of one of the interfaces, just to give you an idea of what should be
done.
The interface description is taken from the bidispl.h header file.
[
ComImport,
Guid("D580DC0E-DE39-4649-BAA8-BF0B85A03A97"),
CoClass(typeof(BidiSplClass))
]
public interface BidiSpl: IBidiSpl
{
}

[
ComImport,
Guid("2A614240-A4C5-4c33-BD87-1BC709331639"),
ClassInterface(ClassInterfaceType.None)
]
public class BidiSplClass
{
}

[
ComImport,
Guid("D580DC0E-DE39-4649-BAA8-BF0B85A03A97"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown )
]
public interface IBidiSpl
{
void BindDevice([In, MarshalAs(UnmanagedType.LPWStr)] string
pszDeviceName, int dwAccess);
void UnbindDevice();
void SendRecv([MarshalAs(UnmanagedType.LPWStr)] string pszAction, .....);
void MultiSendRecv([MarshalAs(UnmanagedType.LPWStr)] string pszAction,
......);
}
.....

......
Willy.
Nov 16 '05 #4
Willy,
Does that mean that I have to rewrite my entire project in C++?
Thanks,
Trint

..Net programmer
tr***********@gmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #5
Willy,
I got it to work by creating an ALT OBJ as a proxy between the c# app
and the bidispl.dll. You were right. There was no other way.
Thanks,
Trinity

..Net programmer
tr***********@gmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #6

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

Similar topics

0
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed...
3
by: KL | last post by:
Well, I am back. This time our assignment has us filling a vector and then timing how long it takes to find a spot in the vector to insert a new item, and the time required to insert the item...
2
by: Wayne Wengert | last post by:
This is my first attempt to re-write an old VB6 application that exported a CSV file to a .NET application that exports an XML file with the equivelent data. I have limited understanding of OO...
3
by: DC | last post by:
I need help. I've confused myself with all of the things I've tried. I'm trying to modify the exiting Contacts template in Access 2000 to include a search option. To the Contact Entry form I've...
3
by: bpn | last post by:
I have a Microsoft Access database on a web server that supports Access databases. All I want to do is have a couple of users be able to enter data into the database via a browser. This is not...
4
by: Allan M. Bruce | last post by:
I have a small implementation of a queue which I am trying to get to compile but cant figure out why it doesnt work. I have copied the minimum compilable code below. On gcc I get temp2.c: In...
2
by: Dave Ekhaus | last post by:
hi i'm new to javascript. i'm hoping to get some help and find out if what i want to do is possible and - assuming it is, get some tips on how to accomplish the task. ok - assume i have a...
4
by: =?Utf-8?B?YjF1Y2VyZWU=?= | last post by:
Hi, still very new to programming but am a little stumped by how to do this idea i have. I need to make a moving average which takes every nth value in a data series to build a running total...
19
peeaurjee
by: peeaurjee | last post by:
hi Its my first post to e-scripts. i hope i will get help soon for my problem. I have 2 tables Employees and the second one is Training. The relation between them is 1 to 1. i have...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

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.