Print Page | Close Window

Tab Control için örnek kod verebilirmisiniz?

Printed From: C#nedir?com
Category: C/C++
Forum Name: C / C++ ve C++.NET
Forum Description: C/ C++ ve C++.NET
URL: http://forum.csharpnedir.com/forum_posts.asp?TID=81846
Printed Date: 04 Aralık 2021 at 01:50
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Tab Control için örnek kod verebilirmisiniz?
Posted By: KurtbeyACR
Subject: Tab Control için örnek kod verebilirmisiniz?
Date Posted: 04 Kasım 2017 at 08:49
Tab Control için Windows 10 da çalışacak Win32 C kodu verebilirmisiniz. Gerisini ben anlarım iki tab yeterli. Old school olsun lütfen.



Replies:
Posted By: KurtbeyACR
Date Posted: 04 Kasım 2017 at 10:42
#include <windows.h>
#include <commctrl.h>

char className[]="TabControl";

LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int){
    MSG messages;
    WNDCLASSEX wincl;

    wincl.hInstance=hInstance;
    wincl.lpszClassName=className;
    wincl.lpfnWndProc=WindowProcedure;
    wincl.style=0;
    wincl.cbSize=sizeof(WNDCLASSEX);
    wincl.hIcon=LoadIcon(NULL,IDI_APPLICATION);
    wincl.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
    wincl.hCursor=LoadCursor(NULL,IDC_ARROW);
    wincl.lpszMenuName=NULL;
    wincl.cbClsExtra=0;
    wincl.cbWndExtra=0;
    wincl.hbrBackground=HBRUSH(COLOR_3DFACE+1);

    if(!RegisterClassEx(&wincl))return 0;

    HWND windowHandle=CreateWindow(className,"TabControl",WS_OVERLAPPEDWINDOW,200,325,480,320,NULL,NULL,hInstance,NULL);
    ShowWindow(windowHandle,SW_SHOW);

    HWND tabHandle=CreateWindow(WC_TABCONTROL,"",WS_CHILD | WS_VISIBLE,6,0,474,320,windowHandle,NULL,hInstance,NULL);
    TCITEM tab1Data;
    tab1Data.mask=TCIF_TEXT;
    tab1Data.pszText="Tab1";
    TabCtrl_InsertItem(tabHandle,0,&tab1Data);
    TCITEM tab2Data;
    tab2Data.mask=TCIF_TEXT;
    tab2Data.pszText="Tab2";
    TabCtrl_InsertItem(tabHandle,0,&tab2Data);


    ShowWindow(tabHandle,SW_SHOW);

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

LRESULT CALLBACK WindowProcedure (HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
    switch(message){
        case WM_DESTROY:
            PostQuitMessage(0);
            break;
        default:
            return DefWindowProc(hwnd,message,wParam,lParam);
    };
    return 0;
}



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk