Registriert seit: 15. Dez 2011
17 Beiträge
Delphi XE2 Architect
|
AW: CreateWindowEx stack overrun?
3. Jul 2012, 16:58
mal den code abgespeckt (und createwindowex durch createwindow ersetzt)
Delphi-Quellcode:
unit CoreWndObj;
interface
uses
System.SysUtils,
System.Classes,
system.Types,
Winapi.Windows,
Winapi.Messages;
type
TCoreWnd = class(TObject)
private
myhWnd: HWND;
public
constructor create();
end;
implementation
function WndProc(i_hWnd:HWND;i_Message:LongWord;i_wParam:WPARAM;i_lParam:LPARAM):LResult;
begin
result := DefWindowProc(i_hWnd, i_Message, i_wParam, i_lParam);
end;
constructor TCoreWnd.create();
var
wcex: TWndClassEx;
dwStyle: dword;
x,y: string;
begin
inherited create;
x := ' blablub';
y := ' blblbl';
ZeroMemory(@wcex,sizeof(wcex));
with wcex do
begin
cbSize := SizeOf(wcex);
style := CS_HREDRAW or CS_VREDRAW or CS_OWNDC;
lpfnWndProc := @wndproc;
hInstance := SysInit.HInstance;
hCursor := LoadCursor(0,IDC_ARROW);
lpszClassName := PChar(x);
hbrBackground := 1;
end;
if RegisterClassEx(wcex) = 0 then
writeln(' error');
dwStyle := WS_OVERLAPPEDWINDOW or WS_CLIPSIBLINGS or WS_CLIPCHILDREN;
myhWnd := CreateWindow( PChar(x),
PChar(y),
dwStyle,
120,
120,
1280,
768,
0,0,SysInit.HInstance, nil);
if myhWnd = 0 then
Writeln(' error');
ShowWindow(myhWnd, SW_SHOW);
SetForegroundWindow(myhWnd);
end;
end.
gleicher Fehler, und trotzdem funktionierts einwandfrei als 64bit version.
|
|
Zitat
|