www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Access violation after calling ShowWindow

------------7COv6rEukTQeYt7sxwtR8h
Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8
Content-Transfer-Encoding: 7bit

After porting one of NeHe's OpenGL lessons  
(http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01) to D, I'm  
getting some weird behavior.
First, each and all of these lines give me an access violation:

	ShowWindow(hWnd, SW_SHOW); // gives no error if I instead use SW_SHOWNA
	SetForegroundWindow(hWnd);
	SetFocus(hWnd);

Next, though I've gotten a proper drawing and rendering context, and all  
OpenGL functions now seem to point in the right directions (I get no  
errors calling them), my window refuses to update, so it just copies  
whatever is underneath, and never draws anything over it.

Any help available?

-- 
Simen
------------7COv6rEukTQeYt7sxwtR8h
Content-Disposition: attachment; filename=error.d
Content-Type: application/octet-stream; name=error.d
Content-Transfer-Encoding: Base64

aW1wb3J0IHdpbjMyLndpbmRvd3M7DQppbXBvcnQgc3RkLnN0cmluZzsNCi8vaW1w
b3J0IGdsLmdsOyAvLyBjb21tZW50ZWQgb3V0IGR1ZSB0byBpbXByb3BlciBuYW1l
IG1hbmdsaW5lDQovL2ltcG9ydCBnbC5nbHU7DQppbXBvcnQgc3RkLmxvYWRlcjsN
CmltcG9ydCBzdGQuc3RkaW87DQoNCnByYWdtYShsaWIsICJvcGVuZ2wzMi5saWIi
KTsNCnByYWdtYShsaWIsICJnZGkzMi5saWIiKTsNCg0KYWxpYXMgRGVmV2luZG93
UHJvY0EgRGVmV2luZG93UHJvYzsNCg0KZXh0ZXJuIChDKSB2b2lkIGdjX2luaXQo
KTsNCmV4dGVybiAoQykgdm9pZCBnY190ZXJtKCk7DQpleHRlcm4gKEMpIHZvaWQg
X21pbml0KCk7DQpleHRlcm4gKEMpIHZvaWQgX21vZHVsZUN0b3IoKTsNCmV4dGVy
biAoQykgdm9pZCBfbW9kdWxlRHRvcigpOw0KZXh0ZXJuIChDKSB2b2lkIF9tb2R1
bGVVbml0VGVzdH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