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

Denis Koroskin 2korden at gmail.com
Fri Apr 17 03:11:45 PDT 2009


On Fri, 17 Apr 2009 13:22:21 +0400, Sam Hu <samhudotsamhu at gmail.com> wrote:

> 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
>>
>>
>>
>

Here is a nice article: http://www.gamedev.net/reference/programming/features/win32wrapper/page2.asp
It's in C++, but still applicable and relevant.



More information about the Digitalmars-d-learn mailing list