|
||
|
|
#1 (permalink) |
|
Master of the Internet
Join Date: Feb 2004
Location: NC/NC State Univ
Age: 23
Posts: 16,424
|
Oh joy.
@ work, they want me to make a program that jumps on rasapi32.dll (unmanaged C code), and dials numbers. rasapi is the thing that makes dial-up networking work. Same as rasdial. So, if any of you can give me pointers on how to work with unmanaged stuff (ya, P/Invoke & COM stuff...but...meh) that'd be great. Sorry for the vagueness. Very tired.
__________________
Goodbye, folks. |
|
|
|
|
|
#3 (permalink) |
|
Master of the Internet
Join Date: Feb 2004
Location: NC/NC State Univ
Age: 23
Posts: 16,424
|
Yeah, I read that fun little blurb. Already using significant portions (all) of it. (Thanks, though.)
How does one do a callback from C to C#? I understand delegates in C# well enough to do one, but I've never tried to make unmanaged code that I can't touch call managed code... So yeah. My extra-kludgy workaround is to grab rasdial.exe and throw command line args at it. Not terribly happy with that..
__________________
Goodbye, folks. Last edited by TMSTKSBK; 07-25-2007 at 12:47 AM. |
|
|
|
|
|
#4 (permalink) | |||
|
ConnectUO Creator
Join Date: Jan 2004
Age: 27
Posts: 4,825
|
Quote:
Heres a greate example. pinvoke.net: CopyFileEx (kernel32) CopyFileEx requires a callback, as it is an asynchronis method. Basically, find out all the arguments the callback needs, create the delegate for it using these arguments and feed it to the invoked method. Pretty much works the exact same way it works creating a callback C#->C# . On Microsofts page about this function found here they describe the delegate as such Quote:
Quote:
http://msdn2.microsoft.com/en-us/library/aa377039.aspx RasDialFunc1 (Windows) RasDialFunc2 (Windows) I would assume you can just create delegates that manage this, Or and this may be your better bet, just create a wrapper to invoke these.
__________________
Jeff Boulanger ConnectUO - Core Developer Want to help make ConnectUO better? Click here to submit your ideas/requests Use your talent to compete against other community members in RunUO hosted coding competitions If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team. Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO Last edited by Jeff; 07-25-2007 at 11:10 AM. |
|||
|
|
|
|
|
#6 (permalink) |
|
ConnectUO Creator
Join Date: Jan 2004
Age: 27
Posts: 4,825
|
Your really thinking about it to hard I think. Just use a delegate the same as you would as always in C#, or just use any of those 3 functions the same as you are using the RasDial function.
__________________
Jeff Boulanger ConnectUO - Core Developer Want to help make ConnectUO better? Click here to submit your ideas/requests Use your talent to compete against other community members in RunUO hosted coding competitions If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team. Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|