Skip to content

How to get .lnk file info #965

Closed Answered by nini22P
nini22P asked this question in Q&A
Discussion options

You must be logged in to vote
    String? path;
    String? description;

    final shellLink = ShellLink.createInstance();
    final persistFile = IPersistFile.from(shellLink);

    final lpPath = wsalloc(MAX_PATH + 1);
    final lpDescription = wsalloc(MAX_PATH + 1);

    if (persistFile.load(shortcutPath.toNativeUtf16(), 0) == 0) {
      if (shellLink.getPath(lpPath, MAX_PATH + 1, nullptr, MAX_PATH + 1) == 0) {
        path = lpPath.toDartString();
      }

      if (shellLink.getDescription(lpDescription, MAX_PATH + 1) == 0) {
        description = lpDescription.toDartString();
      }
    }

    print('path: $path, description: $description');

    free(lpPath);
    free(lpDescription);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nini22P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant