Click here to Skip to main content
15,887,267 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: get IP address from Net Address Control Pin
bkelly1319-Oct-14 8:42
bkelly1319-Oct-14 8:42 
Generalserial port access and communication using c Pin
Member 111402618-Oct-14 22:51
Member 111402618-Oct-14 22:51 
GeneralRe: serial port access and communication using c Pin
pasztorpisti8-Oct-14 23:18
pasztorpisti8-Oct-14 23:18 
GeneralRe: serial port access and communication using c Pin
Orjan Westin9-Oct-14 0:58
professionalOrjan Westin9-Oct-14 0:58 
GeneralRe: serial port access and communication using c Pin
pasztorpisti9-Oct-14 1:08
pasztorpisti9-Oct-14 1:08 
GeneralRe: serial port access and communication using c Pin
Orjan Westin9-Oct-14 4:50
professionalOrjan Westin9-Oct-14 4:50 
GeneralRe: serial port access and communication using c Pin
Orjan Westin9-Oct-14 0:55
professionalOrjan Westin9-Oct-14 0:55 
QuestionEnable a control/window in an MFC dialog, Resolved Pin
bkelly138-Oct-14 14:02
bkelly138-Oct-14 14: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:
C#
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 21:41
mveRichard MacCutchan8-Oct-14 21:41 
GeneralRe: Enable a control/window in an MFC dialog, Resolved Pin
bkelly139-Oct-14 0:34
bkelly139-Oct-14 0:34 
Questioncontrol ID not found, Resolved Pin
bkelly135-Oct-14 14:25
bkelly135-Oct-14 14:25 
AnswerRe: control ID not found Pin
Richard MacCutchan5-Oct-14 23:46
mveRichard MacCutchan5-Oct-14 23:46 
GeneralRe: control ID not found Pin
bkelly136-Oct-14 14:52
bkelly136-Oct-14 14:52 
GeneralRe: control ID not found Pin
Richard MacCutchan6-Oct-14 21:33
mveRichard MacCutchan6-Oct-14 21:33 
GeneralResolved Pin
bkelly137-Oct-14 14:31
bkelly137-Oct-14 14:31 
GeneralRe: Resolved Pin
Richard MacCutchan7-Oct-14 22:24
mveRichard MacCutchan7-Oct-14 22:24 
QuestionStruct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly1-Oct-14 18:15
Jacobkingsly1-Oct-14 18:15 
QuestionRe: Struct with Vector<BYTE> size different in VS2013 Pin
Richard MacCutchan1-Oct-14 21:31
mveRichard MacCutchan1-Oct-14 21:31 
AnswerRe: Struct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly1-Oct-14 23:05
Jacobkingsly1-Oct-14 23:05 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Richard MacCutchan1-Oct-14 23:13
mveRichard MacCutchan1-Oct-14 23:13 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly1-Oct-14 23:26
Jacobkingsly1-Oct-14 23:26 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Richard MacCutchan1-Oct-14 23:29
mveRichard MacCutchan1-Oct-14 23:29 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly1-Oct-14 23:31
Jacobkingsly1-Oct-14 23:31 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Richard MacCutchan1-Oct-14 23:35
mveRichard MacCutchan1-Oct-14 23:35 
AnswerRe: Struct with Vector<BYTE> size different in VS2013 Pin
Vi21-Oct-14 21:56
Vi21-Oct-14 21: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.