ALWIM
 
  
  Anmeldungsdatum: 08.08.2006 Beiträge: 1048 Wohnort: Niederbayern
  | 
		
			
				 Verfasst am: 14.02.2010, 17:21    Titel: defekter Quellcode? Kein Fenster? | 
				     | 
			 
			
				
  | 
			 
			
				Hallo,
 
 
Habe mal einen Quellcode von mir ein wenig verändert (was getestet) und jetzt kommt kein Fenster mehr. Nichts wird angezeigt? Datei wird geöffnet, aber nichts passiert. 
 
 
 	  | Code: | 	 		  #include "windows.bi"
 
const ProgrammName = "Buttons"
 
const NebenfensterName = "Highscore"
 
 
Declare function WndProc(byval hWnd as HWND, byval message as UINTEGER,_
 
    byval wParam as WPARAM, byval lParam as LPARAM) as LRESULT
 
declare function SubProc(byval hWnd as HWND, byval message as UINTEGER,_
 
    byval wParam as WPARAM, byval lParam as LPARAM) as LRESULT
 
 
dim as WNDCLASS   wndcls
 
with wndcls
 
    .style         =  CS_HREDRAW or CS_VREDRAW ' Or CS_NOCLOSE
 
    .lpfnWndProc   =  ProcPtr(WndProc)
 
    .cbClsExtra    =  0
 
    .cbWndExtra    =  0
 
    .hInstance     =  GetModuleHandle(NULL)
 
    .hCursor       =  LoadCursor(NULL, IDC_ARROW)
 
    .hIcon         =  LoadIcon(NULL, IDI_APPLICATION)
 
    .hbrBackground =  GetSysColorBrush(COLOR_WINDOW)
 
    .lpszClassName =  StrPtr(ProgrammName)
 
    .lpszMenuName  =  NULL
 
end with
 
RegisterClass @wndcls
 
 
dim as WNDCLASS   wndcls2
 
with wndcls2
 
    .style         =  CS_HREDRAW or CS_VREDRAW or CS_NOCLOSE
 
    .lpfnWndProc   =  ProcPtr(DefWindowProc)
 
    .cbClsExtra    =  0
 
    .cbWndExtra    =  0
 
    .hInstance     =  GetModuleHandle(NULL)
 
    .hCursor       =  LoadCursor(NULL, IDC_ARROW)
 
    .hIcon         =  LoadIcon(NULL, IDI_APPLICATION)
 
    .hbrBackground =  GetStockObject(WHITE_BRUSH)
 
    .lpszClassName =  StrPtr(NebenfensterName)
 
    .lpszMenuName  =  NULL
 
end with
 
RegisterClass @wndcls2
 
 
dim as HWND   hWnd = CreateWindow(_
 
    ProgrammName, ProgrammName, WS_OVERLAPPEDWINDOW Or WS_SYSMENU,_
 
    CW_USEDEFAULT, CW_USEDEFAULT, 600, 600,_
 
    NULL, NULL, GetModuleHandle(NULL), NULL)
 
 
ShowWindow   hWnd, SW_SHOWNORMAL
 
UpdateWindow hWnd
 
 
dim as MSG msg
 
Do While getmessage(@msg, NULL, 0, 0) <> 0
 
    DispatchMessage  @msg
 
Loop
 
end msg.wparam
 
 
function WndProc(byval hWnd as HWND, byval message as UINTEGER,_
 
    byval wParam as WPARAM, byval lParam as LPARAM) as LRESULT
 
    
 
    static  as HWND hs1, hs2, hs3
 
    
 
    
 
        Select case message
 
        case WM_DESTROY
 
            PostQuitMessage 0
 
            return 0
 
 
        case WM_CREATE
 
            hs1 = CreateWindow("button", "S",_
 
                WS_CHILD or WS_VISIBLE,_
 
                5, 10, 170, 22, hWnd, NULL,_
 
                cast(LPCREATESTRUCT,lParam)->hInstance,NULL)
 
            hs2 = CreateWindow("button", "K",_
 
                WS_CHILD or WS_VISIBLE,_
 
                5, 50, 170, 22, hWnd, NULL,_
 
                cast(LPCREATESTRUCT,lParam)->hInstance,NULL)
 
            hs3 = CreateWindow("button", "N",_
 
                WS_CHILD or WS_VISIBLE,_
 
                5, 90, 170, 22, hWnd, NULL,_
 
                cast(LPCREATESTRUCT,lParam)->hInstance,NULL)    
 
                 
 
             SendMessage hs1, BM_SETCHECK, BST_CHECKED, 0
 
            return 0
 
            
 
         End Select
 
        End function | 	  
 
 
Vielleicht findet einen den unsichtaren Fehler? Ich finde keinen Fehler?
 
 
Mit freundlichen Grüßen
 
ALWIM _________________ SHELL SHUTDOWN -s -t 05 | 
			 
		  |