Encapsulation Win32 SDK with class in DMD2028 problem--Help wanted

Sam Hu samhudotsamhu at gmail.com
Fri Apr 17 02:22:21 PDT 2009


Forget attachment.Resent.

Sam Hu Wrote:

> Hello,
> 
> After my reading below post:
> http://d.puremagic.com/issues/show_bug.cgi?id=2580
> I can compile the win32 SDK sample in dmd\sample folder.After that I tried to encapsulate all those staff in class.Attached is my chance.Below is a short description about all the 3 classes:
> WinClass:Encapsulation of WNDCLASSEX
> WinFrame:Encapsulation of window frame
> WinApp:Encapsulation of the Gui application 
> 
> Here I have a couple of question.It would be grateful if anybody here kindly let me know,though I do know it is a bit long and it is  just an excise of a beginner:
> 1.The program compiled but runs with an Access Violation error.I can not found the place the error occurred.I tried to comments out the try...catch block,but the program runs invisible and with 100% CPU usage,I have to aborted from the task manager. 
> 2.Is it possible to encapsulate the callback function 
> int WindowProc(HWND hWnd, uint uMsg, WPARAM wParam, LPARAM lParam)
> into any of the three classes?Which one should be the ideal place?
> 3.Is is possible to encapsulate all the framework into just one class,say WinFrame,and then we can call it by 
> auto app=new WinFrame;
> app.show;
> If yes,how?
> 4.Is it possible to use main() other than int WinMain(),if yes,how?
> And I do know point 3 and 4 may be a longer story and there are a lot of GUI libararies for reference.But I can not gain a clear idea just by reading the other's large project with out short explanation.So really appreciate,if anybody can teach me.
> 
> Thanks and best regards,
> Sam
> 
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Win32SDK.d
Type: application/octet-stream
Size: 5024 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20090417/15ee050f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winsamp3.d
Type: application/octet-stream
Size: 762 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20090417/15ee050f/attachment-0001.obj>


More information about the Digitalmars-d-learn mailing list