Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Runtime controls or resources

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
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?

PostPosted: Fri Apr 25, 2008 6:37 pm    Post subject: Runtime controls or resources Reply with quote

Well, I wanted to know what the community thinks. Should I make my controls (i.e. buttons, listboxes, menus and such) at runtime. Or should I use resources. I personally like making them at runtime because I've always done it that way. And I don't like using resource editors. But what do you guys thinks?
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Fri Apr 25, 2008 6:43 pm    Post subject: Reply with quote

www.resedit.net

Make a dialog, then just export it as code.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Fri Apr 25, 2008 6:49 pm    Post subject: Reply with quote

Flyte wrote:
www.resedit.net

Make a dialog, then just export it as code.


This is great, thanks.
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Apr 25, 2008 6:51 pm    Post subject: Reply with quote

Hehe, I love it too. Laughing

Btw...it generates something like this...

Code:

// Generated by ResEdit 1.4.3
// Copyright (C) 2006-2008
// http://www.resedit.net

HINSTANCE hInst = GetModuleHandle(0);
WNDCLASSEX wcex;
ZeroMemory(&wcex, sizeof wcex);
wcex.cbSize         = sizeof wcex;
wcex.hbrBackground  = GetSysColorBrush(COLOR_3DFACE);
wcex.lpszMenuName   = 0;


HMENU hmenu2 = CreateMenu();
HMENU hmenu2_1 = CreatePopupMenu();
AppendMenu(hmenu2_1, MF_STRING, IDM_EXIT1, TEXT("Exit"));
AppendMenu(hmenu2, MF_STRING | MF_POPUP | MF_MENUBREAK, (UINT_PTR)hmenu2_1, TEXT("File"));
HMENU hmenu2_2 = CreatePopupMenu();
AppendMenu(hmenu2_2, MF_STRING, IDM_KILL1, TEXT("Kill"));
AppendMenu(hmenu2, MF_STRING | MF_POPUP | MF_MENUBREAK, (UINT_PTR)hmenu2_2, TEXT("Process"));
HMENU hmenu2_3 = CreatePopupMenu();
AppendMenu(hmenu2_3, MF_STRING, IDM_FULLSCREEN1, TEXT("Fullscreen"));
AppendMenu(hmenu2, MF_STRING | MF_POPUP | MF_MENUBREAK, (UINT_PTR)hmenu2_3, TEXT("View"));
HMENU hmenu2_4 = CreatePopupMenu();
AppendMenu(hmenu2_4, MF_STRING, IDM_ABOUT1, TEXT("About"));
AppendMenu(hmenu2_4, MF_STRING, IDM_CREDITS1, TEXT("Credits"));
AppendMenu(hmenu2, MF_STRING | MF_POPUP | MF_MENUBREAK, (UINT_PTR)hmenu2_4, TEXT("Help"));


wcex.style          = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc    = DefWindowProc;
wcex.hInstance      = hInst;
wcex.hIcon          = LoadIcon(0, (LPCTSTR)IDI_APPLICATION);
wcex.hCursor        = LoadCursor(NULL, IDC_ARROW);
wcex.lpszClassName  = WndClass33;
RegisterClassEx(&wcex);

HFONT hfont3 = CreateFont(-11, 0, 0, 0, 400, FALSE, FALSE, FALSE, 1, 400, 0, 0, 0, TEXT("Ms Shell Dlg 2"));
HWND hwnd = CreateWindowEx(, WS_EX_WINDOWEDGE, TEXT("WndClass3"), TEXT("Process Killer"), WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_THICKFRAME | WS_SYSMENU, 0, 0, 287, 110, 0, 0, hInst, 0);
HWND hCtrl3_0 = CreateWindowEx(0, WC_BUTTON, TEXT("Kill Process"), WS_VISIBLE | WS_CHILD | WS_TABSTOP, 95, 42, 75, 23, hwnd, (HMENU)IDOK, hInst, 0);
SendMessage(hCtrl3_0, WM_SETFONT, (WPARAM)hfont3, FALSE);
HWND hCtrl3_1 = CreateWindowEx(0, WC_COMBOBOX, 0, WS_VISIBLE | WS_CHILD | CBS_DROPDOWN | CBS_HASSTRINGS, 47, 8, 210, 23, hwnd, (HMENU)IDC_COMBO1, hInst, 0);
SendMessage(hCtrl3_1, WM_SETFONT, (WPARAM)hfont3, FALSE);
HWND hCtrl3_2 = CreateWindowEx(0, WC_STATIC, TEXT("Process"), WS_VISIBLE | WS_CHILD | WS_GROUP, 8, 8, 39, 13, hwnd, (HMENU)IDC_STATIC, hInst, 0);
SendMessage(hCtrl3_2, WM_SETFONT, (WPARAM)hfont3, FALSE);


And I would turn it into something like this (just bare bones, no real functions yet...)

Code:


#include <windows.h>

/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = "Process Killer";

int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)

{
    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 */
   ZeroMemory(&wcex, sizeof wcex);

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_HREDRAW | CS_VREDRAW;               /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon(0, (LPCTSTR)IDI_APPLICATION);
    wincl.hIconSm = LoadIcon(0, (LPCTSTR)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 color as the background of the window */
    wincl.hbrBackground = GetSysColorBrush(COLOR_3DFACE);

    /* 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 */
           "Process Killer",     /* 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, nFunsterStil);

    /* 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 WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)                  /* handle the messages */
    {
      case WM_CREATE:
         HMENU hmenu2 = CreateMenu();
         HMENU hmenu2_1 = CreatePopupMenu();
         AppendMenu(hmenu2_1, MF_STRING, IDM_EXIT1, TEXT("Exit"));
         AppendMenu(hmenu2, MF_STRING | MF_POPUP | MF_MENUBREAK, (UINT_PTR)hmenu2_1, TEXT("File"));
         HMENU hmenu2_2 = CreatePopupMenu();
         AppendMenu(hmenu2_2, MF_STRING, IDM_KILL1, TEXT("Kill"));
         AppendMenu(hmenu2, MF_STRING | MF_POPUP | MF_MENUBREAK, (UINT_PTR)hmenu2_2, TEXT("Process"));
         HMENU hmenu2_3 = CreatePopupMenu();
         AppendMenu(hmenu2_3, MF_STRING, IDM_FULLSCREEN1, TEXT("Fullscreen"));
         AppendMenu(hmenu2, MF_STRING | MF_POPUP | MF_MENUBREAK, (UINT_PTR)hmenu2_3, TEXT("View"));
         HMENU hmenu2_4 = CreatePopupMenu();
         AppendMenu(hmenu2_4, MF_STRING, IDM_ABOUT1, TEXT("About"));
         AppendMenu(hmenu2_4, MF_STRING, IDM_CREDITS1, TEXT("Credits"));
         AppendMenu(hmenu2, MF_STRING | MF_POPUP | MF_MENUBREAK, (UINT_PTR)hmenu2_4, TEXT("Help"));

         HFONT hfont3 = CreateFont(-11, 0, 0, 0, 400, FALSE, FALSE, FALSE, 1, 400, 0, 0, 0, TEXT("Ms Shell Dlg 2"));
         HWND hwnd = CreateWindowEx(, WS_EX_WINDOWEDGE, TEXT("WndClass3"), TEXT("Process Killer"), WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_THICKFRAME | WS_SYSMENU, 0, 0, 287, 110, 0, 0, hInst, 0);
         HWND hCtrl3_0 = CreateWindowEx(0, WC_BUTTON, TEXT("Kill Process"), WS_VISIBLE | WS_CHILD | WS_TABSTOP, 95, 42, 75, 23, hwnd, (HMENU)IDOK, hInst, 0);
         SendMessage(hCtrl3_0, WM_SETFONT, (WPARAM)hfont3, FALSE);
         HWND hCtrl3_1 = CreateWindowEx(0, WC_COMBOBOX, 0, WS_VISIBLE | WS_CHILD | CBS_DROPDOWN | CBS_HASSTRINGS, 47, 8, 210, 23, hwnd, (HMENU)IDC_COMBO1, hInst, 0);
         SendMessage(hCtrl3_1, WM_SETFONT, (WPARAM)hfont3, FALSE);
         HWND hCtrl3_2 = CreateWindowEx(0, WC_STATIC, TEXT("Process"), WS_VISIBLE | WS_CHILD | WS_GROUP, 8, 8, 39, 13, hwnd, (HMENU)IDC_STATIC, hInst, 0);
         SendMessage(hCtrl3_2, WM_SETFONT, (WPARAM)hfont3, FALSE);
        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, 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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Apr 26, 2008 7:53 am    Post subject: Reply with quote

Use the method you like doing. There isn't really a better between the two, they result in the same thing.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Apr 26, 2008 7:58 am    Post subject: Reply with quote

I personally like creating at runtime because well. I never really was taught how to make buttons and edits with resources in my main form. Oh sure, I can do it in dialogs, but I don't want my main form to be a dialog. Even with resedit (the program Flyte suggested), it only allows creations of buttons and edits and stuff like that through a dialog. So really if I want to make buttons and stuff in my main form without it being a dialog, I gotta do it at runtime. But a link showing me how to do it with resources would be great.
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Apr 26, 2008 8:47 am    Post subject: Reply with quote

It is. But does anybody have a tutorial on how to create controls (i.e. buttons) in resources without it being a dialog.
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites