Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7681313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:18:50+00:00 2026-05-31T18:18:50+00:00

So this is as far as I got. Before I spend days throwing darts

  • 0

So this is as far as I got. Before I spend days throwing darts in the dark. I wanted to know if anybody has any tips. I obviously can’t call the methods from pShellLink directly. So I need a way to declare them, but I can’t figure out how. There is not many examples on Javascript ctype yet.

Components.utils.import("resource://gre/modules/ctypes.jsm");
var libshell32 = ctypes.open("shell32.dll");

const CLSID_ShellLink = '00021401-0000-0000-C000-000000000046';
const IID_IShellLink = '000214EE-0000-0000-C000-000000000046';
const IID_IPersistFile = '0000010b-0000-0000-C000-000000000046';
const CLSCTX_INPROC_SERVER = 0x1;

var CoInitialize = libshell32.declare("CoInitialize", ctypes.winapi_abi, ctypes.int32_t,
                                          ctypes.jschar.ptr);  // LPVOID

var CoCreateInstance = libshell32.declare("CoCreateInstance", ctypes.winapi_abi, ctypes.int32_t,
                                          ctypes.int32_t,      // REFCLSID
                                          ctypes.jschar.ptr,   // LPUNKNOWN
                                          ctypes.jschar.ptr,   // DWORD
                                          ctypes.int32_t,      // REFIID
                                          ctypes.voidptr_t);  // LPVOID

var pPersistFile; // ??
var pShellLink; // ??
var hRes; // ??

hRes = CoInitialize(null);
hRes = CoCreateInstance(CLSID_ShellLink,null,CLSCTX_INPROC_SERVER,IID_IShellLink,pShellLink);
if (SUCCEEDED(hRes))
{
  hRes = pShellLink->lpVtbl->SetPath(pShellLink, "c:\somefile");
  hRes = pShellLink->lpVtbl->SetArguments(pShellLink, "-somearg");
  hRes = pShellLink->lpVtbl->SetDescription(pShellLink, "SomeDescription");
  hRes = pShellLink->lpVtbl->SetShowCmd(pShellLink, '1');
  hRes = pShellLink->lpVtbl->SetWorkingDirectory(pShellLink, "c:\somedir");
  hRes = pShellLink->lpVtbl->SetIconLocation(pShellLink, "c:\pathtoicon", '1');

  /* Use the IPersistFile object to save the shell link */
  hRes = pShellLink->lpVtbl->QueryInterface(pShellLink,        /* existing IShellLink object */
                                            &IID_IPersistFile, /* pre-defined interface of the IPersistFile object */
                                            &pPersistFile);    /* returns a pointer to the IPersistFile object */
  if (SUCCEEDED(hRes))
  {
    hRes = pPersistFile->lpVtbl->Save(pPersistFile, "c:\pathtoInk", TRUE);
    pPersistFile->lpVtbl->Release(pPersistFile);
  }
  pShellLink->lpVtbl->Release(pShellLink);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:18:51+00:00Added an answer on May 31, 2026 at 6:18 pm

    I recently implemented exactly this functionality. See the first attachment to this bug: https://bugzilla.mozilla.org/attachment.cgi?bugid=738501&action=viewall

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I post this previously in Adobe Forum but haven't got any answers so far.
I got this far: :~ curl -u username:password -d status=new_status http://twitter.com/statuses/update.xml Now, how can
Here is what I've got so far.. I'm using this as a keybind. I
I'm trying to implement a Haskell Bag (multiset). So far I've got this data
I know this is far fetched, but I've received an IPA game from a
this is by far my toughest question yet and I'm hoping someone has stumbled
I am trying to rebuild this with pure css. And I've got this far.
Having (more) issues with zend form decorators. I've got this so far: Reset overall
Been at this far too long; trying to populate a field in a record
After cobbling together a few questions I've managed to get this far to showing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.