-
June 30th, 2009, 01:35 PM
#1
[RESOLVED] Problems creating button (C2660)
I receive the fallowing errors:
1>.\EnterIFSEnt.cpp(56) : error C2143: syntax error : missing ')' before ';'
1>.\EnterIFSEnt.cpp(56) : error C2660: 'CreateWindowExA' : function does not take 10 arguments
1>.\EnterIFSEnt.cpp(56) : error C2143: syntax error : missing ';' before ','
1>.\EnterIFSEnt.cpp(59) : error C2059: syntax error : ')'
Obviously I have 12 arguments as described in docs. What's going on here? I works fine on my other form.
Line 56 = "(HMENU)cmdOK,"
Code:
LRESULT CALLBACK WndProcess(HWND hwndex, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND hwndcmdOK;
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwndex);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_COMMAND:
break;
case WM_CREATE:
{
RegisterGridClass(hInstee);//Registers the style class "BABYGRID"
//cmdOK
hwndcmdOK=CreateWindowEx(0, /* 1 more or ''extended'' styles */
TEXT("BUTTON"), /* 2 GUI ''class'' to create */
TEXT("OK"), /* 3 GUI caption */
WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON, /* 4 control styles separated by | */
111, /* 5 X POSITION (Position from left) */
279, /* 6 Y POSITION (Position from Top) */
75, /* 7 WIDTH OF CONTROL */
23, /* 8 HEIGHT OF CONTROL */
hwndee, /* 9 Parent window handle */
(HMENU)cmdOK, /* 10 control''s ID for WM_COMMAND */
NULL, /* 11 application instance */
NULL /* 12 LParam (not used)*/
);
////DataGrid Enter entity
//hwnddgEnterEnt=CreateWindowExA(WS_EX_CLIENTEDGE,"BABYGRID","",WS_VISIBLE|WS_CHILD,2,2,200,200,hwndee,(HMENU)dgEnterEnt,NULL,NULL);
//SendMessage(hwnddgEnterEnt,BGM_SETEDITABLE,TRUE,0);//Allows the grid to be editable
//SendMessage(hwnddgEnterEnt,BGM_SETCOLSNUMBERED,FALSE,0);
//SendMessage(hwnddgEnterEnt,BGM_SETGRIDDIM,0,1);
//SendMessage(hwnddgEnterEnt,BGM_SETCOLWIDTH,0,0);//hides the row numbers
//SendMessage(hwnddgEnterEnt,BGM_SETCOLWIDTH,1,253);//sets column width of column 1
//SendMessage(hwnddgEnterEnt,BGM_SETHEADINGFONT,(WPARAM)g_fmyfont,NULL);//set the column heading font
//SendMessage(hwnddgEnterEnt,BGM_SETALLOWCOLRESIZE,(WPARAM)TRUE,NULL);//Allows the columns to be resized
//SendMessage(hwnddgEnterEnt,BGM_AUTOROW,(WPARAM)TRUE,NULL);
}
break;
default:
return DefWindowProc(hwndex,msg,wParam,lParam);
}
}
Last edited by james2432; June 30th, 2009 at 01:38 PM.
-
June 30th, 2009, 01:50 PM
#2
Re: Problems creating button (C2660)
Pass the correct number of parameters to CreateWindowEx.
Which lines are causing other errors?
You posted actual code, or commented the error lines here?
-
June 30th, 2009, 01:52 PM
#3
Re: Problems creating button (C2660)
lines creating errors (the commented lines create the same errors):
Code:
hwndcmdOK=CreateWindowEx(0, /* 1 more or ''extended'' styles */
TEXT("BUTTON"), /* 2 GUI ''class'' to create */
TEXT("OK"), /* 3 GUI caption */
WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON, /* 4 control styles separated by | */
111, /* 5 X POSITION (Position from left) */
279, /* 6 Y POSITION (Position from Top) */
75, /* 7 WIDTH OF CONTROL */
23, /* 8 HEIGHT OF CONTROL */
hwndee, /* 9 Parent window handle */
(HMENU)cmdOK, /* 10 control''s ID for WM_COMMAND */
NULL, /* 11 application instance */
NULL /* 12 LParam (not used)*/
);
-
June 30th, 2009, 01:58 PM
#4
Re: Problems creating button (C2660)
I declared the three variables required, and it compiles smoothly.
Is it related to TEXT macro?
Try removing it and re-compile.
-
June 30th, 2009, 02:04 PM
#5
Re: Problems creating button (C2660)
Same errors
Code:
CreateWindowEx(0, /*1 Extended styles*/
"BUTTON", /* 2 GUI ''class'' to create */
"OK",..........................
-
June 30th, 2009, 02:07 PM
#6
Re: Problems creating button (C2660)
Please try to solve your problem yourself. Your problem seems to be simple.
And, you are not giving enough information to reproduce the error.
-
June 30th, 2009, 03:38 PM
#7
Re: Problems creating button (C2660)
I have cmdOK defined at the top (see code below)
When I use cmdOK I get the error. When I use 203(directly) it compiles
Code:
#include <string.h>
#include <cstring>
#include <stdlib.h>
#include "BabyGrid.h"
#include "EnterIFSEnt.h"
#include "datamanager.h"
#include <vector>
#define dgEnterEnt 202;
#define cmdOK 203;
const char g_seeClassName[] = "EnterIFSEntWC";
int g_ieSizex,g_ieSizey;
HINSTANCE hInstee;
HFONT g_fmyfont;
WNDCLASSEX wcx;
HWND hwndee;
HWND hwnddgEnterEnt;
MSG eMsg;
_BGCELL cellee;
*EDIT*
Even if I use 203 directly it doesn't register on the form.
Last edited by james2432; June 30th, 2009 at 03:44 PM.
-
July 1st, 2009, 12:32 AM
#8
Re: Problems creating button (C2660)
Code:
#define dgEnterEnt 202;
#define cmdOK 203;
What is this? First remove the ; remove from these definitions. Second, the dgEnterEnt and cmdOK are supposed to be variables of respective type that CreateWindow takes/returns.
-
July 1st, 2009, 08:32 AM
#9
Re: Problems creating button (C2660)
I use them up there so that I can always reference the HMENU later to find the hwnd with FindDlgWindow() so I can change settings/read them so if I do have to change the number I don't have to modify the whole program...and wow I must have been tired to add a ; to a define
-
July 1st, 2009, 11:26 AM
#10
Re: Problems creating button (C2660)
I use them up there so that I can always reference the HMENU later to find the hwnd with FindDlgWindow() so I can change settings/read them so if I do have to change the number I don't have to modify the whole program...and wow I must have been tired to add a ; to a define
Your sentence is vague! Add some punctuation marks to make it understandable.
You cannot make a constant a variable.
-
July 2nd, 2009, 07:11 AM
#11
Re: Problems creating button (C2660)
I found the problem why it wasn't adding to the form. In the CreateWindowEx() I was useing hwndee(which was in the process of being created) which is the global variable at the top. I had to take the hwnd parameter to the WndProc which actually had a address space reserved(the global was always 0x0000000).
Last edited by james2432; July 2nd, 2009 at 07:40 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|