|
Does anyone know what happened to UnmanagedType.LPVoid in beta 2. After spending many hours/frustration trying to figure it out I concluded its not in beta 2. Though it was in an earlier version, an example on CP even uses it. The only reference I found on MSDN was here
Hmmm, I wonder if it was replaced by something else or something...
|
|
|
|
|
Try using IntPtr instead.
|
|
|
|
|
I tried using IntPtr using several tricks none of which works. What I am trying to do is call a win32 api, using C#. I did what I wanted easily in managed C++ with the features I wanted, though I thought it would be better if I can get it in the same project and hence use C# rather than using an external dll.
Lets take an example NetServerEnum, which I adapted from here to use beta2:
--------------
[DllImport("netapi32.dll")]
unsafe private static extern uint NetServerEnum(
[MarshalAs(UnmanagedType.LPWStr)] string ServerName,
uint level,
//In my test I try to change this next line
//with something appropriate, though no LPVoid
//I tried some of the other types with no
//success
[MarshalAs(UnmanagedType.LPVoid)]uint* bufptr, uint prefmaxlen,
ref uint entriesread,
ref uint totalentries,
uint servertype,
[MarshalAs(UnmanagedType.LPWStr)] string domain,
uint resume_handle);
--------------
At the end of the day I get one of two results depending how I approach it.
A.It compiles, but the function returns error 87 which stands for 'The parameter is incorrect.'
B.An exception
--------------
Unhandled Exception: System.Runtime.InteropServices.MarshalDirectiveException: C
annot marshal parameter #3: Invalid managed/unmanaged type combination pointers must be paired with LPVoid).
--------------
I made a managed C++ component to do what I want(didn't take more than a couple of minutes), but was trying to compact things by not using managed C++ if I don't have. And since something similar was done in beta1 I was thinking it should be easily done in beta2, though I am not sure what I am overlooking here.
Thanks.
|
|
|
|
|
I think you'd want to define the bufptr parameter as:
ref IntPtr bufptr
With your current code, you're just passing a pointer, rather than a reference to a pointer. Once you get the IntPtr out, it's fairly easy to cast it to whatever pointer type you want.
|
|
|
|
|
Thanks.
Thats the way I tried it, though something you said made me think about the size and hence error 87. I tried a couple of pointer tricks and it worked! Again thanks for the tip on the change from LPVoid to IntPtr(If it was indeed a change )
|
|
|
|
|
how do i make it so if im making like an output box, like the old Debug window, where i can print stuff like, "Opening File...", "Transfering Data..." and stuff like that, how do i enter to a new line...like hitting the 'ENTER' key...i know in VB6.0 it is vbclrf or wuteva but wut is it in c#?
|
|
|
|
|
ooh ooh i know i know!!, oh wait, im answering my own question
you declare to chars with hexadecimal code:
char charreturn = '\u000D' //0 = Zero
char linefeed = '\u000A' //0 = Zero
textBox1.Text = textBox1.Text + charreturn + linefeed + "Your statement!"
hehe, sometimes i make myself laugh, other time i hit myself cause im stupid!;P
|
|
|
|
|
In my application, it needs a dialog of folder selection. Are there a predefined dialog in Windows 2000?
Sorry, I am a beginner of Windows Application Programmer.
|
|
|
|
|
opendialog opnfile=new opendialog();
opnfile.filte=....
opnfile.text=....(sorry,I don't remember,please youself look for it in MSDN)
if (opnfile.0k=...)
{
string filename=opnfile.filename;
}
hope this helps!
regards
Iverson
|
|
|
|
|
In C#, i used a BrowseforPath() function in Shell32.dll.
The Internet Give a Chance to Learn. I Do!
|
|
|
|
|
I’m trying to mimic the functionality of the Visual Studio.NET Start Page. I’d like to be able to create hyperlinks to recently used projects and create buttons that will invoke an OpenFileDialog or other dialogs. Right now, I have an Internet Explorer ActiveX control in a Windows Form. Somehow, I need to call member functions of the parent form from within an HTML document (or at least it seems to me that that’s what I need to do).
I was looking in MSDN and I found the IDocHostUIHandler interface that has a GetExternal function. GetExternal returns an IDispatch pointer which I think (hope) will allow an HTML document to interface to the parent form via IDispatch’s Invoke method.
It looks like this may provide the functionality I’m looking for, but I can only find how to implement it in C++. Does anybody know how to do this in C# (or any .NET language)?
Or, if you’ve done something like this in C++, let me know if I’m on the right track here.
Thanks.
Stephen
|
|
|
|
|
Hi people !,
help please !! how can you facilitate Web Service to Windows Forms communication ? (or at the least, what's it called ?)
what i mean is, suppose you invoke a Web Service function that should update a TextBox on separate Windows Forms application . they are both on the same machine.
thanks ! any help would be greatly appreciated !!!!
|
|
|
|
|
Hi there,
I have never even touched C# yet, but I can see that in the next few months I will.
I was wondering whether an application written in C#, will work on old windows environment or whether it's only for the .NET environment and XP?
thanks
|
|
|
|
|
yes it will, because i installed it on my computer and i have made programs in C# that ran on winME...but then again, XP is based off NT and 2000 and ME...so i dunno...what is XP based off of lol, i wasnt sure if im correct on that...yea, ill shut up now
|
|
|
|
|
you can install the .NET redistributable on the target machines....[approx-17 MB download]
then all your .NET apps will work....
Nish
|
|
|
|
|
Where can I find an estimated number of C# developers?
|
|
|
|
|
Hi all,
I'm creating an application in which I have 2 forms that are side by side. When one moves one form, the other form also moves keeping the exact distance between the two forms (i.e. move in parallel). I'm looking for some insight into how to do this. I was thinking of grabing the main forms position on the screen and adjusting the second window according.
2 question:
1. Is this the right approach?
2. How does one determine the position of a window on the screen?
|
|
|
|
|
How do I write httpwebrequest and response to list the folders in exchange 2000 server using WebDAV protocol?
Thanks,
Hardik
|
|
|
|
|
Hi,
Could you get a solution?
If you did, can you please explain it to me?
thanks
krishna
|
|
|
|
|
When can I make a .NET Windows appplication and be sure people can run it every on Windows.
Thx
ICQ#84516148
|
|
|
|
|
I need to get keystrokes and save them to a file, how is this done. (Like a logger)
"To wonder is to begin to understand"
|
|
|
|
|
key strokes as in the key's ASCII code>? oops forget the
|
|
|
|
|
Can anybody explain or point me to some sample code how to use the NotifyIcon class in C#? My main goal is to get my dialog app to minimize to the systray. The documentation in the SDK shows *no* sample code that I can find.
__________________________
do {
cout << "I will never use = when I mean == " << endl;
cout << "I will never use = when I mean == " << endl;
} while (i = 1)
|
|
|
|
|
Here are a few examples that use the system tray:
http://www.gotdotnet.com/userarea/keywordsrch.aspx?keyword=system%20tray
|
|
|
|
|
Thanks Eric. Finding good C# help in forums is pretty difficult. The documentation is great for most things but its hard to piece things together sometimes. The gotdotnet.com site has been the best thing that I have found so far.
Still wish I knew of a forum that was pretty active.
__________________________
do {
cout << "I will never use = when I mean == " << endl;
} while (i = 1)
|
|
|
|