I am trying to develop a GUI compiler using win32 API.I have used 2 MDI forms, one for writing the code,second 2 show the o/p.
The "coding MDI form" contains the Edit box.(re-sizable with the window)
But the problem stand when i click "run" from menu, the compiler has to read the text from the Edit box of "coding MDI form".I can't really focus on this edit window, to scan the text for Lexical Analyser !
Here is the code for the "Run" menu item:
switch(LOWORD(wParam))
{
case IDM_NEW: hInstance = GetWindowWord(hWnd,GWW_HINSTANCE);
x=x+7;y=y+7;
Child1 = CreateWindow("ChildClass","Program - nameless",WS_CHILD|WS_OVERLAPPEDWINDOW
,x,y,1155,550,hWnd,NULL,hInstance,NULL);
ShowWindow(Child1,SW_SHOWNORMAL);
break;
case IDM_RUN: hInstance = GetWindowWord(hWnd,GWW_HINSTANCE);
Child2 = CreateWindow("ChildClass","Output",WS_CHILD|WS_OVERLAPPEDWINDOW,5,550,1155,200,hWnd,NULL,hInstance,NULL);
ShowWindow(Child2,SW_SHOWNORMAL);
break;
Here is the code for the MDI child form:
LRESULT CALLBACK _export ChildProc( HWND hChild, UINT iMessage, WPARAM wParam,LPARAM lParam )
{
HWND Edit1;
HINSTANCE hInstance1;
PAINTSTRUCT ps;
int nWidth,nHeight;
switch (iMessage)
{
case WM_CREATE :
case WM_SIZE:
hInstance1 = GetWindowWord(hChild,GWW_HINSTANCE);
Edit1 = CreateWindow("EDIT","",WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_MULTILINE|ES_WANTRETURN|ES_READONLY| WS_VSCROLL|WS_HSCROLL| WS_BORDER,0,0,1000,500,hChild,100,hInstance1,NULL);
nWidth = LOWORD(lParam); /* width */
nHeight = HIWORD(lParam); /* height */
MoveWindow (Edit1,0,0,nWidth,nHeight,1);
ShowWindow(Edit1,SW_SHOWNORMAL);
break;
default :
return DefWindowProc( hChild, iMessage, wParam, lParam );
}
return 0;
}
The question is how focus on this edit window, to scan the text. The screenshot might be helpful !
Thankyou !

New Topic/Question
Reply



MultiQuote




|