Mehh -2

I have recopied the code, re arranged it and it still won't work...
[CODE]#include

include "resource.h"

const char g_szClassName[] = "myWindowClass";
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
BOOL CALLBACK SimpleProc(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam);
}
DialogBox(hInstance, MAKEINTRESOURCE(IDD_SIMPLECONTROL), NULL, SimpleProc);LPARAM lParam){switch(Message)
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch ( LOWORD (wParam) ) {
break;
case ID_HELLO:
MessageBox(NULL,"Hey", "Hallo!", MB_OK);
break;
case ID_FILE_EXIT:
EndDialog(hWndDlg, 0)
break;
case WM_CLOSE:
EndDialog(hWndDlg, 0);
break;
default:
return TRUE;}[/CODE]

Anyone who is willing to help, please reply.

Mehh -2

i just need an example of what am i doing wrong in this one, i did not ask you what books to read or where to start...

Mehh -2

[QUOTE=Narue;1329752]In other words, you don't know anything about C++ and just randomly pasted the contents of a tutorial into your text editor. What a surprise that it doesn't compile. :icon_rolleyes:[/QUOTE]

This is C section, i know primitive functions but can never write on my own... my whole programs are combination of various code snippets, this one is dialog box example, which im struggling to find for a year. Now that i found it, it fails to compile because "SimpleProc" is not defined. and that is the only error im getting.

Mehh -2

I copied this code from WikiHow

[url]http://www.wikihow.com/Make-a-Window-%28an-Application%29[/url]

How friendly of you, seriously. nice community

Mehh -2 Newbie Poster

[CODE]#include

include "resource.h"

const char g_szClassName[] = "myWindowClass";
return; DialogBox(hInstance, MAKEINTRESOURCE(IDD_SIMPLECONTROL), NULL, SimpleProc);}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
BOOL CALLBACK SimpleProc(HWND hWndDlg, UINT Message, WPARAM wParam,
LPARAM lParam){switch(Message){
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:switch ( LOWORD (wParam) ) {
case ID_HELLO:MessageBox(NULL,"Hey", "Hallo!", MB_OK);
break;
case ID_FILE_EXIT:EndDialog(hWndDlg, 0)
break;
case WM_CLOSE:EndDialog(hWndDlg, 0);
break;
default:
return FALSE;}
return TRUE;}[/CODE]

what am i doing wrong??

mvmalderen commented: Rrrrrrrubbbbbiiisssh! -2

Mehh -2

[QUOTE=Ancient Dragon;1024381]This is what I get when I run your program[/QUOTE]

but can you open the dialog box?

Mehh -2

[QUOTE=Ancient Dragon;1024305]>> pszFileText = LPSTR(GlobalAlloc(GPTR, dwFileSize + 1));

typecast is wrong: [icode] pszFileText = (LPSTR)GlobalAlloc(GPTR, dwFileSize + 1);[/icode]

Add this to the top of the *.rc file [icode]#include [/icode]

You have to add comctl32.lib to the list of libraries. For your compiler it probably has .a extension instead of .lib.[/QUOTE]

Thank you but now it only can compile it but it wont show up when i click on it

Mehh -2 Newbie Poster

Well, im a beginner programmer, trying to make my own proggy in Dev C++ but i have massive problem with dialog, this doesnt work (using mdi example):

mdi_unit.h
[CODE]#define CM_WINDOW_TILEVERT 9084

define CM_WINDOW_TILEHORZ 9083
define CM_WINDOW_ARRANGE 9082
define CM_WINDOW_TILE 9081
define CM_WINDOW_CASCADE 9080
define CM_EDIT_PASTE 9079
define CM_EDIT_COPY 9078
define CM_EDIT_CUT 9077
define CM_EDIT_UNDO 9076
define CM_EDIT_REDO 9075
define CM_FILE_SAVEAS 9074
define CM_FILE_SAVE 9073
define CM_FILE_OPEN 9072
define CM_FILE_EXIT 9071
define CM_FILE_NEW 9070
define CM_HELP_ABOUT 9069
define CM_HELP_TIPS 9068
define IDM_HELPCONTENTS 9067
define IDM_HELPSEARCH 9066
define IDM_HELPHELP 9065
define CM_SHOW_MAINBAR 9064
define CM_HIDE_MAINBAR 9063
define CM_FORMAT_WORDWRAP 9062
define CM_LAUNCH_CALCULATOR 9061
define CM_LAUNCH_PAINT 9060
define CM_LAUNCH_CP 9059
define CM_LAUNCH_SR 9058
define CM_LAUNCH_VC 9057
define CM_LAUNCH_WE 9056
define CM_LICENSE 9055
define CM_SHOW_STATUSBAR 9054
define CM_HIDE_STATUSBAR 9053
define CM_SHOW_EDITAREA 9052
define CM_HIDE_EDITAREA 9051
define CM_SHOW_ALL 9050
define CM_HIDE_ALL 9049
define CM_MOVE_STATUSBAR 9048
define CM_RESTORE_STATUSBAR 9047
define CM_MOVE_EDITAREA 9046
define CM_RESTORE_EDITAREA 9045
define CM_RESTORE_ALL 9044
define CM_MOVE_ALL 9043
define CM_RECYCLER 9042
define CM_LAUNCH_RE 9041
define CM_LAUNCH_CHARMAP 9040
define CM_LAUNCH_TM 9039
define CM_DIALOGXD 9038[/CODE]

mdi_unit.c
[CODE]#include

include
include
include
include "mdi_unit.h"
define ID_STATUSBAR 4997
define ID_TOOLBAR 4998
define ID_MDI_CLIENT 4999
define ID_MDI_FIRSTCHILD 50000
define IDC_CHILD_EDIT 2000

LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK MDIChildWndProc(HWND hwnd, UINT Message, WPARAM wParam,
LPARAM lParam);

char g_szAppName[] = "MyMDIWindow";
char g_szChild[] = "MyMDIChild";
HINSTANCE g_hInst;
HWND g_hMDIClient, g_hStatusBar, g_hToolBar, DialogBox;
HWND g_hMainWindow;

BOOL LoadFile(HWND hEdit, LPSTR pszFileName)
{
HANDLE hFile;
BOOL bSuccess = FALSE;

hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, ...

Mehh -2

Simply click on Starting C topic.

Mehh -2

Yes it worked!! Thank you very much, I can make the text look bigger!! No more eye rape :D

Mehh -2 Newbie Poster

Hello all, im Mehh and this is my first post. Im also a rookie in programming and im making Multi Document Interface program from a MDI Example in DevC++. My problem is that i cannot change Font Size in MDI example and its so small that my friends cant even read it :S, if anyone can show me how to make it bigger i would be thankfull, Atleast Font size to be 12, Here is the source code im working on:
[code=c]

include
include
include "mdi_unit.h"
define ID_STATUSBAR 4997
define ID_TOOLBAR 4998
define ID_MDI_CLIENT 4999
define ID_MDI_FIRSTCHILD 50000
define IDC_CHILD_EDIT 2000

LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK MDIChildWndProc(HWND hwnd, UINT Message, WPARAM wParam,
LPARAM lParam);

char g_szAppName[] = "MyMDIWindow";
char g_szChild[] = "MyMDIChild";
HINSTANCE g_hInst;
HWND g_hMDIClient, g_hStatusBar, g_hToolBar;
HWND g_hMainWindow;

BOOL LoadFile(HWND hEdit, LPSTR pszFileName)
{
HANDLE hFile;
BOOL bSuccess = FALSE;

hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwFileSize;
dwFileSize = GetFileSize(hFile, NULL);
if(dwFileSize != 0xFFFFFFFF)
{
LPSTR pszFileText;
pszFileText = LPSTR(GlobalAlloc(GPTR, dwFileSize + 1));
if(pszFileText != NULL)
{
DWORD dwRead;
if(ReadFile(hFile, pszFileText, dwFileSize, &dwRead, NULL))
{
pszFileText[dwFileSize] = 0; // Null terminator
if(SetWindowText(hEdit, pszFileText))
bSuccess = TRUE; // It worked!
}
GlobalFree(pszFileText);
}
}
CloseHandle(hFile);
}
return bSuccess;
}

BOOL SaveFile(HWND hEdit, LPSTR pszFileName)
{
HANDLE hFile;
BOOL bSuccess = FALSE;

hFile = CreateFile(pszFileName, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit);
if(dwTextLength > 0)// ...