nanogui: Re: regarding creation of Button


Previous by date: 13 Sep 2006 20:39:36 +0100 Re: regarding creation of Button, kourla ashok kumar reddy
Next by date: 13 Sep 2006 20:39:36 +0100 regarding button, kourla ashok kumar reddy
Previous in thread: 13 Sep 2006 20:39:36 +0100 Re: regarding creation of Button, kourla ashok kumar reddy
Next in thread:

Subject: Re: [nanogui] Fwd: regarding creation of Button
From: "Greg Haerr" ####@####.####
Date: 13 Sep 2006 20:39:36 +0100
Message-Id: <172801c6d76c$4f5de070$0300a8c0@RDP>

Ashkok -

You need to create and register your application class
to be different than "BUTTON", which is already
registered by Microwindows.  You will then need
two CreateWindows in WinMain, one to create
your application window, the other to create the
child button.  See some of the example
code in src/demos/mwin

Regards,

Greg

:   I used the below program to create Button , but i was not able to create
it.
:   Please help regarding this.
:
:
:   #include "windows.h"
: #include "wintools.h"
: #define IDOK 1
: #define APPCHILD "BUTTON"
:   extern MWIMAGEHDR image_penguin;
:   PMWIMAGEHDR image = &image_penguin;
:
: LRESULT CALLBACK ChildWndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp);
:   int
: RegisterAppClass(void)
: {
:  WNDCLASS wc;
:    wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW;
:  wc.lpfnWndProc = (WNDPROC)ChildWndProc;
:  wc.cbClsExtra = 0;
:  wc.cbWndExtra = 0;
:  wc.hInstance = 0;
:  wc.hIcon = 0; /*LoadIcon(GetHInstance(), MAKEINTRESOURCE( 1));*/
:  wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/
:  wc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
:  //wc.hbrBackground = NULL;
:  wc.lpszMenuName = "OK";
:  wc.lpszClassName =  APPCHILD;
:  return RegisterClass( &wc);
: }
:   LRESULT CALLBACK
: ChildWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
: {
:  HDC  hdc,hdcMem;
:  HBITMAP  hbmp, hbmpOrg;
:  RECT  rc;
:  PAINTSTRUCT ps;
:
:  switch(msg) {
:  case WM_PAINT:
:   BeginPaint(hwnd, &ps);
:
:   GdSetForegroundColor(hdc->psd, RGB(255,255,255));
:
:     GetClientRect(hwnd, &rc);
:     /* redirect painting to offscreen dc*/
:   hdcMem = CreateCompatibleDC(ps.hdc);
:   hbmp = CreateCompatibleBitmap(hdcMem, image->width, image->height);
:   hbmpOrg = SelectObject(hdcMem, hbmp);
:     /* draw onto offscreen dc*/
:  DrawDIB(hdcMem, 0, 0, image);
:     /* stretch blit offscreen with physical screen*/
:
:        StretchBlt(ps.hdc, 0, 0, rc.right, rc.bottom, hdcMem,
:       0, 0, image->width, image->height, MWROP_SRCCOPY);
:   DeleteObject(SelectObject(hdcMem, hbmpOrg));
:   DeleteDC(hdcMem);
:   EndPaint(hwnd, &ps);
:   break;
:  default:
:   return DefWindowProc( hwnd, msg, wp, lp);
:   return 0;
:  }
:  return 0;
: }
:   int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
:     LPSTR lpCmdLine, int nCmdShow)
: {
: static HWND hOK;
: HWND hwnd;
: TCHAR* item = TEXT("BUTTON");
: TCHAR* label = TEXT("OK");
: MSG  msg;
: RECT rc;
:
: RegisterAppClass();
: GetWindowRect(GetDesktopWindow(), &rc);
:
:  hOK = CreateWindow(item, label, WS_CHILD | BS_PUSHBUTTON |WS_BORDER|
WS_VISIBLE,0, GetSystemMetrics(SM_CYSCREEN)-100,
: 120, 26, GetDesktopWindow(), (HMENU)IDOK, 0, 0L);
:
: ShowWindow(hOK, SW_SHOWNORMAL);
: while( GetMessage(&msg, NULL, 0, 0)) {
:   TranslateMessage(&msg);
:   DispatchMessage(&msg);
:  }
: return 0;
:   //GetSystemMetrics(SM_CYSCREEN)
: }
:
:   Regards,
:   Ashok
:
: ---------------------------------
:
:
: ---------------------------------
:  Find out what India is talking about on  - Yahoo! Answers India
:  Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8.
Get it NOW


Previous by date: 13 Sep 2006 20:39:36 +0100 Re: regarding creation of Button, kourla ashok kumar reddy
Next by date: 13 Sep 2006 20:39:36 +0100 regarding button, kourla ashok kumar reddy
Previous in thread: 13 Sep 2006 20:39:36 +0100 Re: regarding creation of Button, kourla ashok kumar reddy
Next in thread:


Powered by ezmlm-browse 0.20.