Things like windows, popup boxes, programs like notepad folders etc are all done with Windows API, You use C++ with Windows API to make a program such as the ones mentioned and more. I would suggest using Code blocks instead, as Dev C++ is very old, outdated, and not even updated anymore.
EDIT: Also, Code blocks has a win32 project type you can choose when setting up your project, its a simple window with 2 buttons. Play around with that, and learn all the syntax. Here is a list someone gave me, it describes all the keywords in the code blocks win32 project:
Hopefully im not overwhelming you withh all of this.
HWND = handle to the object(buttons, text boxes, text, etc..)
HINSTANCE = The window class name is not sufficient to identify the class uniquely so the hinstance is used to do that.
DialogProc = function name... In your case you translate messages in this function.
UINT = unsigned int
WPARAM and LPARAM = Whole win32 api is communicating trough messages. Sometimes these messages need to transfer some additional information about this message in order to understand it. So WPARAM and LPARAM holds that information.
WM_INITDIALOG = 0x0110(hex)
LOWORD and HIWORD = Like i said that all communication is done with messages and these messages sometimes need to transfer additional information. So the WPARAM and LPARAM can hold more then 2 values. This is done by splitting the WPARAM or LPARAM in to HIWORD and LOWORD. Its the same as you would split the unsigned integer(4 bytes) in to two unsigned short integers(size 2 bytes)
APIENTRY = __stdcall entry point. Most of programing languages have functions. And all these languages have their own function conversion types(in which order the parameters will be passes in this function), who will clean the mess after this function and so on. The entry point in other hand means location from where the program will start to execute. In c++ you find the main() function which does that. For example in .DLL's there are DLLMain() function which only initializes the .DLL and the rest of .DLL content can be executed trough entry points. One more example: The .DLL is a program without main() function. So you can not run it unless you tell from where to execute it. And .DLL's can be loaded(started to execute) with most of programing languages. But like i said that they treat functions differently, so these functions(entry points) in .DLL need to be in such a way that all programing languages could access it. __stdcall conversion is standard function conversion while in c/c++ standard is __cdecl. More about this :
http://msdn.microsoft.com/en-us/library ... 58(v=vs.71).aspx
hPrevInstance = will always be NULL because this variable is left from windows 95...
LPSTR = char * (pointer character array)
lpCmdLine = something like char * _argv[] in your standard c++ application. The program can be called in different ways like double clicking the icon, from command line, etc... So if the program is called from console then the main can accept char ** array parameters, which then can be translated to numbers, constants etc.. Notice that its is meant to hold console parameters, not holding...
nShowCmd = The flags that specify how an application is to be displayed when it is opened. Minimized, maximized, tray, etc...
MAKEINTRESOURCE = converts integral value to resource type compatible.
DLG_MAIN = integral value. All your resources must have some kind of ID. In most cases it will be some kind of number. In this case this particular resource have its value : DLG_MAIN. Check out the resource files and header files. You should find the actual resource and where DLG_MAIN is defined and whats its value.
WinMain = main() in standard c++ (main entry point)
Here is a simple text editor i made, its nowhere near good or done, but it works and hopefully it will help you:
Main.cpp:
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "resource.h"
#include <fstream>
#include <string>
using namespace std;
HINSTANCE hInst;
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG: //Initiates the window
//Menu Initialization
{
HMENU hMenu = LoadMenu(GetModuleHandle(0), MAKEINTRESOURCE(Menuone));
SetMenu(hwndDlg, hMenu);
}
return TRUE;
case WM_CLOSE:
EndDialog(hwndDlg, 0);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case ID_Save:
{
ofstream file("save.txt");
char tmp[MAX_PATH+1] = {0};
GetDlgItemText(hwndDlg, 3, tmp, MAX_PATH);
file << tmp;
file.close();
}return TRUE;
case ID_Exit:
{
EndDialog(hwndDlg, 0);
}return TRUE;
case ID_Load:
{
MessageBox(hwndDlg, "This option is not functional yet", "Error", MB_ICONERROR);
}return TRUE;
}
}
return FALSE;
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
hInst = hInstance;
// The user interface is a modal dialog box
return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)DialogProc);
}
|
Resource.rc:
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#include "resource.h"
DLG_MAIN DIALOGEX 280, 170, 300, 162
CAPTION "TexEd V. 1.1.1 Alpha"
FONT 8, "Tahoma"
STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
BEGIN
EDITTEXT 3, 0, 0, 300, 150, ES_MULTILINE | ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL
END
//The menu for the program
Menuone MENU
{
POPUP "File"
{
MENUITEM "Save", ID_Save
MENUITEM "Load", ID_Load
MENUITEM "Exit", ID_Exit
}
}
//Reference
/*
{
MENUITEM "&Soup", 100
MENUITEM "&Salad", 101
POPUP "&Entree"
{
MENUITEM "&Fish", 200
MENUITEM "&Chicken", 201
POPUP "&Beef"
{
MENUITEM "&Steak", 301
MENUITEM "&Prime Rib", 302
}
}
MENUITEM "&Dessert", 103
}
*/
Icon ICON "Resources/Txt.ico"
|
Resource.h:
#include <windows.h>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include <windows.h>
// ID of Main Dialog
#define DLG_MAIN 101
#define text 1
#define Icon 2
#define Menuone 3
//Menu Item ID's
#define ID_Save 6
#define ID_Load 7
#define ID_Exit 8
|