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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:46:05+00:00 2026-06-02T13:46:05+00:00

I have been having trouble with my program trying to gray out ( and

  • 0

I have been having trouble with my program trying to gray out ( and disable ) a sub menu item.

What I’m looking for is that the “run” item be disabled unless the required .ini entry is not empty.

My code

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HMENU hmenu = GetMenu(hWnd);
// Reading in ini
    if (0 == strcmp(webLocation, "")){
    EnableMenuItem(hmenu,ID_WEBSERVICES_RUN,MF_DISABLED | MF_GRAYED);
    WritePrivateProfileString(_T("WEBSERVICES"), _T("Location"), _T("Tool Not Found"), WpathStr);
}

I am unsure as to whether I am getting the HMENU correctly and why this code is not working for the desired effect.

Any help with this would be greatly appreciated.

  • 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-02T13:46:06+00:00Added an answer on June 2, 2026 at 1:46 pm

    You can’t just put this in the WndProc at the top level. WndProc process events, whether the window has been constructed or not. It’ll be called many times for many different reasons.

    Your WndProc will almost certainly look like a big switch on message. The one you want here is WM_INITDIALOG:

    LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
        switch(message)
        {
             case WM_INITDIALOG:
                 // jump to a new function that reads the .ini
                 // and disables the control etc.
                 return OnInitDialog(hWnd, wParam, lParam);
    
             default:
                 return DefWindowProc(hWnd, message, wParam, lParam);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I been having trouble trying to figure this out. When I think I have
I have been having trouble with timeout on SQL program , I have narrowed
so I have been having trouble with grabbing information from a device that is
Hello I have been having trouble with this for a while now. I have
I am having trouble writing a query. I have been working with UNION on
Having Trouble with Entity Framework. I have been populating EntityReferences with an EntityKey inorder
No doubt elements of this question have been asked before, but I'm having trouble
I have been having an issue with the $this->delete() method that deletes a record
I've been trying to write a program in R that implements Newton's method. I've
I'm having some trouble with a program using pthreads, where occassional crashes occur, that

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.