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 9207671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:26:20+00:00 2026-06-18T00:26:20+00:00

I am attempting to use the WinAPI function GUIDFromString() but it requires some finagling

  • 0

I am attempting to use the WinAPI function GUIDFromString() but it requires some finagling to include it in my project.

According to the msdn documentation:

This function is not declared in a header or exported by name from a
.dll file. It must be loaded from Shell32.dll as ordinal 703 for
GUIDFromStringA and ordinal 704 for GUIDFromStringW.

It can also be accessed from Shlwapi.dll as ordinal 269 for
GUIDFromStringA and ordinal 270 for GUIDFromStringW.

I have never loaded a DLL before so I am not sure what I should do and I am unsure if loading the DLL is enough, do I also have to include an ‘ordinal’ with the number 703? Would anyone be able to provide any advice on what I need to do to use this function and even an example?

My attempt below does not work(I am using VC++ 2010 Express):

#pragma comment(lib, "shell32.lib") // if I am including the dll do I need to include the lib aswell?

// I've heard that the dll location differs across versions of windows
// Does anyone know of a Cross-Windows-Version way to include Shell32.dll no matter where it is? Maybe use a keyword like "%SYSTEM%/Shell32.dll"
HINSTANCE shell32DLL = LoadLibary("C:/System/Shell32.dll"); 

// Now do I include 'Ordinal 703' as described in msdn? And how do I do that?
  • 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-06-18T00:26:21+00:00Added an answer on June 18, 2026 at 12:26 am

    If you read the documentation for GUIDFromString(), it says:

    GUIDFromString is available through Windows XP with Service Pack 2 (SP2) or Windows Vista. It might be altered or unavailable in subsequent versions. Applications should use CLSIDFromString or IIDFromString in place of this function.

    CLSIDFromString() and IIDFromString() are both exported by name from Ole32.dll, so you can use them like you would any other DLL function.

    With that said, if you still want to use GUIDFromString() then use LoadLibrary() to load shell32.dll and then use GetProcAddress() to access the function. MSDN documentation demonstrates how to do that. To load a function by ordinal, you can use the MAKEINTRESOURCE() macro when calling GetProcAddress().

    So, for example:

    // MAKEINTRESOURCE() returns an LPTSTR, but GetProcAddress()
    // expects LPSTR even in UNICODE, so using MAKEINTRESOURCEA()...
    #ifdef UNICODE
    #define MAKEINTRESOURCEA_T(a, u) MAKEINTRESOURCEA(u)
    #else
    #define MAKEINTRESOURCEA_T(a, u) MAKEINTRESOURCEA(a)
    #endif
    
    BOOL myGUIDFromString(LPCTSTR psz, LPGUID pguid)
    {
        BOOL bRet = FALSE;
    
        typedef BOOL (WINAPI *LPFN_GUIDFromString)(LPCTSTR, LPGUID);
        LPFN_GUIDFromString pGUIDFromString = NULL;
    
        HINSTANCE hInst = LoadLibrary(TEXT("shell32.dll"));
        if (hInst)
        {
            pGUIDFromString = (LPFN_GUIDFromString) GetProcAddress(hInst, MAKEINTRESOURCEA_T(703, 704));
            if (pGUIDFromString)
                bRet = pGUIDFromString(psz, pguid);
            FreeLibrary(hInst);
        }
    
        if (!pGUIDFromString)
        {
            hInst = LoadLibrary(TEXT("Shlwapi.dll"));
            if (hInst)
            {
                pGUIDFromString = (LPFN_GUIDFromString) GetProcAddress(hInst, MAKEINTRESOURCEA_T(269, 270));
                if (pGUIDFromString)
                    bRet = pGUIDFromString(psz, pguid);
                FreeLibrary(hInst);
            }
        }
    
        return bRet;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to use OpenSSL's SHA512 function in a C++ project of mine.
Attempting to use the data series from this example no longer passes the JSONLint
In attempting to use std::select1st from <functional> in a VS2008 project I found that
Im attempting to use websockets for a project. It needs to use the ipad,
I am attempting to use the data sources pluigin for rubymine 4.0.3 but I
I'm attempting to use an ajax source with Datatables, and I've run into some
I'm attempting to use the latest master branch of ember.js and ember-data. Here's some
Im attempting to use fxCop on a C# Project as kind of basis for
I'm attempting to use Resources 1.2.RC3, but every time I compile or attempt to
I'm attempting to use the undocumented system procedure sp_MSforeachtable . But I need to

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.