# Calling SDK functions from VBScript

**URL:** <https://boards.straightdope.com/t/calling-sdk-functions-from-vbscript/321437>\
**Category:** Factual Questions\
**Created:** [September 13, 2005, 4:13pm UTC](https://boards.straightdope.com/t/calling-sdk-functions-from-vbscript/321437 "2005-09-13T16:13:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ccwaterback](https://avatars.discourse-cdn.com/v4/letter/c/df705f/32.png) [@ccwaterback](https://boards.straightdope.com/u/ccwaterback)\
**Post date:** [September 13, 2005, 4:13pm UTC](https://boards.straightdope.com/t/calling-sdk-functions-from-vbscript/321437/1 "2005-09-13T16:13:36Z")

</div>

Does anyone know how I would go about programming a VB Script to call the DeleteVolumeMountPoint() SDK function?

---

<div class="post-metadata">

**Author:** ![cstamets](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@cstamets](https://boards.straightdope.com/u/cstamets)\
**Post date:** [September 14, 2005, 12:29am UTC](https://boards.straightdope.com/t/calling-sdk-functions-from-vbscript/321437/2 "2005-09-14T00:29:03Z")

</div>

You can try looking on Microsoft’s website for their Scriptomatic tool. I don’t know if it covers this particular function, but it does come in handy.

---

<div class="post-metadata">

**Author:** ![MartinL](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@MartinL](https://boards.straightdope.com/u/MartinL)\
**Post date:** [September 14, 2005, 1:22pm UTC](https://boards.straightdope.com/t/calling-sdk-functions-from-vbscript/321437/3 "2005-09-14T13:22:11Z")

</div>

You can use the “mountvol” command line tool instead.  
Enter “mountvol -?” on the command line for more information on the syntax. Use the WScript.Shell object to run the command from your script.  
When playing around, be careful not to delete the mountpoint for the C: drive!

---

<div class="post-metadata">

**Author:** ![micco](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@micco](https://boards.straightdope.com/u/micco)\
**Post date:** [September 14, 2005, 1:43pm UTC](https://boards.straightdope.com/t/calling-sdk-functions-from-vbscript/321437/4 "2005-09-14T13:43:55Z")

</div>

I’ve never called this kind of function from VBScript, but if you have the documentation for making the call, it would be pretty simple to write it in VB and compile it as a DLL you could then call from your VBScript. That is, with minimal VB coding, you could write a DLL wrapper around the DeleteVolumeMountPoint call and use the usual CreateObject command to access your DLL from VBScript.

---

<div class="post-metadata">

**Author:** ![ccwaterback](https://avatars.discourse-cdn.com/v4/letter/c/df705f/32.png) [@ccwaterback](https://boards.straightdope.com/u/ccwaterback)\
**Post date:** [September 14, 2005, 2:30pm UTC](https://boards.straightdope.com/t/calling-sdk-functions-from-vbscript/321437/5 "2005-09-14T14:30:41Z")

</div>

All good ideas. Thanks.

---

<div class="post-metadata">

**Author:** ![DarrenS](https://avatars.discourse-cdn.com/v4/letter/d/977dab/32.png) [@DarrenS](https://boards.straightdope.com/u/DarrenS)\
**Post date:** [September 14, 2005, 6:34pm UTC](https://boards.straightdope.com/t/calling-sdk-functions-from-vbscript/321437/6 "2005-09-14T18:34:21Z")

</div>

If you think you might be calling more API functions, it’s probably worthwhile writiting yourself a COM object (very easy in VB6/7 depending which you have access to). Your COM object would then dispatch calls to the appropriate API function:

if option 1  
call API function 1  
else if option 2  
call API function 2

… etc etc …

Of course, for more than two options you’ll probably want a Select…Case.

COM objects are very easy to use from VBScript.
