How can i abbreviate this Windows Form?

reosurce.h:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef RESOURCE_H
#define RESOURCE_H
#include <windows.h>
#define Window LRESULT CALLBACK WinProc
char *title;
 int horizontal,vertical,height,width;
void* WindowTitle(char *title1){title=title1; }
 void* WindowSize(int a,int b,int c,int d){horizontal=a;vertical=b;height=c;width=d;}
#define Protocol case 0x2:PostQuitMessage(0);\
break;\
default:\
return DefWindowProc(A,B,C,D);}\
return 0;
#define WindowCreate int WINAPI \
WinMain(HINSTANCE hInstance,HINSTANCE hInstance2,LPSTR str,int d)\
{int k,l,m,n; WindowTitle(title);\
 WindowSize(k,l,m,n);\
 HWND hWnd;\
MSG msg;\
WNDCLASS clas={0};\
clas.hInstance=hInstance;\
clas.lpszClassName=title;\
clas.lpfnWndProc=WinProc;\
clas.hbrBackground=\
GetSysColorBrush(COLOR_3DFACE);\
RegisterClass(&clas)\
;\
CreateWindow(clas.lpszClassName,title,0xcf0000|\
WS_VISIBLE,horizontal,vertical,height,width,0,0,hInstance,0);\
while(GetMessage(&msg,NULL,0,0)){TranslateMessage(&msg);\
DispatchMessage(&msg);}\
return msg.wParam;}
#endif 


Exam.cpp:
1
2
3
4
5
6
7
8
#include <resource.h>
        Window(HWND A,UINT B,WPARAM C,LPARAM D){
        switch(B){
        Protocol;
        }
        WindowTitle("Window Exam");
WindowSize(50,150,600,450);
       WindowCreate;

I take these error:

1
2
3
4
6 C:\Exam.cpp expected constructor, destructor, or type conversion before '(' token 
6 C:\Exam.cpp expected `,' or `;' before '(' token 
7 C:\Exam.cpp expected constructor, destructor, or type conversion before '(' token 
7 C:\Exam.cpp expected `,' or `;' before '(' token 
Last edited on
Those macros make my eyes bleed... seriously. And that's not windows forms, that's the normal win 32 api. So basically, I don't really know what it is you are asking.
Last edited on
I know this.I want to create a short form in winapi.But i take constructor, destructor errors.
It is a mistake ending the Protocol and WindowCreate macros with a semi colon. But even if it was just it (and I don't know if it is it or not), you are taking a horrible path here. Want to simplify code? Write classes.
Try changing from void* to void in the declaration of WindowTitle and WindowSize... dunno.
Topic archived. No new replies allowed.