Qbasicnews.com

Full Version: XP Win32 Checkbox problem.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
when i include a manifest in my exe to allow XP styles, my calls to SetTextColor dont work.
i want white text to go with my dark blue background.
SetBkMode and SetBkColor work as expected.

if i take the manifest out the SetTextColor works , but obviously the program looks crappy and old.. Help please!
Could you post the maniferst file?
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    name="progname"
    processorArchitecture="x86"
    version="1.0.0.0"
    type="win32"/>
<description>progdesc</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="x86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>

I had wondered if this was the issue from searching google, but i couldn't find any decent info.

My manifest seems to be the same as most other programs
Test Program (excuse if dirty!)

Code:
defint a-z
option explicit
option private

'$include once:'win\kernel32.bi'
'$include once:'win\user32.bi'
'$include once:'win\gdi32.bi'
'$include once:'win\commctrl32.bi'

dim shared ApphInstance as long
dim shared chkhWnd as long

declare function        WinMain     ( byval hInstance as long, _
                                      byval hPrevInstance as long, _
                                      szCmdLine as string, _
                                      byval iCmdShow as integer ) as integer
                                  
                                  

' Entry point
end WinMain( GetModuleHandle( null ), null, Command$, SW_NORMAL )
    
defint a-z
function WndProc ( byval hWnd as long, _
                   byval message as long, _
                   byval wParam as long, _
                   byval lParam as long ) as integer
    dim rct as RECT
    dim pnt as PAINTSTRUCT
    dim hDC as long
    
    WndProc = 0
    
    select case ( message )
            
        case WM_CREATE
          
    
    chkhWnd = CreateWindowEx( 0, _
                              "BUTTON", _
                          "Check1", _
                          WS_VISIBLE or WS_CHILD or BS_AUTOCHECKBOX, _
                          5, _
                          5, _
                          100, _
                          25, _
                          hWnd, _
                          null, _
                          ApphInstance, _
                          null )          
          
            return 0
            exit function

      case WM_CTLCOLORSTATIC
            SetBkMode(wParam, 1)
            SetBkColor(wParam, RGB(246,235,206))
            SetTextColor(wParam, RGB(255,255,255))
            return CreateSolidBrush(0)          
            exit function


        case WM_DESTROY
            PostQuitMessage 0            
            exit function
            
    end select
    
    WndProc = DefWindowProc( hWnd, message, wParam, lParam )    
    
end function

defint a-z
function WinMain ( byval hInstance as long, _
                   byval hPrevInstance as long, _
                   szCmdLine as string, _
                   byval iCmdShow as integer ) as integer    
    
     dim wMsg as MSG
     dim wcls as WNDCLASS    
     dim szAppName as string
     dim hWnd as unsigned long

     ApphInstance=hInstance
    
     WinMain = 0
    
     szAppName = "HelloWin"
    
     InitCommonControls()
    
     with wcls
         .style         = CS_HREDRAW or CS_VREDRAW
         .lpfnWndProc   = @WndProc
         .cbClsExtra    = 0
         .cbWndExtra    = 0
         .hInstance     = hInstance
         .hIcon         = LoadIcon( null, IDI_APPLICATION )
         .hCursor       = LoadCursor( null, IDC_ARROW )
         .hbrBackground = GetStockObject( WHITE_BRUSH )
         .lpszMenuName  = null
         .lpszClassName = strptr( szAppName )
     end with
    
     if ( RegisterClass( wcls ) = false ) then
        MessageBox null, "This program requires Windows NT!", szAppName, MB_ICONERROR              
        exit function
    end if
    
    hWnd = CreateWindowEx( 0, _
                 szAppName, _
                         "The Hello Program", _
                          WS_OVERLAPPEDWINDOW, _
                          CW_USEDEFAULT, _
                          CW_USEDEFAULT, _
                          CW_USEDEFAULT, _
                          CW_USEDEFAULT, _
                          null, _
                          null, _
                          hInstance, _
                          null )
                          

    ShowWindow   hWnd, iCmdShow
    UpdateWindow hWnd
    
    while ( GetMessage( wMsg, null, 0, 0 ) <> false )    
        TranslateMessage wMsg
        DispatchMessage  wMsg
    wend
    
    WinMain = wMsg.wParam

end function
Too advanced for me... sorry.

And then I have no XP, the manifest file does nothing in my pc Big Grin
@yetifoot,
ran your example on XP and can confirm the bug.
Tried different approaches but nothing changed.
:???:

Sorry.

I have my own bugs to iron out.
Can't make a background image visible on a listview with fb.
The strange thing is if I use another language it works...
Sad
thanks for looking at it, im still here scratching my head!, came by today to be cheeky and bump this thread but it looks like i didn't need to.

As for other languages, i actually want to use this in c, and it doesnt work there either, but i thought if i creatively changed it to an FB problem someone here might help!

I'm working on a form builder RAD type program, that builds a skeleton c program for you with all the events etc already setup. a bit like a 'vb for c', so people can get into Win32 GUI a bit easier than having to learn all this crud i'm having to learn.