|
From: Noorez K. <lor...@ho...> - 2005-12-12 02:47:33
|
Ok, i got it working. Stupid mistake i made....
>From: "Noorez Kassam" <lor...@ho...>
>To: dev...@li...
>Subject: [Dev-C++] MDI apps
>Date: Sun, 11 Dec 2005 19:11:34 -0700
>
>When a mdi window is created, is a new menu item to activate it supposed to
>be added automaticly, of do i have to add it?
>
>hear is my WindowProcedure for the Frame
>:
>
>#include "SML.h"
>
>int windowCntr = 0;
>
>LRESULT CALLBACK WindowProcedureFrame (HWND hwnd, UINT message, WPARAM
>wParam, LPARAM lParam)
>{
> HMENU windowMenu, subMenu;
> CLIENTCREATESTRUCT clientStruct;
>
> switch (message) /* handle the messages */
> {
> case WM_CREATE:
> {
> windowMenu = CreateMenu();
>
> subMenu = CreatePopupMenu();
> AppendMenu( subMenu, MF_STRING, (UINT)NEW, "&New" );
> AppendMenu( windowMenu, MF_STRING | MF_POPUP, (UINT)subMenu,
>"&File" );
>
> AppendMenu(windowMenu, MF_STRING | MF_POPUP, (UINT)WINDOW,
>"&Window");
> SetMenu( hwnd, windowMenu );
>
> clientStruct.hWindowMenu = GetSubMenu( GetMenu(hwnd), 1 );
> clientStruct.idFirstChild = ID_FIRSTWINDOW;
>
> hwndMDIClient = CreateWindowEx(
> 0,
> "MDICLIENT",
> (LPCTSTR)NULL,
> WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL |
>WS_HSCROLL,
> 0,
> 0,
> 500,
> 300,
> hwnd,
> (HMENU)ID_FIRSTWINDOW,
> gThisInstance,
> &clientStruct
> );
>
> ShowWindow( hwndMDIClient, SW_SHOW );
> }
> break;
>
> case WM_COMMAND:
> {
> switch( LOWORD(wParam) )
> {
> case NEW:
> {
> MDICREATESTRUCT mdistruct;
> mdistruct.szClass = "CHILD";
> mdistruct.szTitle = "Document-1";
> mdistruct.hOwner = gThisInstance;
> mdistruct.x = CW_USEDEFAULT;
> mdistruct.y = CW_USEDEFAULT;
> mdistruct.cx = 500;
> mdistruct.cy = 300;
> mdistruct.style = WS_MAXIMIZE;
> mdistruct.lParam = (LPARAM)NULL;
> SendMessage( hwndMDIClient, WM_MDICREATE, (WPARAM)0,
>(LPARAM)&mdistruct);
> //FileProperties* fileProp = new FileProperties;
> //fileProp.currentFileName = new char[256];
> //fileProp.untitled = true;
> //fileProp.edited = false;
>
> /*HWND hwndMDIWindow;
> hwndMDIWindow = CreateMDIWindow (
> "CHILD", // Classname
>
>(string("Document-")+intToString(++windowCntr)).c_str(), // Title
>Text
> WS_MAXIMIZE, // default window
> CW_USEDEFAULT, // Windows decides the
>position
> CW_USEDEFAULT, // where the window
>ends up on the screen
> 500, // The programs width
> 300, // and height in
>pixels
> hwndMDIClient, // The window is a
>child-window to desktop
> gThisInstance, // Program Instance
>handler
> (LPARAM)NULL // No Window
>Creation data
> );*/
>
> //SetWindowLongPtr( hwndMDIWindow, GWLP_USERDATA,
>(LONG_PTR)fileProp );
>
> }
> break;
> }
>
> return DefFrameProc( hwnd, hwndMDIClient, message, wParam, lParam
>);
> }
> break;
>
> case WM_DESTROY:
> PostQuitMessage (0); /* send a WM_QUIT to the message
>queue */
> break;
> default: /* for messages that we don't deal
>with */
> return DefFrameProc (hwnd, hwndMDIClient, message, wParam,
>lParam);
> }
>
> return 0;
>}
>
>_________________________________________________________________
>Scan and help eliminate destructive viruses from your inbound and outbound
>e-mail and attachments.
>http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
> Start enjoying all the benefits of MSN® Premium right now and get the
>first two months FREE*.
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc. Do you grep through log
>files
>for problems? Stop! Download the new AJAX search engine that makes
>searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
>http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
Don't just Search. Find! http://search.sympatico.msn.ca/default.aspx The new
MSN Search! Check it out!
|