sreyan32's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
40 (0.03 per day)
Joined:
15-December 10
Profile Views:
2,450
Last Active:
User is offline Jul 26 2012 12:30 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   sreyan32 has not set their status

Posts I've Made

  1. In Topic: Group box transparency problem

    Posted 30 Apr 2012

    View Postsnoopy11, on 29 April 2012 - 10:58 AM, said:

    Hi,

    Well first you have to set the style to BS_GROUPBOX

    like :-

    GROUPBOX "Tasks",IDC_STATIC1,11,49,100,99,0,BS_GROUPBOX,WS_EX_TRANSPARENT

    Then as long as the radiobuttons are within the groupbox they should function independantly of other
    radiobuttons outside the groupbox.

    Best Wishes

    Snoopy.

    Thank You Snoopy.
  2. In Topic: Group box transparency problem

    Posted 29 Apr 2012

    View Postsnoopy11, on 29 April 2012 - 08:32 AM, said:

    Hi,

    You declare IDC_STATIC as a label several times,

    five times in fact that is going to cause obvious problems I suspect.

    If your resource file was more structured this would be more obvious..


    #include "Resource.h"
    IDD_FORMVIEW DIALOGEX 0, 0, 298, 178
    STYLE DS_ABSALIGN | DS_SETFONT | DS_SETFOREGROUND | DS_CENTER | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    EXSTYLE WS_EX_APPWINDOW | WS_EX_NOACTIVATE
    CAPTION "SR-Timer(Work in Progress)"
    FONT 10, "Verdana", 400, 0, 0x0
    BEGIN
        
        GROUPBOX        "Tasks",IDC_STATIC1,11,49,100,99,0,WS_EX_TRANSPARENT
        GROUPBOX        "Timing",IDC_STATIC2,158,47,134,101,0,WS_EX_TRANSPARENT
        GROUPBOX        "Static",IDC_STATIC3,183,73,86,30,0,WS_EX_TRANSPARENT
        GROUPBOX        "Static",IDC_STATIC4,182,117,90,25,0,WS_EX_TRANSPARENT
        CONTROL         116,IDC_STATIC5,"Static",SS_BITMAP,0,15,298,139
    
        CONTROL         "ShutDown",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,21,69,50,10,WS_EX_TRANSPARENT
        CONTROL         "Restart",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,21,87,40,10,WS_EX_TRANSPARENT
        CONTROL         "Stand By",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,21,106,46,10,WS_EX_TRANSPARENT
        CONTROL         "Hibernate",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,21,125,48,10,WS_EX_TRANSPARENT
        CONTROL         "Radio5",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,168,64,36,9,WS_EX_TRANSPARENT
        CONTROL         "Radio6",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,169,107,36,9,WS_EX_TRANSPARENT
    
        CONTROL         "",IDC_DATETIMEPICKER1,"SysDateTimePick32",DTS_RIGHTALIGN | DTS_UPDOWN | WS_TABSTOP | 0x8,188,127,75,11,WS_EX_TRANSPARENT
        COMBOBOX        IDC_COMBO2,193,84,68,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP,WS_EX_TRANSPARENT
    
    
        PUSHBUTTON      "Schedule Task",IDC_BUTTON1,184,159,104,14
    
    END
    
    



    You dont show us your resource header but it should be structured something like this

    #include <windows.h>
    
    #define IDC_STATIC1 1001
    #define IDC_STATIC2 1002
    #define IDC_STATIC3 1003
    #define IDC_STATIC4 1004
    #define IDC_STATIC5 1005
    
    #define IDC_RADIO1 2001
    #define IDC_RADIO2 2002
    #define IDC_RADIO3 2003
    #define IDC_RADIO4 2004
    #define IDC_RADIO5 2005
    #define IDC_RADIO6 2006
    
    #define IDC_DATETIMEPICKER1 3005
    
    #define IDC_COMBO2 4005
    
    #define IDC_BUTTON1 5005
    
    
    


    You see how I group things into logical collections
    and define everything with unique identifiers and numbers.


    Best Wishes
    Snoopy.

    Thank you for the information. Snoopy can you tell me how to group radio buttons. For example there will be two groups of radio buttons. Please check the picture uploaded, I need to mutually exclusive groups of radio buttons. One for 'Tasks' and one for 'Timing'. Thank You.
  3. In Topic: Group box transparency problem

    Posted 28 Apr 2012

    View PostGunnerInc, on 28 April 2012 - 08:46 AM, said:

    Hmm, I don't know :stuart: did you try adding a switch case for WM_CTLCOLORSTATIC or whatever and add calls to SetBkMode and GetStockObject to see what happens?

    No I guess either I am doing something wrong or using SetBkMode does not work. The code I am using is-:
    case WM_CTLCOLORSTATIC:
    		if ((HWND)lparam==GetDlgItem(hwnd, IDC_STATIC1))
    		{ SetBkMode(GetDC((HWND)lparam), TRANSPARENT);
    		SetTextColor(GetDC((HWND)lparam), RGB(0,0,0));
    		return TRUE;
    		}
    		return FALSE;
    

    IDC_STATIC1 refers to the first group box called Tasks. All I am getting is darker shade of 'Tasks'. Please I really need some help here. I need to make them completely tranparent so that the image behind can be seen. My resource file is as follows -:
    // Microsoft Visual C++ generated resource script.
    //
    #include "resource.h"
    
    #define APSTUDIO_READONLY_SYMBOLS
    /////////////////////////////////////////////////////////////////////////////
    //
    // Generated from the TEXTINCLUDE 2 resource.
    //
    #include "afxres.h"
    
    /////////////////////////////////////////////////////////////////////////////
    #undef APSTUDIO_READONLY_SYMBOLS
    
    /////////////////////////////////////////////////////////////////////////////
    // English (U.S.) resources
    
    #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
    #ifdef _WIN32
    LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
    #pragma code_page(1252)
    #endif //_WIN32
    
    #ifdef APSTUDIO_INVOKED
    /////////////////////////////////////////////////////////////////////////////
    //
    // TEXTINCLUDE
    //
    
    1 TEXTINCLUDE 
    BEGIN
        "resource.h\0"
    END
    
    2 TEXTINCLUDE 
    BEGIN
        "#include ""afxres.h""\r\n"
        "\0"
    END
    
    3 TEXTINCLUDE 
    BEGIN
        "\r\n"
        "\0"
    END
    
    #endif    // APSTUDIO_INVOKED
    
    
    /////////////////////////////////////////////////////////////////////////////
    //
    // Dialog
    //
    
    IDD_FORMVIEW DIALOGEX 0, 0, 298, 178
    STYLE DS_ABSALIGN | DS_SETFONT | DS_SETFOREGROUND | DS_CENTER | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    EXSTYLE WS_EX_APPWINDOW | WS_EX_NOACTIVATE
    CAPTION "SR-Timer(Work in Progress)"
    FONT 10, "Verdana", 400, 0, 0x0
    BEGIN
        GROUPBOX        "Tasks",IDC_STATIC1,11,49,100,99,0,WS_EX_TRANSPARENT
        CONTROL         "ShutDown",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,21,69,50,10,WS_EX_TRANSPARENT
        CONTROL         "Restart",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,21,87,40,10,WS_EX_TRANSPARENT
        CONTROL         "Stand By",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,21,106,46,10,WS_EX_TRANSPARENT
        CONTROL         "Hibernate",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,21,125,48,10,WS_EX_TRANSPARENT
        GROUPBOX        "Timing",IDC_STATIC2,158,47,134,101,0,WS_EX_TRANSPARENT
        CONTROL         "Radio5",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,168,64,36,9,WS_EX_TRANSPARENT
        GROUPBOX        "Static",IDC_STATIC3,183,73,86,30,0,WS_EX_TRANSPARENT
        CONTROL         "Radio6",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,169,107,36,9,WS_EX_TRANSPARENT
        COMBOBOX        IDC_COMBO2,193,84,68,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP,WS_EX_TRANSPARENT
        GROUPBOX        "Static",IDC_STATIC4,182,117,90,25,0,WS_EX_TRANSPARENT
        CONTROL         "",IDC_DATETIMEPICKER1,"SysDateTimePick32",DTS_RIGHTALIGN | DTS_UPDOWN | WS_TABSTOP | 0x8,188,127,75,11,WS_EX_TRANSPARENT
        PUSHBUTTON      "Schedule Task",IDC_BUTTON1,184,159,104,14
        CONTROL         116,IDC_STATIC,"Static",SS_BITMAP,0,15,298,139
    END
    
    
    /////////////////////////////////////////////////////////////////////////////
    //
    // Icon
    //
    
    // Icon with lowest ID value placed first to ensure application icon
    // remains consistent on all systems.
    IDI_ICON1               ICON                    "Test.ico"
    IDI_ICON2               ICON                    "small.ico"
    
    /////////////////////////////////////////////////////////////////////////////
    //
    // DESIGNINFO
    //
    
    #ifdef APSTUDIO_INVOKED
    GUIDELINES DESIGNINFO 
    BEGIN
        IDD_FORMVIEW, DIALOG
        BEGIN
            BOTTOMMARGIN, 177
        END
    END
    #endif    // APSTUDIO_INVOKED
    
    
    /////////////////////////////////////////////////////////////////////////////
    //
    // Bitmap
    //
    
    IDB_BITMAP1             BITMAP                  "logo_1.bmp"
    #endif    // English (U.S.) resources
    /////////////////////////////////////////////////////////////////////////////
    
    
    
    #ifndef APSTUDIO_INVOKED
    /////////////////////////////////////////////////////////////////////////////
    //
    // Generated from the TEXTINCLUDE 3 resource.
    //
    
    
    /////////////////////////////////////////////////////////////////////////////
    #endif    // not APSTUDIO_INVOKED
    
    
    


    Thank You.
  4. In Topic: Group box transparency problem

    Posted 28 Apr 2012

    View PostGunnerInc, on 27 April 2012 - 04:37 PM, said:

    I don't think there is anything the Win32 API can't do. You just have to know how to do it!! As you don't have a pic for us to see, I am taking a guess.

    The text on the guys arm and on the cat butt are both static controls, the frame around the "FEAR IT" is a normal button class but with the BS_GROUPBOX style. The background image is a bmp loaded into a static control.

    Now, I am taking a guess that your static controls and the text in the group box, the background is the standard windows color right?

    Well, to get a "Transparent" background you need to handle the WM_CTLCOLORSTATIC message in your dialog proc.

    In that handler, to get the yellow text, I compared lParam to the handle of the static control on the cat butt, and if it was the handle, I used the API SetTextColor with wParam, and yellow. To get the statics to have a transparent background I used SetBkMode with TRANSPARENT and to get the text in the groupbox to have a transparent background, I used GetStockOject to get a handle to the NULL_BRUSH and returned that.

        .elseif eax == WM_CTLCOLORSTATIC
                mov     ecx, lParam
                .if ecx == hCatButStatic
                    invoke  SetTextColor, wParam, Yellow
                .endif
                invoke  SetBkMode, wParam, TRANSPARENT
                invoke  GetStockObject, NULL_BRUSH
                ret
    


    Just have to code that in your language, I tried to keep it as simple as possible.

    Sorry I forgot to attach the file dialog.jpg. I have uploaded it please check it. Will setting the background and text color work for group boxes and radio buttons?
  5. In Topic: Enabling XP Style in VC++ 2008

    Posted 24 Apr 2012

    View Postsarmanu, on 21 April 2012 - 12:16 PM, said:

    Well really I see that you are trying to create a dialog based application, but you create a WINDOW, and a dialog. The reason that your window doesn't show up is because you didn't tell the application to show the window. You need ShowWindow() function (add right after you create the window):
    hwnd=CreateWindow(
    szWinName,
    "Auto Timer (Work in progress)",
    WS_OVERLAPPEDWINDOW,
    CW_USEDEFAULT,
    CW_USEDEFAULT,
    CW_USEDEFAULT,
    CW_USEDEFAULT,
    NULL,
    NULL,
    hThisInst,
    NULL
    );
    
    // added this to actually show and update the window
    ShowWindow(hwnd, nWinMode);
    UpdateWindow(hwnd);
    
    while (GetMessage(&msg, NULL, 0, 0)>0)
    { 
        // etc
    
    


    Now the main window will show up, but not the dialog though, because you create a modeless dialog box, this needs a ShowWindow too:
    case WM_CREATE:
        hDlg = CreateDialog(hInst,MAKEINTRESOURCE(IDD_FORMVIEW),hwnd,(DLGPROC)DialogFunc);
        ShowWindow(hDlg, SW_SHOW);
        break;
    // etc ...
    
    


    Now it should work, but you will have the main window, and the dialog box, not just the dialog box.
    And also be careful that whenever you close the Dialogbox, the main window will also be closed, because you use PostQuitMessage in WM_CLOSE in DialogProc.

    Thank You but I have solved the problem. It seems you need to add the following lines to the top of the code-:
    #pragma comment( lib,"ComCtl32.lib" )
    #pragma comment(linker,"\"/manifestdependency:type='win32' \
    name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
    processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
    
    

    And then make a call to InitCommonControls() after the class has been registered. Thank You for your help very much. :-D

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

sreyan32 has no profile comments yet. Why not say hello?