You don't believe that...Kcc after long time begin his dream, coding several lines in C, for begin his code to translate PB to C
So it's just the beginning, of the beginning of the start...
But i'm so happy that i want sharing my happiness with you
For the moment, i just translate some case of OpenWindows
But it's already a beginning no ?????
You can try
OpenWindow(1, 648, 417, 265, 176, "FenetrePB", #PB_Window_ScreenCentered|#WS_POPUP)
OpenWindow(1, 648, 417, 265, 176, "FenetrePB", #PB_Window_ScreenCentered|#PB_Window_SizeGadget)
OpenWindow(1, 30, 30, 100, 100, "FenetrePB", #PB_Window_SizeGadget)
OpenWindow(1, 648, 417, 265, 176, "FenetrePB")
But after..i add #PB_Window_Minimize, #PB_Window_Maximize, etc...
There are giant works...there are so much functions, FRED is not an idle
I don't know if a day i can terminate him, but i'm happy to have starting
So now, i must go to eat and sleep, or else my whife hurt me with his broomstick.
This is my little beginning works
http://erdsjb.free.fr//PureStorage/Provisoire/Pb2C.zip
But i need help of my friends for can continue my adventure
I want to create two windows not MDI in C
And i don't know how
So i have copy the CodeBlock code and paste two time the code
Putting it in two procedure, but i'm sure there are too much sentence
Furthermore, it's just the first windows who appears
Someone can help me, to reduce the code, without changing the form please,please, please
Because if you made too difficult code, KCC don't understanding it, and not move
Just simplify the lines in procedure, move the line if she's not at his place, it's already a good help for me
I don't want create the better and optimize translater of the world, just a simple translater for can passing all my numerous code from PB in C automaticaly
1/ Just make global the sentence who is for the two windows
2/ i don't know if i must managing two callback
3/ And obviously fix the bug of see only the first windows
Code: Select all
#include <windows.h>
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure1 (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK WindowProcedure2 (HWND, UINT, WPARAM, LPARAM);
int Fenetre1(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow);
int Fenetre2(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow);
/* Make the class name into a global variable */
char szClassName[ ] = "CodeBlocksWindowsApp";
int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow){
int message1; /* Here messages to the application are saved */
int message2; /* Here messages to the application are saved */
message1 = Fenetre1(hThisInstance, hPrevInstance, lpszArgument,nCmdShow);
message2 = Fenetre2(hThisInstance, hPrevInstance, lpszArgument,nCmdShow);
return message1;
}
int Fenetre1(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow){
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure1; /* This function is called by windows */
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after the window class */
wincl.cbWndExtra = 0; /* structure or the window instance */
/* Use Windows's default colour as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Fenetre 1", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
ShowWindow (hwnd, nCmdShow);
/* Run the message loop. It will run until GetMessage() returns 0 */
while (GetMessage (&messages, NULL, 0, 0))
{
/* Translate virtual-key messages into character messages */
TranslateMessage(&messages);
/* Send message to WindowProcedure */
DispatchMessage(&messages);
}
/* The program return-value is 0 - The value that PostQuitMessage() gave */
return messages.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
int Fenetre2(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow){
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure2; /* This function is called by windows */
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after the window class */
wincl.cbWndExtra = 0; /* structure or the window instance */
/* Use Windows's default colour as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Fenetre 2", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
ShowWindow (hwnd, nCmdShow);
/* Run the message loop. It will run until GetMessage() returns 0 */
while (GetMessage (&messages, NULL, 0, 0))
{
/* Translate virtual-key messages into character messages */
TranslateMessage(&messages);
/* Send message to WindowProcedure */
DispatchMessage(&messages);
}
/* The program return-value is 0 - The value that PostQuitMessage() gave */
return messages.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure1 (HWND hwnd, UINT message1, WPARAM wParam, LPARAM lParam)
{
switch (message1) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
break;
default: /* for messages that we don't deal with */
return DefWindowProc (hwnd, message1, wParam, lParam);
}
return 0;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure2 (HWND hwnd, UINT message2, WPARAM wParam, LPARAM lParam)
{
switch (message2) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
break;
default: /* for messages that we don't deal with */
return DefWindowProc (hwnd, message2, wParam, lParam);
}
return 0;
}
Thanks in advance