I need help with a strange problem.
Symptom: my C# application crashes with a AccessViolationException. The interesting thing is that it happens only when running as 32bit-process on 64-bit Windows. Running 32bit on 32bit works fine, so does 64bit on 64bit.
FxCop does not complain about my P/Invoke declarations, so I don't think I confused IntPtr and int parameters - it runs fine both as 32bit process and 64bit process - just not as 32 bit process on Windows XP Professional x64 Edition.
Using the managed debug assistent in VS05, I get the error message "The runtime has encountered a fatal error. The address of the error was at 0x79fccc04, on thread 0x6c8. The error code is 0xc0000005.".
The line where it's failing is "return CallNextHookEx(...);", the callstack suggests it fails while/after calling CallNextHookEx; not when returning from my own hook procedure. What makes this really interesting is that the code using the hook is working fine until the text-editor portion of the app is activated. It crashes when the hook receives the message caused by activating the IME (input method editor; for asian languages).
Here is the P/Invoke declaration for the hook (I'm creating the hook with code=WH_CALLWNDPROCRET, hInstance=IntPtr.Zero and threadID=AppDomain.GetCurrentThreadId()):
CallNextHookEx[^] definition from MSDN:
LRESULT CallNextHookEx(HHOOK hhk, int nCode, WPARAM wParam, LPARAM lParam);
And here is the P/Invoke declaration for the IME:
private const int WM_IME_CONTROL = 0x0283;
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, [In, MarshalAs(UnmanagedType.LPStruct)] LOGFONT lParam);
[ StructLayout(LayoutKind.Sequential) ]
private class LOGFONT
public int lfHeight = 0;
public int lfWidth = 0;
public int lfEscapement = 0;
public int lfOrientation = 0;
public int lfWeight = 0;
public byte lfItalic = 0;
public byte lfUnderline = 0;
public byte lfStrikeOut = 0;
public byte lfCharSet = 0;
public byte lfOutPrecision = 0;
public byte lfClipPrecision = 0;
public byte lfQuality = 0;
public byte lfPitchAndFamily = 0;
[ MarshalAs(UnmanagedType.ByValTStr, SizeConst=32) ] public string lfFaceName = null;
So, how could I find what the problem is? Are there any other tools for checking such problems? I don't have any idea what can I do now. We need to run as 32bit on 64bit Windows because a library used by another part of the app is available for 32bit only.
What 64-bit dll?
I think I should add that I don't even have an IME installed - just some users of our software have.
All P/Invoke calls are from user32.dll - it uses the 32bit version of that dll. When disabling the IME call (I personally don't need an IME, only some users do), everything works fine.
Hey guys, I have a problem with DataGridView !!!
I have a DataGrid that is binded to a DataSet (MyDS)
and I have some Text boxes that are also binded to the DataSet(Using the below comand), so when I click on any rows in my DataGrid, the data is shown in my text Boxes. dataGrid1.SetDataBinding(myDS, TableName);
It works perfectly.
Now I want to do the same thing with DataGridView, but it doesn't have that command, and i'm stuck !!! I 've been working on it for days but NO LUCK !!!!!!!
Can you please give m a hand ?!
When using WinForms databinding in .NET 2.0, it is recommended to use the new BindingSource[^] component. All of the databound controls on a form should bind to that component. It works very well with the DataGridView as well.
For example, if a user clicks a file highlighting it, or drag selects multiple files, and they did this on the deskop or anywhere in some drive folder, then is their an api or something in .net that can help me figure out the file/s that were selected?
You might want to try overriding OnInsert and OnRemove and unconditionally throw an exception. The designer should catch that exception and display a messagebox to the user after he/she clicks the Add or Remove buttons.
Firstly, is there a way to enumerate the CD and DVD drives in the system? This is the most important question.
Aditionally, if possible I'd like to know whether they support DVD reading, or CDs only, and if possible I'd like to know whether there are CDs or DVDs in the drives. For extra extra coolness, is there a way to know whether a present disk is an Audio CD, a VCD, an SVCD, or a DVD?
When i transfer my c#.net project to other computer,the report part of my project that worked correctly in my computer,did not work and give me this error :
"absolute path information is required"
What is my problem? I use SQL Server database for my reports
I try to create a blank report with no database,but i get this error again.
thanks for your help.