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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:04:21+00:00 2026-06-03T02:04:21+00:00

I need to do the same as the C# .net code below in C++

  • 0

I need to do the same as the C# .net code below in C++ MFC
can you guys help me out?

using System;
using System.Text;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
{
    class Program
    {
        [DllImport("shell32.dll", EntryPoint = "#261",
            CharSet = CharSet.Unicode, PreserveSig = false)]
        public static extern void GetUserTilePath(
          string username, 
          UInt32 whatever, // 0x80000000
          StringBuilder picpath, int maxLength);

        public static string GetUserTilePath(string username)
        {   // username: use null for current user
            var sb = new StringBuilder(1000);
            GetUserTilePath(username, 0x80000000, sb, sb.Capacity);
            return sb.ToString();
        }

        [STAThread]
        static void Main(string[] args)
        {
            string path =GetUserTilePath(null);
            Console.WriteLine("path = %s", path);
        }
    }
}

I cant get to the GetProcAddress from the #261 (or 261) entry point and/or its exactly signature to C++.

EDIT: Here is the Trick

HMODULE shell32Dll= ::LoadLibrary(L"shell32.dll");


HRESULT (__stdcall *getUserImage)(LPCWSTR userName,
                        DWORD zero , LPWSTR outPath, UINT size);

(FARPROC&)getUserImage = ::GetProcAddress(shell32Dll, MAKEINTRESOURCEA(261));
if(getUserImage)
{
        WCHAR outPath[MAX_PATH];
        getUserImage(NULL,0x80000000,outPath,MAX_PATH);
}

MAKEINTRESOURCEA(261) instead of “#261” or “261” make get the job done!

Thank you! Cameron!

  • 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-03T02:04:24+00:00Added an answer on June 3, 2026 at 2:04 am

    From the GetProcAddr documentation:

    lpProcName [in]
    The function or variable name, or the function’s ordinal value. If this parameter is an ordinal value, it must be in the low-order word; the high-order word must be zero.

    It turns out you should be calling it like so:

    (FARPROC&)getUserImage = ::GetProcAddress(shell32Dll, MAKEINTRESOURCE(261));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone help me how to do this. I have attached my code below.
I need to accomplish the same behavior as .NET Console.ReadLine function provides. The program
I have an asp.net mvc 2 app. I need to display the same page
ASP.NET 4.0 Need some help with this vexing HTTP POST problem - I have
I have a website using asp.net mvc in which I need to embed a
I need to build a spelling suggestor in ASP.NET... The below are my requirement.
Im using this code http://platinumdogs.wordpress.com/2008/10/30/net-c-impersonation-with-network-credentials/#comment-770 to connect from a machine in the domain to
I'm currently using the below code within a winform which is generated and compiled
Using the code below I will get all network interfaces which are enabled and
i call my asp.net page method like below code $.ajax({ type: POST, url: MyPage.aspx/GetItems,

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.