473,809 Members | 2,780 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.dl l" 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.Collecti ons.Generic;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Windows. Forms;
using System.Runtime. InteropServices ;
using System.Data;
#endregion

[StructLayout(La youtKind.Sequen tial)]
public struct DOCINFO
{
[MarshalAs(Unman agedType.LPWStr )]
public string pszSchema;
[MarshalAs(Unman agedType.LPWStr )]
public string hr;
[MarshalAs(Unman agedType.LPWStr )]
public string pDataType;
}
namespace PInvoKe1
{
partial class Form1 : Form
{
public Form1()
{
InitializeCompo nent();
}

private void button1_Click(o bject sender, EventArgs e)
{

string str1;

DOCINFO di = new DOCINFO();

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

}
}

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

[DllImport("bidi spl.dll")]
public static extern void SetSchema(strin g Param);

// hr = CoInitialize (NULL);
}

public class TestPInvoke
{

}
}

Thanks for your help!
Trint

Nov 16 '05 #1
5 3718
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.M essageBox.Show( )
instead of P/Invoking directly to the Win32 equivalent.

--Bob
"trint" <tr***********@ gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I know that this function IS in this dll that comes with windows xp
that allows bidirectional printing (you can search "bidispl.dl l" 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.Collecti ons.Generic;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Windows. Forms;
using System.Runtime. InteropServices ;
using System.Data;
#endregion

[StructLayout(La youtKind.Sequen tial)]
public struct DOCINFO
{
[MarshalAs(Unman agedType.LPWStr )]
public string pszSchema;
[MarshalAs(Unman agedType.LPWStr )]
public string hr;
[MarshalAs(Unman agedType.LPWStr )]
public string pDataType;
}
namespace PInvoKe1
{
partial class Form1 : Form
{
public Form1()
{
InitializeCompo nent();
}

private void button1_Click(o bject sender, EventArgs e)
{

string str1;

DOCINFO di = new DOCINFO();

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

}
}

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

[DllImport("bidi spl.dll")]
public static extern void SetSchema(strin g 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***********@g mail.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.goo glegroups.com.. .
I know that this function IS in this dll that comes with windows xp
that allows bidirectional printing (you can search "bidispl.dl l" 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.Collecti ons.Generic;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Windows. Forms;
using System.Runtime. InteropServices ;
using System.Data;
#endregion

[StructLayout(La youtKind.Sequen tial)]
public struct DOCINFO
{
[MarshalAs(Unman agedType.LPWStr )]
public string pszSchema;
[MarshalAs(Unman agedType.LPWStr )]
public string hr;
[MarshalAs(Unman agedType.LPWStr )]
public string pDataType;
}
namespace PInvoKe1
{
partial class Form1 : Form
{
public Form1()
{
InitializeCompo nent();
}

private void button1_Click(o bject sender, EventArgs e)
{

string str1;

DOCINFO di = new DOCINFO();

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

}
}

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

[DllImport("bidi spl.dll")]
public static extern void SetSchema(strin g 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( ClassInterfaceT ype.None)
]
public class BidiSplClass
{
}

[
ComImport,
Guid("D580DC0E-DE39-4649-BAA8-BF0B85A03A97"),
InterfaceType(C omInterfaceType .InterfaceIsIUn known)
]
public interface IBidiSpl
{
void BindDevice([In, MarshalAs(Unman agedType.LPWStr )] string
pszDeviceName, int dwAccess);
void UnbindDevice();
void SendRecv([MarshalAs(Unman agedType.LPWStr )] string pszAction, .....);
void MultiSendRecv([MarshalAs(Unman agedType.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***********@g mail.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***********@g mail.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
3488
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 Pentagjetvedeh karuvificials madhla reachathe strategy in karkun campaign deshatinst terrorism. "mudivae maretu winning or losing karkun global varti jetvedeh terror?" Mr. Rumsfeld adugued in a recent memormariyuum. vede velli jetvedeh madhla...
3
2237
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 after that spot is found. Well, I am kinda lost on this finding things in a vector. I mean, wouldn't you just go to vector, and then ....well then I gotta find out how to do an insert in a vector. Does this involve changing the pointer to point...
2
1633
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 programming concepts (am trying to learn) and XML serialization is all new ground for me. Anyway, here is what I am trying to accomplish: Goal ---- We sponsor competitions in ehich various teams compete. An "event" is made up of a set of "shows"....
3
7648
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 added an unbound text field with lable and a command button. The following code is in the On Click event of the Command button. Private Sub Button197_Click() On Error GoTo Err_Button197_Click Dim strWhere As String
3
1479
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 for a database driven web site, just for data entry. Could someone point me in the right direction. Any help is appreciated.
4
9324
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 function `pop': temp2.c:24: warning: initialization from incompatible pointer type temp2.c:25: warning: assignment from incompatible pointer type temp2.c: In function `destroy': temp2.c:38: error: dereferencing pointer to incomplete type
2
2116
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 table, the contents of which are dynamic. there can be any number of rows in this table - somewhere between 50 and 500 would be the range. in each row - there can be any number of td's. the relative 'width' of a td in a tr is specified by a td's...
4
2263
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 which can then be divided by the length of the moving average. The data series will be gaining a new value every x amount of time t so the average has to be made from the last added value. And i also need a way to use this same moving average but...
19
1995
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 joint the two table fields in a query "qrysg" and from that query i have made a form. Now the problem is that whenever i put a new record in the form, (i just fill up the employee's Table fields and leave the Training's Table fields empty for the...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10376
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...
1
10387
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9200
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
7662
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
6881
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
5550
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
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.