Click here to Skip to main content
15,885,216 members
Home / Discussions / C#
   

C#

 
GeneralRe: Make a method return different types/classes depending on in-parameters Pin
Pete O'Hanlon2-Apr-08 22:32
mvePete O'Hanlon2-Apr-08 22:32 
GeneralRe: Make a method return different types/classes depending on in-parameters Pin
arnold_w3-Apr-08 1:17
arnold_w3-Apr-08 1:17 
GeneralC# HTTP request/response Pin
George_George2-Apr-08 2:02
George_George2-Apr-08 2:02 
GeneralCrystal reports how to suppress a section programmatically Pin
NewToAspDotNet2-Apr-08 1:49
NewToAspDotNet2-Apr-08 1:49 
QuestionHow to deserialize the object saved in project1 in another assembly project2? Pin
Chesnokov Yuriy2-Apr-08 1:41
professionalChesnokov Yuriy2-Apr-08 1:41 
GeneralRe: How to deserialize the object saved in project1 in another assembly project2? Pin
Simon P Stevens2-Apr-08 3:34
Simon P Stevens2-Apr-08 3:34 
GeneralRe: How to deserialize the object saved in project1 in another assembly project2? Pin
Giorgi Dalakishvili2-Apr-08 4:01
mentorGiorgi Dalakishvili2-Apr-08 4:01 
Generalproblem width Advantech PCI-1730 digital IO card [modified] Pin
arturw822-Apr-08 1:14
arturw822-Apr-08 1:14 
I want read digital input status from Advantech PCI card,
but I have error like this:
"System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

//My Device configuration******************
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSDAQ]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSDAQ\Device000]
"DeviceName"="PCI-1730 SwitchID=0 I/O=5000H"
"DriverName"="ADS1730.dll"
"KernelKey"="ADS1730S"
"BoardID"=dword:00000087

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSDAQ]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSDAQ\Device000]
"DeviceName"="PCI-1730 SwitchID=0 I/O=5000H"
"DriverName"="ADS1730.dll"
"KernelKey"="ADS1730S"
"BoardID"=dword:00000087

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADS1730S]
"Type"=dword:00000001
"Start"=dword:00000002
"Group"="Extended Base"
"ErrorControl"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADS1730S\Device000]
"DeviceName"="PCI-1730 SwitchID=0 I/O=5000H"
"DriverName"="ADS1730.dll"
"KernelKey"="ADS1730S"
"BaseAddress"=dword:00005000
"BoardID"=dword:00000087
"SwitchID"=dword:00000000
"AllowConflicts"=dword:00000001
"Interrupt"=dword:00000000
"TimerClock"=dword:0000000a
"OnSystem"=dword:00000001
"BusNumber"=dword:00000000
"SlotNumber"=dword:00000000
"CardNo"=dword:00000000
"Trigger Mode"=dword:01010101

000:


My Code:********************************************************,

//Import dll********************
[DllImport( "adsapi32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi )]
private static extern int DRV_DeviceOpen( int DeviceNum, ref int DeviceHandle );

[DllImport( "adsapi32.DLL", SetLastError = true, CallingConvention = CallingConvention.Winapi )]
private static extern int DRV_DioReadBit( int DriverHandle, ref PT_DioReadBit lpDioReadBit );


[StructLayout( LayoutKind.Sequential )]
public struct PT_DioReadBit
{
public UInt16 port; //USHORT port;
public UInt16 bit; //USHORT bit;
public IntPtr state; //USHORT far *state;
}//PT_DioReadBit, FAR * LPT_DioReadBit;


**********USING********:

int errCde;
int driverHandle = 0;
int deviceNum = 0;

errCde = DRV_DeviceOpen( deviceNum, ref driverHandle );

PT_DioReadBit readBit = new PT_DioReadBit();

readBit.port = 0;
readBit.bit = 0;

errCde = DRV_DioReadBit( driverHandle, ref readBit );

int value = readBit.state.ToInt32();

modified on Wednesday, April 2, 2008 10:06 AM

GeneralRe: problem width Advantech PCI-1730 digital IO card Pin
Dave Kreskowiak2-Apr-08 3:52
mveDave Kreskowiak2-Apr-08 3:52 
GeneralRe: problem width Advantech PCI-1730 digital IO card Pin
arturw822-Apr-08 4:13
arturw822-Apr-08 4:13 
GeneralRe: problem width Advantech PCI-1730 digital IO card Pin
Dave Kreskowiak2-Apr-08 5:00
mveDave Kreskowiak2-Apr-08 5:00 
Generalcrystal reporting with C# Pin
Faysal2-Apr-08 1:12
Faysal2-Apr-08 1:12 
QuestionRe: crystal reporting with C# Pin
Pankaj Garg2-Apr-08 1:18
Pankaj Garg2-Apr-08 1:18 
Generalword Pin
ellllllllie2-Apr-08 1:04
ellllllllie2-Apr-08 1:04 
GeneralRe: word Pin
Pete O'Hanlon2-Apr-08 1:50
mvePete O'Hanlon2-Apr-08 1:50 
GeneralRe: word Pin
ellllllllie2-Apr-08 1:54
ellllllllie2-Apr-08 1:54 
GeneralRe: word Pin
Giorgi Dalakishvili2-Apr-08 4:01
mentorGiorgi Dalakishvili2-Apr-08 4:01 
QuestionSharePoint WebPart TreeView Control Problem Pin
Member 42541792-Apr-08 1:00
Member 42541792-Apr-08 1:00 
Questionexport datatable to .csv format in windows application Pin
sharanabasava2-Apr-08 0:40
sharanabasava2-Apr-08 0:40 
GeneralRe: export datatable to .csv format in windows application Pin
Stu Richardson2-Apr-08 2:09
Stu Richardson2-Apr-08 2:09 
Questionmerging the first line of excel in c# Pin
Pankaj Garg2-Apr-08 0:39
Pankaj Garg2-Apr-08 0:39 
GeneralXml Serialization with C# Pin
RichardContact-12-Apr-08 0:28
RichardContact-12-Apr-08 0:28 
GeneralRe: Xml Serialization with C# Pin
J4amieC2-Apr-08 1:08
J4amieC2-Apr-08 1:08 
QuestionHow do I Clear the contents of my Datagridview Pin
Quinton2-Apr-08 0:25
Quinton2-Apr-08 0:25 
AnswerRe: How do I Clear the contents of my Datagridview Pin
Luc Pattyn2-Apr-08 0:49
sitebuilderLuc Pattyn2-Apr-08 0:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.