Could anyone help?

Everything else that doesn't fall into one of the other PB categories.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by preacher.

The source below dosen't work it registers the class but it won't open the window I have no idea why.
Any help would be great..

procedure myproc(hwnd,message,wParam,lParam)
Select message
Case #WM_DESTROY
; Destroy window
PostQuitMessage_(0)
Case #WM_CREATE
EndSelect
procedurereturn DefWindowProc_(hwnd, message, wParam, lParam)
endprocedure

hinst = GetModuleHandle_(0)
wndcls.WNDCLASS

wndcls\style = #CS_HREDRAW | #CS_VREDRAW
wndcls\lpfnWndProc = @myproc()
wndcls\cbClsExtra = 0
wndcls\cbWndExtra = 0
wndcls\hInstance = hinst
wndcls\hIcon = 0
wndcls\hCursor = LoadCursor_(0, #IDC_ARROW)
wndcls\hbrBackground = #COLOR_WINDOW
wndcls\lpszMenuName = 0
mywinname.s="myclass"
wndcls\lpszClassName = @mywinname
a=RegisterClass_(@wndcls)

hwnd=OpenWindow(0, 100, 150, 300, 200, #PB_Window_SystemMenu | #PB_Window_SizeGadget, "PureBasic - CreateWindowEx")

chwnd = CreateWindowEx_(0, "myclass", "My Window", #WS_CHILD, 100, 100, 200, 200, hwnd, 0,0,0)
if chwnd
ShowWindow_(chwnd, #SW_NORMAL)
else
MessageRequester("","RegisterClass: "+str(a)+chr(13)+"Child hwnd: "+str(chwnd)+chr(13)+"Last Error:"+str(GetLastError_()),0)
endif
if hwnd0
Repeat
Until WaitWindowEvent() = #PB_EventCloseWindow
EndIf

[Preacher]
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

can't compile this piece of code...

Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by preacher.

What do you mean?
Can't you compile it or doesn't it work?
(Compiles on Purebasic 2.50)


[Preacher]
Post Reply