 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Aug 05, 2007 2:14 am Post subject: is this how to make an APP? |
|
|
I'm new to making APPs in C++, so this is the write way to make an app write?
| Code: |
#include <windows.h>
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
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.cbClsExtra = 0;
wincl.cbWndExtra = 0;
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
if (!RegisterClassEx (&wincl))
return 0;
hwnd = CreateWindowEx (
0,
szClassName,
"Windows App",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
544,
375,
HWND_DESKTOP,
NULL,
hThisInstance,
NULL
);
ShowWindow (hwnd, nFunsterStil);
while (GetMessage (&messages, NULL, 0, 0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return messages.wParam;
}
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage (0); queue */
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
the_undead Expert Cheater
Reputation: 1
Joined: 12 Nov 2006 Posts: 235 Location: Johannesburg, South Africa
|
Posted: Sun Aug 05, 2007 3:40 am Post subject: |
|
|
| Code: | #include <windows.h>
LRESULT CALLBACK WndProc( HWND hWnd , UINT message , WPARAM wParam , LPARAM lParam)
{
switch(message)
{
case WM_CREATE:
break;
case WM_COMMAND:
break;
case WM_PAINT:
break;
}
return DefWindowProc(hWnd,message,wParam,lParam);
}
INT WINAPI WinMain( HINSTANCE , HINSTANCE , LPSTR , INT )
{
WNDCLASSEX wc;
wc.cbClsExtra = 0;
wc.cbSize = sizeof(wc);
wc.cbWndExtra = 0;
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW));
wc.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_HAND));
wc.hIconSm = LoadIcon(NULL, MAKEINTRESOURCE(IDI_HAND));
wc.hInstance = GetModuleHandle(NULL);
wc.lpfnWndProc = WndProc;
wc.lpszClassName = "ThisIsMyClass";
wc.lpszMenuName = NULL;
wc.style = CS_VREDRAW|CS_HREDRAW|CS_OWNDC;
RegisterClassEx(&wc);
HWND hWnd = CreateWindowEx(0,
"ThisIsMyClass","ThisIsMyWindowName",
WS_VISIBLE|WS_SYSMENU,
100,100,480,320,
NULL,NULL,
wc.hInstance,0);
ShowWindow(hWnd,SW_SHOW);
MSG msg;
while(GetMessage(&msg,hWnd,0,0)>0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
} |
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Aug 05, 2007 9:13 am Post subject: |
|
|
Instead of just giving me the code, can you tell me why you changed what you did and what the difference is.
Edit:
I already know that my way compiles, I just wanted to know if that way is used the most.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Zyph Grandmaster Cheater
Reputation: 0
Joined: 10 Jan 2007 Posts: 511 Location: fo.writelines(['Mass<\n>',
|
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Sun Aug 05, 2007 5:44 pm Post subject: |
|
|
Applications don't have to have a GUI to be called an APP.
console and "gui-less" (word doesn't come to mind) are still applications.
_________________
|
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Sun Aug 05, 2007 5:58 pm Post subject: |
|
|
| sponge wrote: | Applications don't have to have a GUI to be called an APP.
console and "gui-less" (word doesn't come to mind) are still applications. |
Probably because the only thing he did in a console is a "Hello World" program. And now he wants to jump to going GUI without knowing the basics
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon Aug 06, 2007 6:01 pm Post subject: |
|
|
| UnLmtD wrote: | | sponge wrote: | Applications don't have to have a GUI to be called an APP.
console and "gui-less" (word doesn't come to mind) are still applications. |
Probably because the only thing he did in a console is a "Hello World" program. And now he wants to jump to going GUI without knowing the basics  |
not true...T.T
And sorry. I will change the title. But still, instead of insulting me by saying what I don't know, and if I didn't really do anything but Hello World, kind help me, and then kindly point it out. Although sponge really did do it kindly.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|