|
The Catalyst wrote:
IntPtr pDC = ThemeAPI.CreateCompatibleDC(IntPtr.Zero);
I dont know much of themes, but why are you passing a "NULL" pointer? Shouldnt you pass this.Handle instead?
top secret
|
|
|
|
|
I figured my origional problem.
But you do still have a good point. Might explain why it's not drawing anything now.
|
|
|
|
|
Hi
I am planning to start a research on Data Mining techniques for Intrusion Detection. It would be very helpful for me if any one of you cna help me in getting the code for some basic algorithms like Apriori, K-Means hierachical clustering, Decision Tree in C# or C++. Please let me know if any body else is in the same field.
my email id is sreelakshmibobba@hotmail.com
Thanks
srilakshmi
|
|
|
|
|
This book is great, and the code is free to download:
Weka.
It's in Java, but it's easy to migrate it to C# (at least, easier than write ) or to compile it in J#.
Perl combines all the worst aspects of C and Lisp: a billion different sublanguages in one monolithic executable. It combines the power of C with the readability of PostScript. -- Jamie Zawinski
|
|
|
|
|
Dear
this is a very important topic and am trying to work on this system for 1 year but i face alot of problem.
the big problem was the Lack of sources
and i depended on C# and SQL 2005 server
i found the same system built in java and oracl
but its very difficult
if you find anything please could you share that with us
thanks brother
|
|
|
|
|
This is the problem/scenario (I hope it makes sense):
I am trying to pass some values from page1.aspx to page2.aspx, NOT with a querystring.
Page1.aspx is code only: no buttons or textboxes. The user will never see page1.aspx.
The values have to be retrieved on page2.aspx, using Request.Form["name"].
So on page1.aspx, I have to ‘submit’ the values to page2.aspx.
There must be some simple way to submit these values from page1.aspx to page2.aspx using C#, but I just don’t see it.
Any help is appreciated!
Thanks.
|
|
|
|
|
You mean you want to submit a form without clicking a button? You can call the __doPostBack client-side function (Javascript) or just use theForm.submit() , although the former is preferred. This is what button clicks, index changes, etc. do on the client-side to post changes back to the server.
Also, if you have questions specific to ASP.NET, you should ask in the ASP.NET forum.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
you could use HttpWebRequest to do a post to a page and then use it's response objecct to retrieve te answer. Not sure what you mean though...
|
|
|
|
|
I am having a problem with using an ocx control in .NET. It works fine in VB 6.0 etc, but I was hoping to use the robust features .NET has over 6.0. My orginal post is here :
http://www.codeproject.com/script/comments/forums.asp?msg=781067&forumid=1646#xx781067xx
The problem breaks down to this - the ocx control is essentially a class with many get methods that access a binary file. Any method which returns a string fail with type mismatch. Here is an example function description in the docs I have:
{EXAMPLE}
GetCreatorID
long GetCreatorID(BSTR FAR* pbstrCreatorID);
Return Value
1 if successful; otherwise, see Error Codes.
Parameters
pbstrCreatorID A valid pointer to a BSTR. This variable must exist and be initialized to NULL.
Remarks
Returns the creator ID. The creator ID is the logon name of the user when the raw file was acquired.
Example
// example for GetCreatorID
BSTR bstrCreatorID = NULL;
long nRet = XRawfileCtrl.GetCreatorID ( &bstrCreatorID );
{END}
I am calling the function in VB .NET like this:
Dim Creator as String
XRawfileCtrl.GetCreatorID(Creator)
This results in a type mismatch
Dim Creator as New StringBuilder()
XRawfileCtrl.GetCreatorID(Creator)
This gives me the error:
Value of type 'System.Text.StringBuilder' cannot be converted to 'String'.
Any method which returns a date, double or int works fine....
any thoughts?
|
|
|
|
|
Use Marshal.StringToBSTR to convert the string to a BSTR , then pass the returned IntPtr to the method. If the parameters is an [in/out] parameters, then use Marshal.PtrToStringBSTR when the method returns to get the string back.
Also, in the future please do not refer to me directly. There's several regulars here that are helpful and could possibly answer your questions too. It's just not very polite.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Sorry Heath! I told him to ask for you because of your in depth knowledge of marshalling...
RageInTheMachine9532
|
|
|
|
|
No problem, really. Just sticking up for the other regulars. I don't want anyone to be offended on my account.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Sorry about the direct request... Dave from the VB forum said to ask you.....
So here is what I am trying:
Dim fName As String
Dim t as String
Dim s As IntPtr
s = System.Runtime.InteropServices.Marshal.StringToBSTR(fName)
XRawfile.GetAcquisitionFileName(s)
t = System.Runtime.InteropServices.Marshal.PtrToStringBSTR(s)
This gives me the error on build that:
Value of type 'System.IntPtr' cannot be converted to 'String'.
This is in regard to calling XRawfile.GetAcquisitionFileName(s)
Also, using the object browser, the method is described like this:
Public Overridable Function GetAcquisitionFileName(ByRef pbstrFileName As String) As Integer
Member of: AxXRAWFILELib.AxXRawfile
|
|
|
|
|
sbeausol wrote:
Dim s as String
Dim t as String
Dim s As IntPtr
You can not declare the same variable as one type and then again with the same name as another type.
- Nick Parker My Blog | My Articles
|
|
|
|
|
|
If the function requires a String as the parameter, then an IntPtr wouldn't work (the function declaration would've been nice the first time, but oh well).
The problem is that the String must be marshaled as a BSTR , which has a different structure. Unless the function declaration uses a MarshalAsAttribute specifying UnmanagedType.BStr , then I'm not really sure how you can do this off the top of my head. Does the function declaration have this? You may need to use ildasm.exe to look at the declaration of the function in IL.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
here is what I get for:
ildasm.exe Interop.XRAWFILELib.dll
one of the function returning a string:
.method public hidebysig newslot virtual
instance int32 GetAcquisitionFileName(string& marshal( bstr) pbstrFileName) runtime managed preservesig internalcall
{
.custom instance void [mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) = ( 01 00 3B 00 00 00 00 00 ) // ..;.....
.override XRAWFILELib._DXRawfile::GetAcquisitionFileName
} // end of method XRawfileClass::GetAcquisitionFileName
here is what I get with:
ildasm.exe AxInterop.XRAWFILELib.dll
method public hidebysig newslot virtual
instance int32 GetAcquisitionFileName(string& pbstrFileName) cil managed
{
// Code size 33 (0x21)
.maxstack 3
IL_0000: ldarg.0
IL_0001: ldfld class [Interop.XRAWFILELib]XRAWFILELib._DXRawfile AxXRAWFILELib.AxXRawfile::ocx
IL_0006: brtrue.s IL_0014
IL_0008: ldstr "GetAcquisitionFileName"
IL_000d: ldc.i4.0
IL_000e: newobj instance void [System.Windows.Forms]System.Windows.Forms.AxHost/InvalidActiveXStateException::.ctor(string,
valuetype [System.Windows.Forms]System.Windows.Forms.AxHost/ActiveXInvokeKind)
IL_0013: throw
IL_0014: ldarg.0
IL_0015: ldfld class [Interop.XRAWFILELib]XRAWFILELib._DXRawfile AxXRAWFILELib.AxXRawfile::ocx
IL_001a: ldarg.1
IL_001b: callvirt instance int32 [Interop.XRAWFILELib]XRAWFILELib._DXRawfile::GetAcquisitionFileName(string&)
IL_0020: ret
} // end of method AxXRawfile::GetAcquisitionFileName
|
|
|
|
|
Using c# here the code I have so far:
int i;
int k;
string sname = null;
System.DateTime dateDate = new DateTime ();
String fileName = "C:\\Documents and Settings\\sean\\desktop\\00600.RAW";
i = XRawfile.Open(fileName);
k = XRawfile.SetCurrentController(0,1);
string fName = null;
int l = XRawfile.GetCreationDate(ref dateDate);
int j = XRawfile.GetAcquisitionFileName(ref fName ); //fails with type mismatch
textBox1.Text = k.ToString();
|
|
|
|
|
Okay, so it is marshaling the string as a BSTR . Good. I don't use VB.NET much, but syntax you'd need to pass is ref myString , which is typically unusual since a string is already a reference type (though immutable), so you don't usually use ref or out . Unfortunately, I don't know of any equivalent keyword to pass a reference to an argument in VB.NET. You may have to use C#, which has support for better memory manipulation. If you want to have just one assembly, you can compile the C# code as a module (not assemly or EXE) and then compile that into the VB assembly using the /addmodule switch on vbc.exe, the VB.NET command-line compiler.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have no problem using C#....
what would my call look like?
|
|
|
|
|
string s = "blah blah blah";
obj.GetAcquisitionFileName(ref s); You could also try using out if ref doesn't work.
Glad to see a VB.NET developer crossing over to the light side...even if only temporary!
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
My C# code:
int i;
int k;
System.DateTime dateDate = new DateTime ();
String fileName = "C:\\Documents and Settings\\sean\\desktop\\00600.RAW";
i = XRawfile.Open(fileName);
k = XRawfile.SetCurrentController(0,1);
string fName = null;
//IntPtr pbString = new IntPtr();
//pbString = Marshal.StringToBSTR(fName);
//fName = pbString.ToString();
int l = XRawfile.GetCreationDate(ref dateDate);
int j = XRawfile.GetAcquisitionFileName(ref fName ); \\fails with type mismatch
textBox1.Text = k.ToString();
|
|
|
|
|
I don't normally do this, but why don't you send me the two interop assemblies using my email address that you can grab off the notificatio message for this post. I'm guessing this is a compile-time error, so I don't need the actual COM dll and you won't loose any trade secrets or anything.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
done
Thanks Again for any help you can offer
|
|
|
|
|
Is nothing saved, or just not the changes?
Microsoft MVP, Visual C#
My Articles
|
|
|
|