nanogui: Re: regarding creation of Button


Previous by date: 13 Sep 2006 09:59:32 +0100 Using own TTF fonts!, Kirankumar Mahajan
Next by date: 13 Sep 2006 09:59:32 +0100 Re: regarding creation of Button, kourla ashok kumar reddy
Previous in thread:
Next in thread: 13 Sep 2006 09:59:32 +0100 Re: regarding creation of Button, kourla ashok kumar reddy

Subject: Fwd: regarding creation of Button
From: kourla ashok kumar reddy ####@####.####
Date: 13 Sep 2006 09:59:32 +0100
Message-Id: <20060913085927.91210.qmail@web7708.mail.in.yahoo.com>


kourla ashok kumar reddy ####@####.#### wrote:  Date: Tue, 12 Sep 2006 11:30:16 +0100 (BST)
From: kourla ashok kumar reddy ####@####.####
Subject: regarding creation of Button
To: ####@####.####

  Hi 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 09:59:32 +0100 Using own TTF fonts!, Kirankumar Mahajan
Next by date: 13 Sep 2006 09:59:32 +0100 Re: regarding creation of Button, kourla ashok kumar reddy
Previous in thread:
Next in thread: 13 Sep 2006 09:59:32 +0100 Re: regarding creation of Button, kourla ashok kumar reddy


Powered by ezmlm-browse 0.20.