Example #1
0
int SDL_WM_UseResourceIcon() {

  HINSTANCE handle = GetModuleHandle(NULL);
  icon = LoadIcon(handle, "icon");
  
  SDL_SysWMinfo wminfo;
  SDL_VERSION(&wminfo.version)
  if (SDL_GetWMInfo(&wminfo) != 1) {
    return 0;
  }

  SetClassLong(wminfo.window, GCL_HICON, (LONG)icon);
  SetClassLong(wminfo.window, GCL_HICONSM, (LONG)icon);
  
  return 1;
}
Example #2
0
bool SetFormIcon(HWND handle, WCHAR* path) {
  if (!handle || !path) {
    return false;
  }
  HWND icon_handle = (HWND)LoadImage(NULL, path, IMAGE_ICON, 0, 0,
      LR_LOADFROMFILE | LR_DEFAULTSIZE);
  if (!icon_handle) {
    return false;
  }
  SetClassLong(handle, GCL_HICON, (LONG)icon_handle);
  SetClassLong(handle, GCL_HICONSM, (LONG)icon_handle);
  SendMessage(handle, WM_SETICON, ICON_BIG, (LPARAM)icon_handle);
  SendMessage(handle, WM_SETICON, ICON_SMALL, (LPARAM)icon_handle);
  SendMessage(handle, WM_SETICON, ICON_SMALL2, (LPARAM)icon_handle);      
  return true;
}
Example #3
0
/* sys_directx_set_close_button_callback:
 *  Sets the close button callback function.
 */
static int sys_directx_set_close_button_callback(void (*proc)(void))
{
   DWORD class_style;
   HMENU sys_menu;
   HWND allegro_wnd = win_get_window();

   user_close_proc = proc;

   /* get the old class style */
   class_style = GetClassLong(allegro_wnd, GCL_STYLE);

   /* and the system menu handle */
   sys_menu = GetSystemMenu(allegro_wnd, FALSE);

   /* enable or disable the no_close_button flag and the close menu option */
   if (proc) {
      class_style &= ~CS_NOCLOSE;
      EnableMenuItem(sys_menu, SC_CLOSE, MF_BYCOMMAND | MF_ENABLED);
   }
   else {
      class_style |= CS_NOCLOSE;
      EnableMenuItem(sys_menu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
   }

   /* change the class to the new style */
   SetClassLong(allegro_wnd, GCL_STYLE, class_style);

   /* Redraw the whole window to display the changes of the button.
    * (we use this because UpdateWindow() only works for the client area)
    */
   RedrawWindow(allegro_wnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);

   return 0;
}
Example #4
0
void HGE_CALL HGE_Impl::System_SetStateString(hgeStringState state, const char *value)
{
    FILE *hf;
    
    switch(state)
    {
        case HGE_ICON:          szIcon=value;
                                if(pHGE->hwnd) SetClassLong(pHGE->hwnd, GCL_HICON, (LONG)LoadIcon(pHGE->hInstance, szIcon));
                                break;
        case HGE_TITLE:         strcpy(szWinTitle,value);
                                if(pHGE->hwnd) SetWindowText(pHGE->hwnd, szWinTitle);
                                break;
        case HGE_INIFILE:       if(value) strcpy(szIniFile,Resource_MakePath(value));
                                else szIniFile[0]=0;
                                break;
        case HGE_LOGFILE:       if(value)
                                {
                                    strcpy(szLogFile,Resource_MakePath(value));
                                    hf=fopen(szLogFile, "w");
                                    if(!hf) szLogFile[0]=0;
                                    else fclose(hf);
                                }
                                else szLogFile[0]=0;
                                break;
    }
}
Example #5
0
//建立消息
int CUpGradeGameCard::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CWnd::OnCreate(lpCreateStruct)==-1) return -1;
	m_ToolTip.Create(this);
	m_ToolTip.SetDelayTime(10);

	SetCardImage();
	SetCardWidthHeight(0,0);
	/*	if (GetSystemMetrics(SM_CXSCREEN)>=1024)
	{
	m_iCardHSpace=16;
	m_iCardVSpace=10;
	if(GetCardStyle())//调用小牌
	{
	m_iCardHight=57;
	m_iCardWidth=42;		
	}
	else
	{
	m_iCardHight=95;
	m_iCardWidth=70;	
	}
	//		m_CardPic[0].SetLoadInfo(".\\image\\card\\game_card.bmp",CGameImageLink::m_bAutoLock);
	//		m_CardPic[1].SetLoadInfo(".\\image\\card\\game_card_back.bmp",CGameImageLink::m_bAutoLock);
	//		m_CardPic[2].SetLoadInfo(".\\image\\card\\game_card_small.bmp",CGameImageLink::m_bAutoLock);
	//		m_CardPic[3].SetLoadInfo(".\\image\\card\\game_card_small_back.bmp",CGameImageLink::m_bAutoLock);

	//		m_CardPic[0].SetLoadInfo(GetModuleHandle(CLIENT_DLL_NAME),IDB_GAME_CARD,CGameImageLink::m_bAutoLock);
	//		m_CardPic[1].SetLoadInfo(GetModuleHandle(CLIENT_DLL_NAME),IDB_CARD_BACK,CGameImageLink::m_bAutoLock);
	//		m_CardPic[2].SetLoadInfo(GetModuleHandle(CLIENT_DLL_NAME),IDB_GAME_CARD_SMALL,CGameImageLink::m_bAutoLock);	
	//		m_CardPic[3].SetLoadInfo(GetModuleHandle(CLIENT_DLL_NAME),IDB_GAME_CARD_SMALL_BACK,CGameImageLink::m_bAutoLock);	
	}
	else
	{
	m_iCardHSpace=11;
	m_iCardVSpace=11;
	if(GetCardStyle())//调用小牌
	{
	m_iCardHight=57;
	m_iCardWidth=42;
	}
	else
	{		
	m_iCardHight=73;
	m_iCardWidth=54;
	}
	//====m_CardPic[0]牌正面视图.m_CardPic[1]牌背面视图
	//	m_CardPic[0].SetLoadInfo(".\\image\\card\\game_card_800.bmp",CGameImageLink::m_bAutoLock);
	//	m_CardPic[1].SetLoadInfo(".\\image\\card\\game_card_800_back.bmp",CGameImageLink::m_bAutoLock);
	//	m_CardPic[2].SetLoadInfo(".\\image\\card\\game_card_small.bmp",CGameImageLink::m_bAutoLock);
	//	m_CardPic[3].SetLoadInfo(".\\image\\card\\game_card_small_back.bmp",CGameImageLink::m_bAutoLock);

	//		m_CardPic[0].SetLoadInfo(GetModuleHandle(CLIENT_DLL_NAME),IDB_GAME_CARD_800,CGameImageLink::m_bAutoLock);
	//		m_CardPic[1].SetLoadInfo(GetModuleHandle(CLIENT_DLL_NAME),IDB_CARD_BACK_800,CGameImageLink::m_bAutoLock);
	//		m_CardPic[2].SetLoadInfo(GetModuleHandle(CLIENT_DLL_NAME),IDB_GAME_CARD_SMALL,CGameImageLink::m_bAutoLock);
	//		m_CardPic[3].SetLoadInfo(GetModuleHandle(CLIENT_DLL_NAME),IDB_GAME_CARD_SMALL_BACK,CGameImageLink::m_bAutoLock);
	}*/
	SetClassLong(m_hWnd,GCL_HBRBACKGROUND,NULL);
	return 0;
}
void
winMWExtWMUpdateIcon (Window id)
{
  WindowPtr		pWin;
  HICON			hIcon, hiconOld;

  pWin = LookupIDByType (id, RT_WINDOW);
  hIcon = (HICON)winOverrideIcon ((unsigned long)pWin);

  if (!hIcon)
    hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON));

  if (hIcon)
    {
      win32RootlessWindowPtr pRLWinPriv
	= (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);

      if (pRLWinPriv->hWnd)
	{
	  hiconOld = (HICON) SetClassLong (pRLWinPriv->hWnd,
					   GCL_HICON,
					   (int) hIcon);
	  
          winDestroyIcon(hiconOld);
	}
    }
}
Example #7
0
BOOL CSonicSkin::Attach(HWND hWnd)
{
	m_hWnd = hWnd;

	if(g_UI.Attach(hWnd, this) == FALSE)
	{
		return FALSE;
	}

	// erase NC rect
	DWORD dwStyle = GetWindowLong(hWnd, GWL_STYLE);
	DWORD dwClsStyle = GetClassLong(hWnd, GCL_STYLE);
	DWORD dwExStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
	SetClassLong(hWnd, GCL_STYLE, dwClsStyle | CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS);
	SetWindowLong(hWnd, GWL_STYLE, (dwStyle & ~WS_CAPTION & ~DS_MODALFRAME & ~DS_3DLOOK & ~DS_FIXEDSYS & ~DS_SETFONT) | WS_CLIPCHILDREN);
	SetWindowLong(hWnd, GWL_EXSTYLE, (dwExStyle & ~WS_EX_DLGMODALFRAME));
	SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_DRAWFRAME | SWP_NOCOPYBITS);

	// initialize
	if(m_bg.pText->IsValid() == FALSE)
	{
		TCHAR szText[256];
		GetWindowText(m_hWnd, szText, Tsizeof(szText));
		m_bg.pText->Format(_T("%s"), szText);
	}
	else
	{
		SetWindowText(m_hWnd, m_bg.pText->GetTextWithoutCtrl());
	}

	CRect rtClient;
	GetClientRect(m_hWnd, &rtClient);
	m_pPaint->Create(FALSE, rtClient.Width(), rtClient.Height(), m_hWnd);
	return TRUE;
}
Example #8
0
BOOL CLoginDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	SetIcon(hIcon, TRUE);			// 设置大图标
	SetIcon(hIcon, FALSE);			// 设置小图标

	SetClassLong(m_verifyCodePicture.m_hWnd, GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND));

	// 初始化token
	CString src = HTTPGet(_T("https://passport.baidu.com/v2/api/?getapi&class=login&tpl=mn&tangram=true"), TRUE, NULL, &m_cookie);
	m_token = GetStringBetween(src, _T("token='"), _T("'"));
	if (m_token == _T("the fisrt two args should be string type:0,1!"))
	{
		src = HTTPGet(_T("https://passport.baidu.com/v2/api/?getapi&class=login&tpl=mn&tangram=true"), TRUE, NULL, &m_cookie);
		m_token = GetStringBetween(src, _T("token='"), _T("'"));
	}

	// 获取验证码
	OnStnClickedStatic4();

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常:  OCX 属性页应返回 FALSE
}
Example #9
0
int CAnsiWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
    SetClassLong(GetSafeHwnd(), GCL_STYLE, GetClassLong(GetSafeHwnd(), GCL_STYLE)-CS_VREDRAW);
    while ( m_strList.GetCount () < nScrollSize ) 
        m_strList.AddTail("");

	m_TotalLinesReceived = 0;

    // Init colors 
    m_nCurrentBg = 0;
    m_nCurrentFg =7;
    

//===================================================================================================================

    CRect rect;
    GetClientRect(&rect);

    // To init screen dimentions in characters !!!
    
    SetScrollSettings();
    return 0;
}
BOOL CSkinDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();
	//产生阴影
	SetClassLong(this->m_hWnd, GCL_STYLE, GetClassLong(this->m_hWnd, GCL_STYLE) | CS_DROPSHADOW);

	// 设置此对话框的图标。  当应用程序主窗口不是对话框时,框架将自动
	//  执行此操作
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标

	// TODO:  在此添加额外的初始化代码
	m_btnOK.Load(IDB_Button, 86);
	m_btnCancel.Load(IDB_Button, 86);
	m_btnClose.Load(IDB_Close, 39);
	m_btnClose.SetAutoSize(FALSE);
	m_btnMini.Load(IDB_Mini, 28);
	m_btnMini.SetAutoSize(FALSE);
	CRect rcEdit;
	m_edt1.GetWindowRect(&rcEdit);
	ScreenToClient(&rcEdit);
	m_edt1.MoveWindow(rcEdit.left, rcEdit.top, rcEdit.Width(), rcEdit.Height() + 1);
	m_edt1.MoveWindow(rcEdit.left, rcEdit.top, rcEdit.Width(), rcEdit.Height() - 1);
	// m_Edit1 不设置其他属性,让它保持类默认,一切属性都是在类中初始化好了的
	m_edt1.SetWindowText(_T("没有雅黑你怎么办呢?"));
	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}
Example #11
0
//初始化函数
BOOL CScoreView::OnInitDialog()
{
	__super::OnInitDialog();

	//状态变量
	m_uLeaveTime=15;

	//设置界面
	SetClassLong(m_hWnd,GCL_HBRBACKGROUND,NULL);

	//设置按钮
	m_btContinue.SetTextColor(RGB(255,255,255));
	m_btQuitGame.SetTextColor(RGB(255,255,255));
	m_btContinue.SetButtonImage(IDB_BT_GAME_SCORE,AfxGetInstanceHandle(),false);
	m_btQuitGame.SetButtonImage(IDB_BT_GAME_SCORE,AfxGetInstanceHandle(),false);

	//居中窗口
	CenterWindow(GetParent());

	//移动窗口
	CImageHandle HandleBack(&m_ImageBack);
	SetWindowPos(NULL,0,0,m_ImageBack.GetWidth(),m_ImageBack.GetHeight(),SWP_NOMOVE|SWP_NOZORDER);

	//移动按钮
	CRect rcButton;
	m_btContinue.GetWindowRect(&rcButton);
	m_btQuitGame.SetWindowPos(NULL,m_ImageBack.GetWidth()/2+15,m_ImageBack.GetHeight()-rcButton.Height()-8,
		0,0,SWP_NOSIZE|SWP_NOZORDER);
	m_btContinue.SetWindowPos(NULL,m_ImageBack.GetWidth()/2-rcButton.Width()-15,m_ImageBack.GetHeight()-rcButton.Height()-8,
		0,0,SWP_NOSIZE|SWP_NOZORDER);

	return TRUE;
}
Example #12
0
/*..........................................................................*/
enum OwnerDrawnButtonAction OwnerDrawnButton_draw(
                               OwnerDrawnButton * const me,
                               LPDRAWITEMSTRUCT lpdis)
{
    enum OwnerDrawnButtonAction ret = BTN_NOACTION;

    if ((lpdis->itemAction & ODA_DRAWENTIRE) != 0U) {
        if (me->hCursor != NULL) {
           SetClassLong(lpdis->hwndItem, GCL_HCURSOR, (LONG)me->hCursor);
           me->hCursor = NULL;                       /* mark the cursor set */
        }
        DrawBitmap(lpdis->hDC, me->hBitmapUp,
                   lpdis->rcItem.left, lpdis->rcItem.top);
        ret = BTN_PAINTED;
    }
    else if ((lpdis->itemAction & ODA_SELECT) != 0U) {
        if ((lpdis->itemState & ODS_SELECTED) != 0U) {
            DrawBitmap(lpdis->hDC, me->hBitmapDown,
                       lpdis->rcItem.left, lpdis->rcItem.top);
            ret = BTN_DEPRESSED;
        }
        else {
            /* NOTE: the bitmap for button "UP" look will be
            * drawn in the ODA_DRAWENTIRE action
            */
            ret = BTN_RELEASED;
        }
    }
    return ret;
}
//---------------------------------------------------------------------------
void MainWindow::ChangeCurrentCursor(HWND hWnd, LPCTSTR cursor)
{
	HCURSOR crsCross;

	crsCross = LoadCursor(m_hInstance, cursor);
	SetClassLong(hWnd, GCL_HCURSOR, (LONG)crsCross);
}
//-------------------------------------------------------------------------------------
bool BaseApplication::configure(void)
{
    // Show the configuration dialog and initialise the system
    // You can skip this and use root.restoreConfig() to load configuration
    // settings if you were sure there are valid ones saved in ogre.cfg
    if(mRoot->restoreConfig() || mRoot->showConfigDialog())
    {
        // If returned true, user clicked OK so initialise
        // Here we choose to let the system create a default rendering window by passing 'true'
        mWindow = mRoot->initialise(true, "Ogitor Sample Scene Loader Application");

        // Let's add a nice window icon
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
        HWND hwnd;
        mWindow->getCustomAttribute("WINDOW", (void*)&hwnd);
        LONG iconID   = (LONG)LoadIcon( GetModuleHandle(0), MAKEINTRESOURCE(IDI_ICON1) );
        SetClassLong( hwnd, GCL_HICON, iconID );
#endif
        return true;
    }
    else
    {
        return false;
    }
}
Example #15
0
/* ボタンコントロール作成 */
HWND ButtonControl::CreateButton(
	LPCWSTR lpszText,
	LPRECT lpRect,
	HWND hWndParent,     // 親ウィンドウまたはオーナーウィンドウのハンドル
	HMENU hMenu,         // メニューハンドルまたは子ウィンドウ ID
	HINSTANCE hInstance, // アプリケーションインスタンスのハンドル
	int nNorm,           // ノーマルのときのリソースビットマップID
	int nSel,            // 押したときのリソースビットマップID
	int nHover,          // ホバーのときのリソースビットマップID
	int nDis             // ディセーブルのときのリソースビットマップID
	)
{
	m_hBmpNorm = LoadBitmap(hInstance, MAKEINTRESOURCE(nNorm));
	m_hBmpSel = LoadBitmap(hInstance, MAKEINTRESOURCE(nSel));
	m_hBmpHover = LoadBitmap(hInstance, MAKEINTRESOURCE(nHover));
	m_hBmpDis = LoadBitmap(hInstance, MAKEINTRESOURCE(nDis));
	m_nWidth = lpRect->right - lpRect->left;
	m_nHeight = lpRect->bottom - lpRect->top;
	const HWND hWnd = CreateWindowEx(0, L"BUTTON", lpszText, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, lpRect->left, lpRect->top, m_nWidth, m_nHeight, hWndParent, hMenu, hInstance, NULL);
	if (!hWnd) return NULL;
	SetClassLong(hWnd, GCL_STYLE, GetClassLong(hWnd, GCL_STYLE) & ~CS_DBLCLKS);
	SetProp(hWnd, SZCECOWIZBUTTONPROC, this); // ウィンドウハンドルのプロパテにオブジェクトのポインタを関連付ける
	m_DefBtnProc = (WNDPROC)SetWindowLong(hWnd, GWL_WNDPROC, (LONG)GlobalButtonProc);
	return hWnd;
}
Example #16
0
/*--------------------------------------------------------------------------*\
* plD_bop_win3()
*
* Set up for the next page.
* Advance to next family file if necessary (file output).
\*--------------------------------------------------------------------------*/
void plD_bop_win3(PLStream *pls)
{
	WinDev *dev = (WinDev *)pls->dev;
	RECT rect;
	HCURSOR hCursor;
	
	/*	EnableMenuItem(dev->hMenu,CM_PRINTPLOT,MF_GRAYED); */
	/*	EnableMenuItem(dev->hMenu,CM_NEXTPLOT,MF_GRAYED);  */
	if (!dev->externalWindow) {
		hCursor = LoadCursor(NULL,IDC_WAIT);
		SetClassLong(GetActiveWindow(),GCL_HCURSOR,(long)hCursor);
		SetCursor(hCursor);
	}

	if (pls->db)
		dev->hdc = dev->db_hdc;
	else
		dev->hdc = GetDC(dev->hwnd);

	
	GetClientRect(dev->hwnd,&rect);
	dev->xPhMax = rect.right;
	dev->yPhMax = rect.bottom;
	dev->xScale = rect.right / ((float)PIXELS_X);
	dev->yScale = rect.bottom / ((float)PIXELS_Y);
	
	dev->rePaint = 0;
	dev->rePaintBsy = 0;
	pls->page++;
	
	plD_state_win3(pls, PLSTATE_COLOR0); /* Set drawing color */
}
Example #17
0
BOOL CDetailCustomDlg::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();

	DWORD style = GetClassLong(m_lstOptions, GCL_STYLE);
	SetClassLong(m_lstOptions, GCL_STYLE, style & ~CS_DBLCLKS);
	
	IcqContact *contact = ((CViewDetailDlg *) GetParent())->contact;
	bitset<NR_CONTACT_FLAGS> &f = contact->flags;
	for (int id = IDS_OPTION_FIRST; id <= IDS_OPTION_LAST; id++) {
		CString str;
		str.LoadString(id);
		int i = m_lstOptions.AddString(str);
		m_lstOptions.SetCheck(i, f.test(i));
	}
	CheckDlgButton(IDC_CUSTOM_SOUND, contact->flags.test(CF_CUSTOMSOUND));

	enableGreeting();
	OnCustomSound();
	m_cmbSound.SetCurSel(curSel);
	for (int i = 0; i < NR_CUSTOM_SOUNDS; i++)
		soundFiles[i] = contact->soundFiles[i].c_str();
	SetDlgItemText(IDC_FILE, soundFiles[curSel]);
	SetDlgItemText(IDC_GREETING, contact->greeting.c_str());

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Example #18
0
extern "C" __declspec(dllexport) LRESULT CALLBACK PoeWndProc(int nCode, WPARAM wParam, LPARAM lParam) {


	PCWPSTRUCT msg = (PCWPSTRUCT)lParam;
	
	if (origCursor == 0) {
		origCursor = (HCURSOR)GetClassLong(msg->hwnd,GCL_HCURSOR);
	}

	if (nCode < 0) {
		return CallNextHookEx(NULL,nCode,wParam,lParam);
	}

	if (msg->message == windowMessage) {
		// time to do magic and stuff.
		numPulses = 0;
		currentCursor = 0;

		SetClassLong(msg->hwnd, GCL_HCURSOR,(LONG)cursors[currentCursor]);
		SetCursor(cursors[currentCursor]);

		SetTimer(msg->hwnd,PULSE_TIMER,100,TimerProc);
		return TRUE;
	}

	return CallNextHookEx(NULL,nCode,wParam,lParam);
}
Example #19
0
void CCherryComboBox::OnMouseLeave()
{
	COMBOBOXINFO comboBoxInfo = { sizeof(COMBOBOXINFO) };
	GetComboBoxInfo(&comboBoxInfo);

	// 버튼이 눌린 상태면
	if (/* comboBoxInfo.stateButton == STATE_SYSTEM_PRESSED || */ !m_bDropDown)
	{
		// Normal
		m_pCurrentImage = &m_images[STATUS_NORMAL];
	}

	if (m_bTracking)
	{
		TRACKMOUSEEVENT trackMouseEvent;
		trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT);
		trackMouseEvent.dwFlags = TME_CANCEL;
		trackMouseEvent.hwndTrack = GetSafeHwnd();
		trackMouseEvent.dwHoverTime = 1;
		_TrackMouseEvent(&trackMouseEvent);

		m_bTracking = FALSE;
	}

	m_bHover = FALSE;
	SetCurrentFont(GetNormalFont());

	if (m_bEnableHoverHandCursor)
		SetClassLong(GetSafeHwnd(), GCL_HCURSOR, (LONG)AfxGetApp()->LoadStandardCursor(IDC_ARROW));

	Invalidate(FALSE);

	CComboBox::OnMouseLeave();
}
Example #20
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) {
	hInst = hInstance;
	
	HiconDLG = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON2), IMAGE_ICON, 128, 128, 0);

	hMainDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MAINDLG), (HWND)NULL, MainDlgProc);
	if(!hMainDlg) return false;
	
	HICON HiconDLGico = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
	SetClassLong(hMainDlg, GCL_HICON, (LONG) HiconDLGico);

	// Переводит диалоговое окно на русский если язык операционной системы русский
	if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_RUSSIAN){
		SetWindowText(hMainDlg, Utf8_to_cp1251("Metin2 лаунчер").c_str());
		SetDlgItemText(hMainDlg, IDC_BUTTON, Utf8_to_cp1251("Запуск").c_str());
		SetDlgItemText(hMainDlg, IDC_BUTTON2, Utf8_to_cp1251("Запуск с AntiDDoS").c_str());
		SetDlgItemText(hMainDlg, IDC_BUTTON3, Utf8_to_cp1251("Запуск прокси сервера").c_str());
	}
	
	MSG msg;
	while (GetMessage(&msg, NULL, NULL, NULL)) {
		if (!IsWindow(hMainDlg) || !IsDialogMessage(hMainDlg, &msg)) {
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}	// if (!IsWindow(hMainDlg) || !IsDialogMessage(hMainDlg, &msg))
	}	// while (GetMessage(&msg, NULL, NULL, NULL))
	
	return true;
	DestroyIcon(HiconDLGico);
	DestroyIcon(HiconDLG);
}
Example #21
0
//---------------------------------------------------------------------------
bool CInternalWindow::Create( Vec2i size )
{
	if (m_bCreated) return false;
#ifdef _WIN32

	// Register the window class
	WNDCLASSEX wc =
	{
		sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L,
		GetModuleHandle( NULL ), NULL, NULL, NULL, NULL,
		_W("P3DEngineWindow"), NULL
	};
	RegisterClassEx( &wc );

	// Construct window title
	wchar winTitle[256];
	wsprintf( winTitle, 255, _W("%s :: %s"), _W("TechDemo"), CEngine::GetBuildString() );

	// Create the application's window
	m_handle = CreateWindow( _W("P3DEngineWindow"), winTitle,
		WS_OVERLAPPEDWINDOW, 100, 100, size.x, size.y,
		NULL, NULL, wc.hInstance, NULL );

	// Set standard arrow cursor
	SetClassLong( m_handle, GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_ARROW) ); // standard cursor

	// Set as foreground window
	SetForegroundWindow( m_handle );

	return m_handle!=0;
#elif defined(X_WIN_PRESENT)
	m_display = XOpenDisplay(NULL);
#endif
}
Example #22
0
static void CreateBackgroundBrush()
{
	bkColor = db_get_dw(NULL, MODULE, "BkColor", FLT_DEFAULT_BKGNDCOLOR);

	if (NULL != hLTEdgesPen) {
		DeleteObject(hLTEdgesPen);
		hLTEdgesPen = NULL;
	}

	if (NULL != hRBEdgesPen) {
		DeleteObject(hRBEdgesPen);
		hRBEdgesPen = NULL;
	}

	if (NULL != hBmpBackground) {
		DeleteObject(hBmpBackground);
		hBmpBackground = NULL;
	}

	if (NULL != hBkBrush) {
		SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)NULL);
		DeleteObject( hBkBrush );
		hBkBrush = NULL;
	}

	if ( db_get_b(NULL, MODULE, "DrawBorder", FLT_DEFAULT_DRAWBORDER)) {
		COLORREF cr = (COLORREF)db_get_dw(NULL, MODULE, "LTEdgesColor", FLT_DEFAULT_LTEDGESCOLOR);
		hLTEdgesPen = CreatePen(PS_SOLID, 1, cr);
		cr = (COLORREF)db_get_dw(NULL, MODULE, "RBEdgesColor", FLT_DEFAULT_RBEDGESCOLOR);
		hRBEdgesPen = CreatePen(PS_SOLID, 1, cr);
	}
	
	if (db_get_b(NULL, MODULE, "BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP)) {
		DBVARIANT dbv;
		if ( !db_get_ts(NULL, MODULE, "BkBitmap", &dbv)) {
			hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal);
			db_free(&dbv);
		}
	}
	nBackgroundBmpUse = (WORD)db_get_w(NULL, MODULE, "BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);

	// Create brush
	hBkBrush	 = CreateSolidBrush(bkColor);

	// Attach brush to the window
	SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)hBkBrush);
}
Example #23
0
//建立消息
int CBitmapRgnWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (__super::OnCreate(lpCreateStruct) == -1) return -1;

	SetClassLong(m_hWnd,GCL_HBRBACKGROUND,NULL);

	return 0;
}
Example #24
0
//初始化函数
BOOL CBaseRoom::OnInitDialog()
{
    CGameFaceGo::OnInitDialog();

    SetClassLong(m_hWnd,GCL_HBRBACKGROUND,NULL);

    return TRUE;
}
Example #25
0
LRESULT CNotifyWnd::OnMouseLeave(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	ATLASSERT(m_bTimerActive == FALSE);
	m_bTimerActive=SetTimer(NOTIFY_TIMER_ID ,30);
	HCURSOR hCursor=GetCursor();
	SetClassLong(m_hWnd,GCL_HCURSOR,(LONG) hCursor);   // new cursor 
	return 0;
}
Example #26
0
//对象附加到现有窗口
void CRgnButton::PreSubclassWindow()
{
	__super::PreSubclassWindow();
	SetButtonStyle(GetButtonStyle()|BS_OWNERDRAW);
	SetClassLong(m_hWnd,GCL_HBRBACKGROUND,NULL);
	SendMessage(WM_SETFONT,(WPARAM)CSkinResourceManager::GetDefaultFont(),TRUE);
	return;
}
Example #27
0
//建立消息
int CRgnButton::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (__super::OnCreate(lpCreateStruct)==-1) return -1;
	SetButtonStyle(GetButtonStyle()|BS_OWNERDRAW);
	SetClassLong(m_hWnd,GCL_HBRBACKGROUND,NULL);
	SendMessage(WM_SETFONT,(WPARAM)CSkinResourceManager::GetDefaultFont(),TRUE);
	return 0;
}
Example #28
0
LRESULT	LiteWnd::OnMouseMove(HWND hWnd , UINT uMsg , WPARAM wParam , LPARAM lParam)
{
	RECT SysRect;
	GetClientRect(hWnd , &SysRect);
	int ArrCenter = (SysRect.right>SysRect.bottom)?(SysRect.bottom/20):(SysRect.right/20);
	int xPos = LOWORD(lParam); 
	int yPos = HIWORD(lParam); 
	if((xPos>0)&&(xPos<2*ArrCenter)&&(yPos>0)&&(yPos<2*ArrCenter))
	{
		SetClassLong(hWnd , GCL_HCURSOR , (long)LoadCursor(NULL , IDC_HAND));
	}
	else
	{
		SetClassLong(hWnd , GCL_HCURSOR , (long)LoadCursor(NULL , IDC_ARROW));
	}
	return NULL;
}
Example #29
0
//建立消息
int CShowHandCard::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CWnd::OnCreate(lpCreateStruct)==-1) return -1;

	SetClassLong(m_hWnd,GCL_HBRBACKGROUND,NULL);

	return 0;
}
Example #30
0
int CSmcView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
    SetClassLong(GetSafeHwnd(), GCL_STYLE, GetClassLong(GetSafeHwnd(), GCL_STYLE)-CS_VREDRAW);
	return 0;
}