Results 1 to 18 of 18

Thread: A Window

  1. #1

    Thread Starter
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Post A Window

    Code:
    //CREATOR TOM ZHANG, 12 YEARS OLD
    
    #include <windows.h>
    const char g_szClassName[] = "myWindowClass";
    LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
    	switch(msg){
    	case WM_CLOSE:
    		DestroyWindow(hwnd);
    		break;
    	case WM_DESTROY:
    		PostQuitMessage(0);
    		break;
    	default:
    		return DefWindowProc(hwnd,msg,wParam,lParam);
    	}
    	return 0;
    }
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow){
    	WNDCLASSEX wc;
    	HWND hwnd;
    	MSG Msg;
    
    
    	wc.cbSize =sizeof(WNDCLASSEX);
    	wc.style = 0;
    	wc.lpfnWndProc =WndProc;
    	wc.cbClsExtra=0;
    	wc.cbWndExtra =0;
    
    	wc.hInstance = hInstance;
    	wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
    	wc.hCursor=LoadCursor(NULL,IDC_ARROW);
    	wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
    	wc.lpszMenuName=NULL;
    	wc.lpszClassName=g_szClassName;
    	wc.hIconSm = LoadIcon(NULL,IDI_APPLICATION);
    
    	if(!RegisterClassEx(&wc)){
    		return 0;
    	}
    
    	hwnd = CreateWindowEx(CW_USEDEFAULT,g_szClassName,"Cool Man",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,500,800,NULL,NULL,hInstance,NULL);
    	if(hwnd==NULL){
    		return 0;
    	}
    	ShowWindow(hwnd, nCmdShow);
    	UpdateWindow(hwnd);
    	MessageBox(NULL,"Visual C++ Coding is much but cool!","From Tom Zhang",MB_OK);
    	while(GetMessage(&Msg,NULL,0,0)){
    		TranslateMessage(&Msg);
    			DispatchMessage(&Msg);
    	}
    	Msg.wParam;
    }
    That code works... Just wanna know how to DISPLAY A TEXT ON THE PROGRAM...

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    What do you mean? If you mean cretinf a textbox then use the CreateWindow API but pass "EDIT" as the class name parameter. That will crete a text box. To put text in the text box use the SetWindowText API or send the WM_SETTEXT message.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    If you just want to draw the text on the window then try this code:

    PHP Code:
    //CREATOR TOM ZHANG, 82 YEARS OLD

    #include <windows.h>
    const char g_szClassName[] = "myWindowClass";
    LRESULT CALLBACK WndProc(HWND hwndUINT msgWPARAM wParamLPARAM lParam)
    {
      
    RECT rect;
      
    HDC winhdc;

        switch(
    msg){
                    case 
    WM_PAINT:
           
    GetClientRect(hwnd, &rect);
           
    winhdc BeginPaint(hwnd, &ps);
           
    DrawText(winhdc"The Text", -1, &rectDT_CENTER |  DT_VCENTER DT_SINGLELINE);
           
    EndPaint(hwnd, &ps);
           return 
    0;
        case 
    WM_CLOSE:
            
    DestroyWindow(hwnd);
            break;
        case 
    WM_DESTROY:
            
    PostQuitMessage(0);
            break;
        default:
            return 
    DefWindowProc(hwnd,msg,wParam,lParam);
        }
        return 
    0;
    }
    int WINAPI WinMain(HINSTANCE hInstanceHINSTANCE hPrevInstance,LPSTR lpCmdLineint nCmdShow){
        
    WNDCLASSEX wc;
        
    HWND hwnd;
        
    MSG Msg;


        
    wc.cbSize =sizeof(WNDCLASSEX);
        
    wc.style 0;
        
    wc.lpfnWndProc =WndProc;
        
    wc.cbClsExtra=0;
        
    wc.cbWndExtra =0;

        
    wc.hInstance hInstance;
        
    wc.hIcon LoadIcon(NULL,IDI_APPLICATION);
        
    wc.hCursor=LoadCursor(NULL,IDC_ARROW);
        
    wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
        
    wc.lpszMenuName=NULL;
        
    wc.lpszClassName=g_szClassName;
        
    wc.hIconSm LoadIcon(NULL,IDI_APPLICATION);

        if(!
    RegisterClassEx(&wc)){
            return 
    0;
        }

        
    hwnd CreateWindowEx(CW_USEDEFAULT,g_szClassName,"Cool Man",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,500,800,NULL,NULL,hInstance,NULL);
        if(
    hwnd==NULL){
            return 
    0;
        }
        
    ShowWindow(hwndnCmdShow);
        
    UpdateWindow(hwnd);
        
    MessageBox(NULL,"Visual C++ Coding is much but cool!","From Tom Zhang",MB_OK);
        while(
    GetMessage(&Msg,NULL,0,0)){
            
    TranslateMessage(&Msg);
                
    DispatchMessage(&Msg);
        }
        
    Msg.wParam;

    Baaaaaaaaah

  4. #4
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    ohh sorry,

    Just put:

    Code:
    PAINTSTRUCT ps;
    in the declarations - under the dec "HDC winhdc" or "RECT rect"
    Baaaaaaaaah

  5. #5
    Aragorn
    Guest
    just add the declaration of the PAINTSTRUCT at the beginning of the WndProc.
    Code:
    LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
      RECT rect;
      HDC winhdc;
      PAINTSTRUCT ps;   //           <<--    Here  !!
    
        switch(msg){
                    case WM_PAINT:
           GetClientRect(hwnd, &rect);
           winhdc = BeginPaint(hwnd, &ps);
           DrawText(winhdc, "The Text", -1, &rect, DT_CENTER |  DT_VCENTER | DT_SINGLELINE);
           EndPaint(hwnd, &ps);
           return 0;
        case WM_CLOSE:
     // etc...
    }
    The PAINTSTRUCT contains information about the properties of the things to be drawed such as color and thickness (of lines)

  6. #6

    Thread Starter
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Post Thanks

    It worked, but how come it's like a Tiled Wallpaper? When I enlarge it, it has a lot of the text...

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  7. #7
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Just put a static conrtol on your window.....

    PHP Code:
    HWND MyStatic
    MyStatic 
    CreateWindow("Static""I am Prog_Tom's Static Control"WS_CHILD WS_VISIBLE0015020hwndNULLhInstanceNULL); 

    and poof.....you have a static box

  8. #8
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    so here would be your new code

    PHP Code:
    //CREATOR TOM ZHANG, 12 YEARS OLD

    #include <windows.h>
    const char g_szClassName[] = "myWindowClass";
    LRESULT CALLBACK WndProc(HWND hwndUINT msgWPARAM wParamLPARAM lParam){
        switch(
    msg){
        case 
    WM_CLOSE:
            
    DestroyWindow(hwnd);
            break;
        case 
    WM_DESTROY:
            
    PostQuitMessage(0);
            break;
        default:
            return 
    DefWindowProc(hwnd,msg,wParam,lParam);
        }
        return 
    0;
    }
    int WINAPI WinMain(HINSTANCE hInstanceHINSTANCE hPrevInstance,LPSTR lpCmdLineint nCmdShow){
        
    WNDCLASSEX wc;
        
    HWND hwnd;
        
    MSG Msg;


        
    wc.cbSize =sizeof(WNDCLASSEX);
        
    wc.style 0;
        
    wc.lpfnWndProc =WndProc;
        
    wc.cbClsExtra=0;
        
    wc.cbWndExtra =0;

        
    wc.hInstance hInstance;
        
    wc.hIcon LoadIcon(NULL,IDI_APPLICATION);
        
    wc.hCursor=LoadCursor(NULL,IDC_ARROW);
        
    wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
        
    wc.lpszMenuName=NULL;
        
    wc.lpszClassName=g_szClassName;
        
    wc.hIconSm LoadIcon(NULL,IDI_APPLICATION);

        if(!
    RegisterClassEx(&wc)){
            return 
    0;
        }

        
    hwnd CreateWindowEx(CW_USEDEFAULT,g_szClassName,"Cool Man",WS_OVERLAPPEDWINDOW,0,0,300,200,NULL,NULL,hInstance,NULL);
        
    HWND MyStatic;
        
    MyStatic CreateWindow("Static""I am Prog_Tom's Static Control"WS_CHILD WS_VISIBLE0020020hwndNULLhInstanceNULL);

        if(
    hwnd==NULL){
            return 
    0;
        }
        
    ShowWindow(hwndnCmdShow);
        
    UpdateWindow(hwnd);
        
    MessageBox(NULL,"Visual C++ Coding is much but cool!","From Tom Zhang",MB_OK);
        while(
    GetMessage(&Msg,NULL,0,0)){
            
    TranslateMessage(&Msg);
                
    DispatchMessage(&Msg);
        }
        
    Msg.wParam;

    enjoy

  9. #9
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    I just made a little change. So here is the new code

    PHP Code:
    //CREATOR TOM ZHANG, 85 YEARS OLD

    #include <windows.h>
    const char g_szClassName[] = "myWindowClass";
    LRESULT CALLBACK WndProc(HWND hwndUINT msgWPARAM wParamLPARAM lParam){
        switch(
    msg){
        case 
    WM_CLOSE:
            
    DestroyWindow(hwnd);
            break;
        case 
    WM_DESTROY:
            
    PostQuitMessage(0);
            break;
        default:
            return 
    DefWindowProc(hwnd,msg,wParam,lParam);
        }
        return 
    0;
    }
    int WINAPI WinMain(HINSTANCE hInstanceHINSTANCE hPrevInstance,LPSTR lpCmdLineint nCmdShow){
        
    WNDCLASSEX wc;
        
    HWND hwnd;
        
    MSG Msg;


        
    wc.cbSize =sizeof(WNDCLASSEX);
        
    wc.style 0;
        
    wc.lpfnWndProc =WndProc;
        
    wc.cbClsExtra=0;
        
    wc.cbWndExtra =0;

        
    wc.hInstance hInstance;
        
    wc.hIcon LoadIcon(NULL,IDI_APPLICATION);
        
    wc.hCursor=LoadCursor(NULL,IDC_ARROW);
        
    wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
        
    wc.lpszMenuName=NULL;
        
    wc.lpszClassName=g_szClassName;
        
    wc.hIconSm LoadIcon(NULL,IDI_APPLICATION);

        if(!
    RegisterClassEx(&wc)){
            return 
    0;
        }

        
    hwnd CreateWindowEx(CW_USEDEFAULT,g_szClassName,"Cool Man",WS_OVERLAPPEDWINDOW,0,0,300,200,NULL,NULL,hInstance,NULL);
        
    HWND MyStatic;
        
    MyStatic CreateWindow("Static""I am Prog_Tom's Static Control"WS_CHILD WS_VISIBLE0020020hwndNULLhInstanceNULL);

        if(
    hwnd==NULL){
            return 
    0;
        }
        
    ShowWindow(hwndnCmdShow);
        
    UpdateWindow(hwnd);
        
    MessageBox(NULL,"Visual C++ Coding is much but cool!","From Tom Zhang",MB_OK);
        while(
    GetMessage(&Msg,NULL,0,0)){
            
    TranslateMessage(&Msg);
                
    DispatchMessage(&Msg);
        }
        
    Msg.wParam;

    enjoy
    Baaaaaaaaah

  10. #10

    Thread Starter
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Post Reasons?

    I'm a new comer. Can you guys tell me which method is more popular? Also, do you guys know how to create a TextBox and a CommandButton?

    Thanks,

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  11. #11
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    Re: Reasons?

    Originally posted by prog_tom
    I'm a new comer. Can you guys tell me which method is more popular?
    What do you mean "which method?"?

    ---

    You can create textboxes, buttons using the spicific class names.

    A button has a class name of "button" (so simple)
    An editbox has a class name of "EDIT"

    Here is a simple example of creating a button and a text box. I just modified your code of creating a simple window:

    PHP Code:
    //CREATOR TOM ZHANG, 12 YEARS OLD

    #include <windows.h>
    HINSTANCE hinst;
    HWND edithwndbuttonhwnd//Handles of button and editbox
    const char g_szClassName[] = "myWindowClass";
    LRESULT CALLBACK WndProc(HWND hwndUINT msgWPARAM wParamLPARAM lParam){
        switch(
    msg){
                    case 
    WM_SHOWWINDOW:
                    
    //Create a button
                    
    buttonhwnd CreateWindowEx(NULL,
            
    "button",
            
    "This is a button",
            
    WS_CHILD WS_VISIBLE,
            
    12,
            
    12,
            
    49,
            
    49,
            
    hwnd,
            
    NULL,
            
    hinst,
            
    NULL);

                    
    //Create the editbox
                    
    buttonhwnd CreateWindowEx(NULL,
            
    "EDIT",
            
    "This is an editbox",
            
    WS_CHILD WS_VISIBLE,
            
    50,
            
    50,
            
    100,
            
    100,
            
    hwnd,
            
    NULL,
            
    hinst,
            
    NULL);

                                    break;
        case 
    WM_CLOSE:
            
    DestroyWindow(hwnd);
            break;
        case 
    WM_DESTROY:
            
    PostQuitMessage(0);
            break;
        default:
            return 
    DefWindowProc(hwnd,msg,wParam,lParam);
        }
        return 
    0;
    }
    int WINAPI WinMain(HINSTANCE hInstanceHINSTANCE hPrevInstance,LPSTR lpCmdLineint nCmdShow){
        
    WNDCLASSEX wc;
        
    HWND hwnd;
        
    MSG Msg;

                    
    hinst hInstance;

        
    wc.cbSize =sizeof(WNDCLASSEX);
        
    wc.style 0;
        
    wc.lpfnWndProc =WndProc;
        
    wc.cbClsExtra=0;
        
    wc.cbWndExtra =0;

        
    wc.hInstance hInstance;
        
    wc.hIcon LoadIcon(NULL,IDI_APPLICATION);
        
    wc.hCursor=LoadCursor(NULL,IDC_ARROW);
        
    wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
        
    wc.lpszMenuName=NULL;
        
    wc.lpszClassName=g_szClassName;
        
    wc.hIconSm LoadIcon(NULL,IDI_APPLICATION);

        if(!
    RegisterClassEx(&wc)){
            return 
    0;
        }

        
    hwnd CreateWindowEx(CW_USEDEFAULT,g_szClassName,"Cool Man",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,500,800,NULL,NULL,hInstance,NULL);
        if(
    hwnd==NULL){
            return 
    0;
        }
        
    ShowWindow(hwndnCmdShow);
        
    UpdateWindow(hwnd);
        
    MessageBox(NULL,"Visual C++ Coding is much but cool!","From Tom Zhang",MB_OK);
        while(
    GetMessage(&Msg,NULL,0,0)){
            
    TranslateMessage(&Msg);
                
    DispatchMessage(&Msg);
        }
        
    Msg.wParam;


    If you are just getting started then I suggest that you buy a book like "Programming windows by Charles Petzold"
    You can also look through the MSDN library for some refrence
    Baaaaaaaaah

  12. #12
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Originally posted by abdul
    enjoy
    Hey stop stealing my line!

  13. #13
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    hehe...I just quoted your post and changed two numbers in it Check my post again and find the 2 numbers that I changed for Tom
    Baaaaaaaaah

  14. #14
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    "Programming windows by Charles Petzold"

    Get this book and it will get you started in windows programming. I don't know but I found an electronic version of that book at maxcode.com

    You can search at that site and you will find that book
    Baaaaaaaaah

  15. #15

    Thread Starter
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Post Not Found

    Well anyways. I can't find that book. Please have a look at this code... that I tried to create a Button with... It doesn't work... The Button is not showwned...
    Code:
    //INPUT NAMES AND AGES:
    //ANOTHER ONE FROM TOM
    //PROGTZ8894
    
    #include <windows.h>
    const char tzID[]="myClassWindow";
    HWND but1;
    HINSTANCE hInst;
    int nCmdShoW;
    LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam){
    	switch(msg){
    	case WM_SHOWWINDOW:
    		but1=CreateWindowEx(NULL,"button","Submit",WS_CHILD|WS_VISIBLE,100,100,40,20,but1,NULL,hInst,NULL);
    			ShowWindow(but1,nCmdShoW);
    	UpdateWindow(but1);
    		break;
    	case WM_CLOSE:
    		DestroyWindow(hwnd);
    		break;
    	case WM_DESTROY:
    		PostQuitMessage(0);
    		break;
    	default:
    		return DefWindowProc(hwnd,msg,wParam,lParam);
    	}
    	return 0;
    }
    int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
    	WNDCLASSEX tz;
    	HWND hwnd;
    	MSG Msg;
    
    	tz.cbSize=sizeof(WNDCLASSEX);
    	tz.style=0;
    	tz.lpfnWndProc=WndProc;
    	tz.cbClsExtra =0;
    	tz.cbWndExtra =0;
    	tz.hInstance = hInstance;
    	tz.hIcon=LoadIcon(NULL,IDI_APPLICATION);
    	tz.hCursor=LoadCursor(NULL,IDC_ARROW);
    	tz.hbrBackground=(HBRUSH)(COLOR_WINDOW+8);
    	tz.lpszMenuName=NULL;
    	tz.lpszClassName=tzID;
    	tz.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
    	if(!RegisterClassEx(&tz)){
    		MessageBox(hwnd,"Error while Registering the Program","",MB_OK);
    		return 0;
    	}
    	hwnd=CreateWindowEx(WS_EX_CLIENTEDGE,tzID,"Welcome to my Program!",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,200,100,NULL,NULL,hInstance,NULL);
    	if(hwnd==NULL){
    		MessageBox(hwnd,"Errow while Creating the Window","",MB_OK);
    		return 0;
    	}
    	ShowWindow(hwnd,nCmdShow);
    	UpdateWindow(hwnd);
    	while(GetMessage(&Msg,NULL,0,0)){
    		TranslateMessage(&Msg);
    		DispatchMessage(&Msg);
    	}
    	return Msg.wParam;
    }
    How to declare a CLICK Event for the Button? Do you know how to Set the Icon of the Program? I mean every time I compiled it the ICON is like a DOS Icon! Though in the Program it's not... Do you know how to Center the Window? Like
    VB Code:
    1. Private Sub Form_Load()
    2. Me.Move (-me.width+screen.width)/2,(-me.height+screen.height)/2
    3. End Sub

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  16. #16

    Thread Starter
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Post Write to a File?

    Oh and do you guys know how to write to a File in Win32 App Programming? I know how to do it in Console programming...
    Code:
    #include <fstream>
    int main(){
    ofstream IP("c:\up.txt");
    if(IP.Is_Open()){
    IP<<"Hey Man\n";
    IP.Close();
    }
    return 0;
    }

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  17. #17
    Lively Member
    Join Date
    Dec 2000
    Location
    Indiana
    Posts
    73

    Creating the event

    Visual Basic is event driven. C++ is not. This is how you do it. Notice the parts I changed in your code
    [PHP]
    //Sample Program for Tom

    #include <windows.h>

    const char tzID[]="myClassWindow";

    #define IDC_BUTTON1 9001
    //Notice that I removed your hwnd and made a define statement.
    //You'll see why later

    HINSTANCE hInst;
    //int nCmdShoW; This really isnt necessary

    LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam){
    switch(msg){
    case WM_CREATE: //This stuff should really be done in WM_CREATE
    CreateWindowEx(NULL,"button","Submit",WS_CHILD|WS_VISIBLE,100,100,40,20,hwnd,(HMENU)IDC_BUTTON1,hIns t,NULL);
    break;
    case WM_CLOSE:
    DestroyWindow(hwnd);
    break;
    case WM_DESTROY:
    PostQuitMessage(0);
    break;
    case WM_COMMAND:
    switch(LOWORD(wParam))
    {
    case IDC_BUTTON1:
    MessageBox(hwnd,"You Clicked the Button!","",0);
    //This is where we use the define statement
    break;
    }
    default:
    return DefWindowProc(hwnd,msg,wParam,lParam);
    }
    return 0;
    }
    int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
    WNDCLASSEX tz;
    HWND hwnd;
    MSG Msg;

    tz.cbSize=sizeof(WNDCLASSEX);
    tz.style=0;
    tz.lpfnWndProc=WndProc;
    tz.cbClsExtra =0;
    tz.cbWndExtra =0;
    tz.hInstance = hInstance;
    tz.hIcon=LoadIcon(NULL,IDI_APPLICATION);
    tz.hCursor=LoadCursor(NULL,IDC_ARROW);
    tz.hbrBackground=(HBRUSH)(COLOR_WINDOW+8); //I beleive your only supposed to add 1 to this....?
    tz.lpszMenuName=NULL;
    tz.lpszClassName=tzID;
    tz.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
    if(!RegisterClassEx(&tz)){
    MessageBox(hwnd,"Error while Registering the Program","",MB_OK);
    return 0;
    }
    hwnd=CreateWindowEx(WS_EX_CLIENTEDGE,tzID,"Welcome to my Program!",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,200,100,NULL,NULL,hInstance,NULL);
    if(hwnd==NULL){
    MessageBox(hwnd,"Errow while Creating the Window","",MB_OK);
    return 0;
    }
    ShowWindow(hwnd,nCmdShow);
    UpdateWindow(hwnd);
    while(GetMessage(&Msg,NULL,0,0)){
    TranslateMessage(&Msg);
    DispatchMessage(&Msg);
    }
    return Msg.wParam;
    }

  18. #18
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    "How to declare a CLICK Event for the Button? Do you know how to Set the Icon of the Program? I mean every time I compiled it the ICON is like a DOS Icon! Though in the Program it's not... Do you know how to Center the Window? "


    um, I already answered that...the whole WM_COMMAND thing?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width