Windows Forms with define method

Hi.I want to define Windows Form with define method.
1
2
3
4
5
6
7
8
9
10
    #ifndef ARAYUZ_H
    #define ARAYUZ_H
    #include <windows.h>
    #define FONKSIYON LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM)
    #define DEGISKEN char szClassName[ ] = "CodeBlocksWindowsApp"
    #define MOTOR int WINAPI WinMain (HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nCmdShow){HWND hwnd;MSG messages;WNDCLASSEX wincl;wincl.hInstance = hThisInstance;wincl.lpszClassName = szClassName;wincl.lpfnWndProc = WindowProcedure;wincl.style = CS_DBLCLKS;wincl.cbSize = sizeof (WNDCLASSEX);wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);wincl.hCursor = LoadCursor (NULL, IDC_ARROW);wincl.lpszMenuName = NULL;wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;if (!RegisterClassEx (&wincl))return 0;hwnd = CreateWindowEx (0,szClassName,"Code::Blocks Template Windows App",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,544,375,HWND_DESKTOP,NULL,hThisInstance,NULL);ShowWindow (hwnd, nCmdShow);while (GetMessage (&messages, NULL, 0, 0)){TranslateMessage(&messages);DispatchMessage(&messages);}return messages.wParam;}

    #define CAGIRMA      LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){switch (message) {case WM_DESTROY:PostQuitMessage (0);break;default:return DefWindowProc (hwnd, message, wParam, lParam);}return 0;}

    #endif 


I used this header in under the code block:
1
2
3
4
5
    #include <arayuz.h>
    FONKSIYON;
    DEGISKEN;
    MOTOR
    CAGIRMA


This is run.But is not open Windows form.
That looks like regular Windows API, not Windows Forms.

Anyway, that is a really bad idea. Write your program using the language directly and keep your macros only where they're necessary.

Incidentally, you can add line breaks to macros:

1
2
3
4
#define FOO int main()                                        \
            {                                                 \
                std::cout << "Hello, world!" << std::endl;    \
            } 
Last edited on
Yes Win API is correctly.But my purposed to abbreviate long class WinMain and other.Otherwise
i know this too.And run in the down codes:
1
2
3
4
5
6
7
8
#ifndef ARAYUZ_H
#define ARAYUZ_H
#include <iostream>
#define space using namespace std;
#define write cout<<
#define motor int main(){
#define returned return 0;}
#endif 


1
2
3
4
5
#include <arayuz.h>
space
motor
write "Hello";
returned
Last edited on
But this method is not to be avail in WinAPI.
But anyway thank u.
Must be define WinAPI in memory?Such as exam:
 
#define FONKSIYON LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM) 0x0005f895  


But where am i find this memory list?
Topic archived. No new replies allowed.