Click here to Skip to main content
15,918,258 members
Home / Discussions / C#
   

C#

 
AnswerRe: Oposite / Inverse Color Pin
Guffa5-Nov-06 7:33
Guffa5-Nov-06 7:33 
GeneralRe: Oposite / Inverse Color Pin
Amar Chaudhary5-Nov-06 23:28
Amar Chaudhary5-Nov-06 23:28 
Questionoverride Pin
wanlim08175-Nov-06 5:47
wanlim08175-Nov-06 5:47 
AnswerRe: override Pin
Vega025-Nov-06 9:21
Vega025-Nov-06 9:21 
Questionreading from a file Pin
arjunsasikumar5-Nov-06 4:04
arjunsasikumar5-Nov-06 4:04 
AnswerRe: reading from a file Pin
User 66585-Nov-06 4:44
User 66585-Nov-06 4:44 
AnswerRe: reading from a file Pin
Stefan Troschuetz5-Nov-06 4:44
Stefan Troschuetz5-Nov-06 4:44 
Questiondll AccessViolation Pin
ilmarga5-Nov-06 3:51
ilmarga5-Nov-06 3:51 
Hi,
I have written a program in which I use a dll that is not .NET.
If I use the part of the program that is only .Net, it works fine. Also if I use only the part that uses the dll. BUt if I use in order the .Net part and then the dll, it gives me an AccessViolationException.
This is a MultiThreading Environment.
I modified the prog so the two part doesn't have anything in common, but it didn't help.
So those are the questions:
- Does the FrameWork move objects? So if I register an event in my dll with a reference, it can be not valid after a while?
- How can I get the memory position of an object?

This is part of the class that imports the dll:

[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void SM_MONITOR_PROC(string scanner_id, int evnt, int param);
private delegate void SM_IMAGE_PROC(string scanner_id, int width, int height, System.IntPtr ptrImg, int resolution, int param);
private delegate void SM_STATE_PROC(string scanner_id, int state, int param);

[DllImport("scanman.dll")]
private static extern int SMInitialize();
[DllImport("scanman.dll")]
private static extern int SMFinalize();
[DllImport("scanman.dll")]
private static extern int SMGetScannerCount();
[DllImport("scanman.dll")]
private static extern int SMGetScannerId(int index,System.Text.StringBuilder id, int len);
[DllImport("scanman.dll")]
private static extern int SMStartCapturing(string scanner_id, SM_IMAGE_PROC image_proc, SM_STATE_PROC state_proc, int param);
[DllImport("ssl.dll")]
private static extern int UseDirectCallbacks(int use);
[DllImport("scanman.dll")]
private static extern int SMStopCapturing(string id);


Then I associate a function with the event SM_IMAGE_PROC like this:

SMStartCapturing(ID, new SM_IMAGE_PROC(image2), new SM_STATE_PROC(state), 0);

- The last thing is: I'm using this structure:
Main Class -> ClassManager
-> ChildClass

When I create the childClass, I pass to it the ClassManager instance, so then it can use some methods that I need from there.
What I'm thinking of is that somehow the position of ClassManager changes and ChildClass tries to get the old reference.

Any Idea?
or Any Idea of where else Can I look for an answer?

AnswerRe: dll AccessViolation Pin
Rob Graham5-Nov-06 5:09
Rob Graham5-Nov-06 5:09 
Questionsend and recieve bytes Pin
HRiazi5-Nov-06 3:20
HRiazi5-Nov-06 3:20 
AnswerRe: send and recieve bytes Pin
mertkan656-Nov-06 4:34
mertkan656-Nov-06 4:34 
QuestionGenerics/Collections return a specific object Pin
I_thought5-Nov-06 3:04
I_thought5-Nov-06 3:04 
AnswerRe: Generics/Collections return a specific object Pin
I_thought5-Nov-06 6:15
I_thought5-Nov-06 6:15 
AnswerRe: Generics/Collections return a specific object Pin
Judah Gabriel Himango5-Nov-06 12:26
sponsorJudah Gabriel Himango5-Nov-06 12:26 
Questionplz help: how can i open mht file in windows based form with C# Pin
mohamed magdi ali4-Nov-06 21:47
mohamed magdi ali4-Nov-06 21:47 
Questioncontrol . cs-->.dll Pin
rzvme4-Nov-06 21:31
rzvme4-Nov-06 21:31 
AnswerRe: control . cs-->.dll Pin
Stefan Troschuetz4-Nov-06 22:19
Stefan Troschuetz4-Nov-06 22:19 
AnswerRe: control . cs-->.dll Pin
Amar Chaudhary5-Nov-06 23:35
Amar Chaudhary5-Nov-06 23:35 
QuestionPlease HELP :: webbrowser within background worker [modified] Pin
Nadia Monalisa4-Nov-06 20:50
Nadia Monalisa4-Nov-06 20:50 
AnswerRe: Please HELP :: webbrowser within background worker Pin
Stefan Troschuetz4-Nov-06 22:28
Stefan Troschuetz4-Nov-06 22:28 
AnswerRe: Please HELP :: webbrowser within background worker Pin
Bradml5-Nov-06 0:46
Bradml5-Nov-06 0:46 
AnswerRe: Please HELP :: webbrowser within background worker Pin
mertkan656-Nov-06 21:10
mertkan656-Nov-06 21:10 
QuestionHow can I replace all occurance of a string except when it's enclosed with a special tag? Pin
AngryC4-Nov-06 17:59
AngryC4-Nov-06 17:59 
AnswerRe: How can I replace all occurance of a string except when it's enclosed with a special tag? Pin
wajih.boukaram4-Nov-06 20:11
wajih.boukaram4-Nov-06 20:11 
AnswerRe: How can I replace all occurance of a string except when it's enclosed with a special tag? Pin
Nadia Monalisa4-Nov-06 21:10
Nadia Monalisa4-Nov-06 21:10 

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.