mIRC Homepage

Writing mIRC DLL in VB .NET

Posted By: bwr30060

Writing mIRC DLL in VB .NET - 17/04/06 12:33 AM

I posted in the Scripts and Popups section, and then remembered that there was a developer section here, so I apologize if this is considered a double post. I just think this forum would be better for my question.
I've written a DLL in VB .NET that works properly within a Windows form in VB, but I can't get it to work for mIRC. I read something that said I might need to use a .def file with my DLL, but I'm not sure how to do that. The mIRC help also had some parameters that needed to be in my DLL for it to work with mIRC. Could someone show me what needs to be done to make this work, or point me in the right direction? /comreg and $dll won't work with my DLL right now, and I need to know how to fix it. Thanks for any help.
Posted By: hixxy

Re: Writing mIRC DLL in VB .NET - 17/04/06 12:23 PM

I'm fairly sure you can't write Win32 dlls in VB.Net. You can write COM dlls, so I'm not sure why that wouldn't be working, as you don't use .def files with COM dlls.
Posted By: damian

Re: Writing mIRC DLL in VB .NET - 07/05/06 05:42 PM

I would also like to know if/how you can create mIRC DLL's in VB.NET. I've previously tried, using the guide from the mIRC Help File, but it has got me nowhere, pretty fast .. VB.NET Parameters vs. C Parameters and what not.

Code:
int __stdcall procname(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause)


For instance, no idea how I'd come up with the HWND in VB.NET :P

If anyone has a solution for us lowly .NET Developers, it would be muchly appreciated.
Posted By: bwr30060

Re: Writing mIRC DLL in VB .NET - 08/05/06 01:11 PM

Yes, you can write mIRC DLLs in VB .NET. I've written one so far. I used to have Visual Studio Professional on this computer, but I don't have it anymore, and I'm not sure if that's the difference. There was a check box that said "Register for COM Interop". If I checked that box, it worked. You don't need to have all that stuff about int __stdcall procname in the DLL. Mine was just a function that returned a value. What it did was return the weather for any US zip code you give it. So you just need to have a function that does something and the script I had in mIRC to use it was this:
Code:
on 1:NOTICE:!weather*:*:{
  if ($com(weather)) {    
    var %zip = $2
    noop $com(weather,GetWeather,3,bstr,%zip)
    var %weather = $com(weather).result
    notice $nick %weather
    echo -a $nick %weather
  }
  else {
    comopen weather weather.GWeather
    var %zip = $2
    noop $com(weather,GetWeather,3,bstr,%zip)
    var %weather = $com(weather).result
    notice $nick %weather 
    echo -a $nick %weather

  }
}
Posted By: Jheriko

Re: Writing mIRC DLL in VB .NET - 30/05/06 08:24 AM

Quote:

Code:
int __stdcall procname(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause)


For instance, no idea how I'd come up with the HWND in VB.NET :P


HWND is MyControl.Handle, e.g. Form1.Handle, PictureBox1.Handle, its a 32-bit unsigned integer and msdn recommends using the type 'System.IntPtr' for storing it in .NET applications

If you look up the types on msdn you can work out how to convert most C/C++ types/structs into .NET
Posted By: bwr30060

Re: Writing mIRC DLL in VB .NET - 05/06/06 07:06 PM

The example in the mIRC help with getting hwnd isn't even necessary in .NET. I've made mIRC DLLs in .NET and the only thing I needed to do was check the box that said "Register for COM Interop.
© 2021 mIRC Discussion Forums