Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Accessing DLL's in VB Script
Venu Gopal Ragu
Posts: 11
 
Accessing DLL's in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Jul 06 4:52 AM
fiogf49gjkf0d
Hi

How do we access DLL’s in VB script . this is the way we used to do in legacy

Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Let me know if there is an alternative way
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Accessing DLL's in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Jul 06 11:43 AM
fiogf49gjkf0d
VBScript cannot do declares. So, there is no way to reference static DLLs, Win32API, etc. Your easiest routes would be to:

1) Think of an alternative way to get the task done
2) Wrap the static DLL call in a COM exposed DLL (which means you must also distribute)
3) Add the code to a legacy script which you invoke from your VBScript plugin
[Reply][Quote]
Jon Davis
Posts: 65
 
Re: Accessing DLL's in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Jul 06 10:02 PM
fiogf49gjkf0d
Or, wait for v7 and use P/Invoke in a managed assembly. This is how I will always wrap function pointers in the future.
[Reply][Quote]
Thomas Pleasance
Posts: 12
 
Re: Accessing DLL's in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Jul 06 9:26 AM
fiogf49gjkf0d
Are you just trying to get the current logged in user if so try this

Set wshNetwork = CreateObject("WScript.Network")
strUser = wshNetwork.Username
Msgbox "Current User: " & strUser
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Accessing DLL's in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Jul 06 11:54 AM
fiogf49gjkf0d
What about making a customization that imports almost the entirety of P/Invoke? I'm thinking of something you don't have to change every time you need access to a new function. Of course the plugin would probably be huge, since you're importing practically the entire Win32 library (or at the very least, the portion that does NOT have a .NET counterpart).
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Accessing DLL's in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Jul 06 12:17 PM
fiogf49gjkf0d
Quote:
Originally posted by Jeremy Brayton

What about making a customization that imports almost the entirety of P/Invoke? I'm thinking of something you don't have to change every time you need access to a new function. Of course the plugin would probably be huge, since you're importing practically the entire Win32 library (or at the very least, the portion that does NOT have a .NET counterpart).


If that is what you're after then DynaCall is a great solution for that. DynaCall is a COM DLL that allows you to dynamically call almost any std dll function/api.

http://people.freenet.de/gborn/WSHBazaar/WSHDynaCall.htm

You'd install the COM DLL once, and then could use it for any number of APIs. It is really a cool concept.
[Reply][Quote]
Jon Davis
Posts: 65
 
Re: Accessing DLL's in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Jul 06 6:40 PM
fiogf49gjkf0d
That's slick. Thanks for the link, Ryan.
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Accessing DLL's in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Jul 06 1:44 PM
fiogf49gjkf0d
My only beef is the date in which this was finished (pre-2000) so it could use an update but at least the source is available so it would be a great starting point. I'm thinking this would make a nice .NET extension and I think anything done in .NET gets a generous portion of the COM treatment so it wouldn't be too difficult to turn it into a COM object that earlier versions of SalesLogix could use as well (unless I'm completely off base in regards to .NET and COM).
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/26/2024 7:30:07 AM