mIRC Home    About    Download    Register    News    Help

Print Thread
Writing mIRC DLL in VB .NET #147294 17/04/06 12:33 AM
Joined: May 2005
Posts: 449
bwr30060 Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
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.

Re: Writing mIRC DLL in VB .NET #147295 17/04/06 12:23 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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.

Re: Writing mIRC DLL in VB .NET #147296 07/05/06 05:42 PM
Joined: Apr 2005
Posts: 7
D
damian Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
D
Joined: Apr 2005
Posts: 7
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.

Re: Writing mIRC DLL in VB .NET #147297 08/05/06 01:11 PM
Joined: May 2005
Posts: 449
bwr30060 Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
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

  }
}

Re: Writing mIRC DLL in VB .NET #147298 30/05/06 08:24 AM
Joined: May 2006
Posts: 2
J
Jheriko Offline
Bowl of petunias
Offline
Bowl of petunias
J
Joined: May 2006
Posts: 2
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

Re: Writing mIRC DLL in VB .NET #147299 05/06/06 07:06 PM
Joined: May 2005
Posts: 449
bwr30060 Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
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.