Jump to content
Sign in to follow this  
shah_animator

Soalan Pasal C

Recommended Posts

akum..

ni ada soklan skit..

aku ada dpt soalan final project wat satu program pakai c language.. sebelum ni tak nah blaja pasal c pun pasal aku bukan budak sains komp. atau pun programming, aku budak sis. komp...

aku cadang nak wat pogram cam diari.. kira leh masukkan data tentang catatan kehidupan harian..

soalanyer.. leh ker c ni wat program berasaskan gui? ada button, gambar, sebab aku tgk sample kat internet semuanyer nampak cam ms dos jer.. klu yg ada gui pun dia pakai c++... c tak leh ker?

tu jer.. harap korang dpt tolong.. (aku dah berjaya wat hello world.. lol)

Share this post


Link to post
Share on other sites

akum..

ni ada soklan skit..

aku ada dpt soalan final project wat satu program pakai c language.. sebelum ni tak nah blaja pasal c pun pasal aku bukan budak sains komp. atau pun programming, aku budak sis. komp...

aku cadang nak wat pogram cam diari.. kira leh masukkan data tentang catatan kehidupan harian..

soalanyer.. leh ker c ni wat program berasaskan gui? ada button, gambar, sebab aku tgk sample kat internet semuanyer nampak cam ms dos jer.. klu yg ada gui pun dia pakai c++... c tak leh ker?

tu jer.. harap korang dpt tolong.. (aku dah berjaya wat hello world.. lol)

mmg kena guna C ka?

ko dah try ke cari souce code , for VB?

try la google

[tak pandai sangat bab programming .. hehehe but i got 1A in SPM dalam bahasa pengaturcaraan VB huhuh]

Edited by Navigator®

Share this post


Link to post
Share on other sites

Hehehe.... tahniah kepada ko berjaya buat output hello world.. hehe...

Untuk cipta GUI dalam C pertama sekali kena ada dia punya Visual Simulator. Biasanya, aku pakai Microsoft Visual C++ untuk benda-benda GUI dalam C nih. Senang skit kalau nak dibandingkan dengan Borland tapi Borland is much powerful than Visual C++.

Share this post


Link to post
Share on other sites

Hehehe.... tahniah kepada ko berjaya buat output hello world.. hehe...

Untuk cipta GUI dalam C pertama sekali kena ada dia punya Visual Simulator. Biasanya, aku pakai Microsoft Visual C++ untuk benda-benda GUI dalam C nih. Senang skit kalau nak dibandingkan dengan Borland tapi Borland is much powerful than Visual C++.

haaa.. dengar tuh Sifo aku ajar .. huhuhuhu

Share this post


Link to post
Share on other sites

haaa.. dengar tuh Sifo aku ajar .. huhuhuhu

Haih... banyak lagi orang yang lebih tau mengenai C berbading aku yang tak beberapa pandai nih :( .......

Share this post


Link to post
Share on other sites

Acu cuba try test guna Pelles C,

Features:

* Integrated resource editor.

* Integrated bitmap, icon and cursor editor.

* Integrated animated cursor and video editor.

* Integrated hex-dump editor.

* Integrated source-level debugger.

* Integrated source code editor with Win32 API call tips.

* Project management.

* Inline assembler with Intel syntax.

* Support for custom controls in the dialog editor.

* Support for additional project wizards.

* Support for Microsoft's exception handling: __try, __except, __finally, __leave.

* Support for Microsoft's new import libraries.

* Support for delayed loading of DLL's, much like Microsoft.

* Support for most C99 features.

* Support for Pocket PC.

* Pelles C is free!

Pelles C

Share this post


Link to post
Share on other sites

GUI stands for Graphical User Interface. Untuk bina program berasaskan GUI, u kena guna programming interface yang disediakan oleh GUI-based system, e.g Windows, X, dan sebagainya. The language itself hanya provide kemudahan untuk akses programming interface ni. In case u guna Windows, bleh refer kepada Platform SDK nyer documentation, download foc kat M$ nyer website.

Share this post


Link to post
Share on other sites

hurm.. skang ni aku pakai / install dua compiler.. pelles c ngan visual c++ 6.0

ni pic utk program yg aku wat pakai pelles c... visual c++ 6.0 aku tak try lagi..

Diari.jpg

aku tak tau lagi camner nak wat bila klik button about keluar menu about.. klik button address book keluar menu address book..

sample program.. tak siap lagi.. :P

http://www.freewebs.com/shah_animator/Diari.zip

or

http://www.freewebs.com/shah_animator/download.htm

Share this post


Link to post
Share on other sites

[hmm... hebat gak prog yg ko buat...

aku buat program kalkulator jer untuk add math heher....

C memang besh!!

Share this post


Link to post
Share on other sites

hurm.. skang ni aku pakai / install dua compiler.. pelles c ngan visual c++ 6.0

ni pic utk program yg aku wat pakai pelles c... visual c++ 6.0 aku tak try lagi..

Diari.jpg

aku tak tau lagi camner nak wat bila klik button about keluar menu about.. klik button address book keluar menu address book..

sample program.. tak siap lagi.. :P

http://www.freewebs.com/shah_animator/Diari.zip

or

http://www.freewebs.com/shah_animator/download.htm

erkk..

meh cuba about button

dekat command untuk setiap button ko letak msg box or create new form

for example

MsgBox "about me blah blah blah"

kalau ko nak letak style or lebih advance kena buat satu satu , kena buat ikut formula

Share this post


Link to post
Share on other sites

[hmm... hebat gak prog yg ko buat...

aku buat program kalkulator jer untuk add math heher....

C memang besh!!

program aku tu mana hebat sangat.. aku main drag & drop jer button tu..

erm navigator.. aku main drag and drop jer.. so kurang skit bila masuk bab command ni.. (masih blur lagi..)

aku cari untuk command utk button takder pun.. ni source code dia.. utk main.c

cam ner ek nak wat message box tu.. (aku pakai pelles c)

/****************************************************************************

* *

* File : main.c *

* *

* Purpose : Generic dialog based Win32 application. *

* *

* History : Date Reason *

* 00/00/00 Created *

* *

****************************************************************************/

/*

* Either define WIN32_LEAN_AND_MEAN, or one or more of NOCRYPT,

* NOSERVICE, NOMCX and NOIME, to decrease compile time (if you

* don't need these defines -- see windows.h).

*/

#define WIN32_LEAN_AND_MEAN

/* #define NOCRYPT */

/* #define NOSERVICE */

/* #define NOMCX */

/* #define NOIME */

#include <windows.h>

#include <windowsx.h>

#include <commctrl.h>

#include <tchar.h>

#include "main.h"

/** Prototypes **************************************************************/

static LRESULT CALLBACK MainDlgProc(HWND, UINT, WPARAM, LPARAM);

/** Global variables ********************************************************/

static HANDLE ghInstance;

/****************************************************************************

* *

* Function: WinMain *

* *

* Purpose : Initialize the application. Register a window class, *

* create and display the main window and enter the *

* message loop. *

* *

* History : Date Reason *

* 00/00/00 Created *

* *

****************************************************************************/

int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)

{

WNDCLASSEX wcx;

ghInstance = hInstance;

// Initialize common controls. Also needed for MANIFEST's.

InitCommonControls();

// Load Rich Edit control support.

// TODO: uncomment one of the lines below, if you are using a Rich Edit control.

// LoadLibrary(_T("riched32.dll")); // Rich Edit v1.0

// LoadLibrary(_T("riched20.dll")); // Rich Edit v2.0, v3.0

// Get system dialog information.

wcx.cbSize = sizeof(wcx);

if (!GetClassInfoEx(NULL, MAKEINTRESOURCE(32770), &wcx))

return 0;

// Add our own stuff.

wcx.hInstance = hInstance;

wcx.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDR_ICO_MAIN));

wcx.lpszClassName = _T("DiariClass");

if (!RegisterClassEx(&wcx))

return 0;

// The user interface is a modal dialog box.

return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)MainDlgProc);

}

/****************************************************************************

* *

* Function: MainDlgProc *

* *

* Purpose : Process messages for the Main dialog. *

* *

* History : Date Reason *

* 00/00/00 Created *

* *

****************************************************************************/

static LRESULT CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

{

switch (uMsg)

{

case WM_INITDIALOG:

/*

* TODO: Add code to initialize the dialog.

*/

return TRUE;

case WM_SIZE:

/*

* TODO: Add code to process resizing, when needed.

*/

return TRUE;

case WM_COMMAND:

switch (GET_WM_COMMAND_ID(wParam, lParam))

{

/*

* TODO: Add more control ID's, when needed.

*/

case IDOK:

EndDialog(hwndDlg, TRUE);

return TRUE;

}

break;

case WM_CLOSE:

EndDialog(hwndDlg, 0);

return TRUE;

/*

* TODO: Add more messages, when needed.

*/

}

return FALSE;

}

Share this post


Link to post
Share on other sites

Cuba add satu button dan berikan Nama IDC_BTN_TEST (double click button nih dan tukar "Name" property). Untuk berikan command kepada button ni, kena tambah kod kat di bawah komen /* TODO: Add more control ID's, when needed.*/ tu. Contohnya, untuk paparkan message box bila button ni diklik, kod yang berkaitan adalah :

static LRESULT CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
    switch (uMsg) {
        case WM_INITDIALOG:
        /*
        * TODO: Add code to initialize the dialog.
        */
            return TRUE;

        case WM_SIZE:
        /*
        * TODO: Add code to process resizing, when needed.
        */
            return TRUE;

        case WM_COMMAND:
        switch (GET_WM_COMMAND_ID(wParam, lParam)) {
        /*
        * TODO: Add more control ID's, when needed.
        */

        /*kita tambah kod di sini*/
        case IDC_BTN_TEST:
            MessageBox(hwndDlg, _T("Hello World"), _T("Test"), MB_ICONINFORMATION);
      return TRUE;
    /*------------------------*/

        case IDOK:
            EndDialog(hwndDlg, TRUE);
            return TRUE;
        }
        break;

        case WM_CLOSE:
            EndDialog(hwndDlg, 0);
            return TRUE;

        /*
        * TODO: Add more messages, when needed.
        */
}

Program yang u develop kat atas gunakan dialog box sebagai main window... biasanya orang tak buat camni (tapi of course laa tak salah) dan fungsi MainDlgProc tu adalah DialogProc untuk main dialog u dan kat sini laa u handle semer message dari sistem atau user. e.g mesej WM_CLOSE, WM_INITDIALOG, WM_SIZE dan macam2 lagi laa.. as u need to handle more messages, u tambah laa handler under block switch(uMsg) nih.

Share this post


Link to post
Share on other sites

Cuba add satu button dan berikan Nama IDC_BTN_TEST (double click button nih dan tukar "Name" property). Untuk berikan command kepada button ni, kena tambah kod kat di bawah komen /* TODO: Add more control ID's, when needed.*/ tu. Contohnya, untuk paparkan message box bila button ni diklik, kod yang berkaitan adalah :

static LRESULT CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
    switch (uMsg) {
        case WM_INITDIALOG:
        /*
        * TODO: Add code to initialize the dialog.
        */
            return TRUE;

        case WM_SIZE:
        /*
        * TODO: Add code to process resizing, when needed.
        */
            return TRUE;

        case WM_COMMAND:
        switch (GET_WM_COMMAND_ID(wParam, lParam)) {
        /*
        * TODO: Add more control ID's, when needed.
        */

        /*kita tambah kod di sini*/
        case IDC_BTN_TEST:
            MessageBox(hwndDlg, _T("Hello World"), _T("Test"), MB_ICONINFORMATION);
      return TRUE;
    /*------------------------*/

        case IDOK:
            EndDialog(hwndDlg, TRUE);
            return TRUE;
        }
        break;

        case WM_CLOSE:
            EndDialog(hwndDlg, 0);
            return TRUE;

        /*
        * TODO: Add more messages, when needed.
        */
}

Program yang u develop kat atas gunakan dialog box sebagai main window... biasanya orang tak buat camni (tapi of course laa tak salah) dan fungsi MainDlgProc tu adalah DialogProc untuk main dialog u dan kat sini laa u handle semer message dari sistem atau user. e.g mesej WM_CLOSE, WM_INITDIALOG, WM_SIZE dan macam2 lagi laa.. as u need to handle more messages, u tambah laa handler under block switch(uMsg) nih.

hokhokhok aku tak pandai bahasa C ... aku tau visual asas je... hokhokhok ^^

Share this post


Link to post
Share on other sites

ancient one... thanks utk command tu.. aku dah leh wat message box.. untuk button about.. (tukar info sebab nak wat program bahasa melayu.. klu tulis tentang jadi pelik lak.. :D

Info.jpg

ni code yg aku pakai..

case IDC_BTN_TEST:

MessageBox(hwndDlg, _T(" Diari Versi 1.0.\n Aplikasi ini dibangunkan untuk memudahkan pelajar menguruskan kehidupan seharian mereka.\n Aplikasi ini adalah percuma, ia boleh diedar dan diguna untuk kegunaan peribadi.\n"), _T("Info"), MB_ICONINFORMATION);

return TRUE;

hurm aku nak try explore lagi untuk wat interface diari, buku alamat dan galeri (picture gallery..)

Share this post


Link to post
Share on other sites

bleh jugak buat about box yg lebih kompleks dengan satu lagi dialog box, gunakan DialogBox api. aper2 pun tu cuma contoh jer, basically u bleh letak aper yg u nak sebagai handler untuk button click tu.

Share this post


Link to post
Share on other sites

[apasal susah sangat huh nak download peles C ??

baru 10% dan habis download...

kadang-kadang aku dengan best nya downlod 70% dah habis download....

bila aku bukak file error sebab tak habis download lagi!!

Share this post


Link to post
Share on other sites

tumpang thread .. aku ada prob sket neh

cuba check code aku


#include <stdio.h>

main ()

{
      cout << "blah blah blah";
             << end1
             << "blah blah blah";
             << end1
             << "blah blah blah ";
             <<end1 <<end1
      return 0;
}

apsal aku compile.. ada debg kat cout?

im newbie.. just baru blaja c

Share this post


Link to post
Share on other sites

Heheh navigator.. sebab ko salah guna library (include)..

cout tu untuk c++.. dan library untuk cout ialah iostream.h bukan stdio.h.. kalo pakai stdio.h ko takleh guna cout tapi ko guna printf() untuk paparkan output.. Selamat mencuba..

Share this post


Link to post
Share on other sites

Heheh navigator.. sebab ko salah guna library (include)..

cout tu untuk c++.. dan library untuk cout ialah iostream.h bukan stdio.h.. kalo pakai stdio.h ko takleh guna cout tapi ko guna printf() untuk paparkan output.. Selamat mencuba..

owh... salah libary la nih...

ok ok aku try guna isotream.h

thks

Share this post


Link to post
Share on other sites

erm.. dah lama tak pos.. :P

ni aku prob baru.. nak link satu button ngan satu dialog lain.. button tu aku letak nama IDC_MANUAL dan dialog tu aku letak IDM_MANUAL

ni code yang aku wat.

case IDC_MANUAL:

(kat sini tak tau nak letak aper.. klu letak messagebox dia akan wat dialog baruu..)

return TRUE;

ni gambar dialog tu

Manual%20Website.JPG

ni gambar main dialog (tempat button IDC_MANUAL tu)

Diari%20Website.JPG

dan ada lagi satu.. camner nak wat hyperlink kat dialog Info untuk ke website... (gambar lain dari yang asal..)

Info%20Website.JPG

case IDC_BTN_TEST:

MessageBox(hwndDlg, _T(" Diari Versi 1.0.\n Aplikasi ini dibangunkan untuk memudahkan pelajar menguruskan kehidupan seharian mereka.\n Aplikasi ini adalah percuma, ia boleh diedar dan diguna untuk kegunaan peribadi.\n http://www.freewebs.com/ediari\n"), _T("Info"), MB_ICONINFORMATION);

return TRUE;

ni link untuk aplikasi yang aku tgh bangunkan ni.. kira cam official website.. :lol:

http://www.freewebs.com/ediari/

Edited by shah_animator

Share this post


Link to post
Share on other sites

hyperlink bleh gunakan "syslink" control.

dan untuk paparkan dialog box baru, bleh gunakan DialogBox* API. sila rujuk psdk untuk keterangan lanjut.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...