Click here to Skip to main content
14,391,933 members

ATL / WTL / STL

 
GeneralRe: get IP address from Net Address Control Pin
bkelly1319-Oct-14 9:42
Memberbkelly1319-Oct-14 9:42 
Generalserial port access and communication using c Pin
Member 111402618-Oct-14 23:51
MemberMember 111402618-Oct-14 23:51 
GeneralRe: serial port access and communication using c Pin
pasztorpisti9-Oct-14 0:18
professionalpasztorpisti9-Oct-14 0:18 
GeneralRe: serial port access and communication using c Pin
Orjan Westin9-Oct-14 1:58
professionalOrjan Westin9-Oct-14 1:58 
GeneralRe: serial port access and communication using c Pin
pasztorpisti9-Oct-14 2:08
professionalpasztorpisti9-Oct-14 2:08 
GeneralRe: serial port access and communication using c Pin
Orjan Westin9-Oct-14 5:50
professionalOrjan Westin9-Oct-14 5:50 
GeneralRe: serial port access and communication using c Pin
Orjan Westin9-Oct-14 1:55
professionalOrjan Westin9-Oct-14 1:55 
QuestionEnable a control/window in an MFC dialog, Resolved Pin
bkelly138-Oct-14 15:02
Memberbkelly138-Oct-14 15:02 
Windows XP, Visual Studio 2008, MFC, Dialog, c++
A button in the main MFC dialog opens a second dialog with options to control the main app. In there is a button that starts disable and after a method is run, is to be enabled. The event handler that initiates that task and enables the button looks like this, so far:
void C_Prog_Control::OnBnClickBtnGetCurrentStates()
{
HWND *button_handle = NULL;
BOOL status = FALSE;
Get_Current_States();
GetDlgItem(  IDC_DO_THIS, &button_handle )
status = EnableWindow( button_handle, TRUE );  // error
}


Please forgive, but not ignore, any obvious typos as my work computer is in another room and cannot be connected to the internet. I cannot cut and paste. And now that's worse. I cannot post a message from work and must send the text home and post from there.
I have looked up the GetDlgItem() here: (When I paste in the Microsoft URL it will not display.)
And the EnableWindow function here: (Same for this link).

So the first looks like this on the MS web site:
HWND WINAPI GetDlgItem(
  _In_opt_  HWND hDlg,
  _In_      int nIDDlgItem
);

and the second looks like this:
BOOL WINAPI EnableWindow(
  _In_  HWND hWnd,
  _In_  BOOL bEnable
);


The EnableWindow code will not compile. The error is:
… error C2660: ‘CWnd::EnableWindow’ : function does not take 2 arguments.
The compiler does not see, or does not like that I want HWND::EnableWindow rather than CWnd. When I try to use CWnd there are other problems.
Intellisense shows the following signature:
BOOL EnableWindow( BOOL bEnable = 1 )
This differs from the MS page and there is only one signature.
So, given a button with the ID of: IDC_DO_THIS, how can I enable it?

EDIT RESOLVED
While at work, I stopped what I was doing several times and searched for the answer to this several times at work, through the Air Force Firewalls. After giving up there and posting this question from home, I finally found the good idea of searching from home. There in one of the first few pages was a good answer. Tried it, it worked. Just for the record:
void Cvs_2008_get_port_numberDlg::OnBnClickedButton3()
{
  CWnd *pfield = GetDlgItem( IDC_BUTTON2 );
  pfield->EnableWindow( FALSE );
}


My lesson, try a search at work, but if it does not turn up the answer, search again from home. I presume the Air Force, and all military sites, are attacked so often that they have little choice but to set up things the way they are.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com



modified 8-Oct-14 22:20pm.

AnswerRe: Enable a control/window in an MFC dialog, Resolved Pin
Richard MacCutchan8-Oct-14 22:41
mveRichard MacCutchan8-Oct-14 22:41 
GeneralRe: Enable a control/window in an MFC dialog, Resolved Pin
bkelly139-Oct-14 1:34
Memberbkelly139-Oct-14 1:34 
Questioncontrol ID not found, Resolved Pin
bkelly135-Oct-14 15:25
Memberbkelly135-Oct-14 15:25 
AnswerRe: control ID not found Pin
Richard MacCutchan6-Oct-14 0:46
mveRichard MacCutchan6-Oct-14 0:46 
GeneralRe: control ID not found Pin
bkelly136-Oct-14 15:52
Memberbkelly136-Oct-14 15:52 
GeneralRe: control ID not found Pin
Richard MacCutchan6-Oct-14 22:33
mveRichard MacCutchan6-Oct-14 22:33 
GeneralResolved Pin
bkelly137-Oct-14 15:31
Memberbkelly137-Oct-14 15:31 
GeneralRe: Resolved Pin
Richard MacCutchan7-Oct-14 23:24
mveRichard MacCutchan7-Oct-14 23:24 
QuestionStruct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly1-Oct-14 19:15
MemberJacobkingsly1-Oct-14 19:15 
QuestionRe: Struct with Vector<BYTE> size different in VS2013 Pin
Richard MacCutchan1-Oct-14 22:31
mveRichard MacCutchan1-Oct-14 22:31 
AnswerRe: Struct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly2-Oct-14 0:05
MemberJacobkingsly2-Oct-14 0:05 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Richard MacCutchan2-Oct-14 0:13
mveRichard MacCutchan2-Oct-14 0:13 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly2-Oct-14 0:26
MemberJacobkingsly2-Oct-14 0:26 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Richard MacCutchan2-Oct-14 0:29
mveRichard MacCutchan2-Oct-14 0:29 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly2-Oct-14 0:31
MemberJacobkingsly2-Oct-14 0:31 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Richard MacCutchan2-Oct-14 0:35
mveRichard MacCutchan2-Oct-14 0:35 
AnswerRe: Struct with Vector<BYTE> size different in VS2013 Pin
Vi21-Oct-14 22:56
MemberVi21-Oct-14 22:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.