need program

Hi,

I created a "program" on cmd but i want to make interface and something more on that i think c++ can do this but i dont know how maybe some one can help me i try to discribe how i imagine what i want
1. Then you open .exe file show window where you can enter numbers
2. then you enter numbers and press button "show" it shows you picture from directory. There are about 6000 pictures with names from M1 to M6000 but real name of them is diferent then file name
3. So then you enter real name and then press show it opens you that picture you want to see. Program doesent close
4. if there is no such name then get ERROR Incorect name and if there is no such file but there is such name another ERROR.


this is how i did this in CMD

ECHO OFF
CLS
:MENU
ECHO Enter number
SET /p K=
IF %K%==07106 START O:\BREZ\MSKAM\MSKWMF\M156.WMF
IF %K%==08124 START O:\BREZ\MSKAM\MSKWMF\M825.WMF
IF %K%==09210 START O:\BREZ\MSKAM\MSKWMF\M1480.WMF
IF %K%==92446 START O:\BREZ\MSKAM\MSKWMF\M793.WMF
.......
more 6000 lines later will be more..
.......
GOTO MENU


#include <windows.h>

#define ID_EDIT 1


LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{

static HWND hwndEdit;
static int len;
static TCHAR text[30];


switch(msg)
{
case WM_CREATE:
hwndEdit = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER,
65, 10, 150, 20, hwnd, (HMENU) ID_EDIT,
NULL, NULL);

CreateWindow(
TEXT("button"), TEXT("Show file"),
WS_VISIBLE | WS_CHILD,
65, 50, 150, 25,
hwnd, (HMENU) 1, NULL, NULL);

CreateWindow(
TEXT("button"), TEXT("HELP"),
WS_VISIBLE | WS_CHILD,
65, 85, 150, 25,
hwnd, (HMENU) 2, NULL, NULL);

CreateWindow(
TEXT("button"), TEXT("QUIT"),
WS_VISIBLE | WS_CHILD,
65, 120, 150, 25,
hwnd, (HMENU) 3, NULL, NULL);

break;

case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED) {
len = GetWindowTextLength(hwndEdit) + 1;
GetWindowText(hwndEdit, text, len);
SetWindowText(hwnd, text);

if (LOWORD(wParam) == 3) {
PostQuitMessage(0);
}
}
break;

case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
MSG msg ;
WNDCLASS wc = {0};
wc.lpszClassName = TEXT( "Edit Control" );
wc.hInstance = hInstance ;
wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
wc.lpfnWndProc = WndProc ;
wc.hCursor = LoadCursor(0,IDC_ARROW);


RegisterClass(&wc);
CreateWindow( wc.lpszClassName, TEXT("Edit control"),
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
220, 220, 280, 180, 0, 0, hInstance, 0);

while( GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}


Edited: now i think QUIT button work and other buttons change title of window

Only the buttons dosent functionate :) but thats what i want now i only need to make them functionate Any ideas ? :)

Last edited on
Topic archived. No new replies allowed.