• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MessageBox函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MessageBox函数的典型用法代码示例。如果您正苦于以下问题:C++ MessageBox函数的具体用法?C++ MessageBox怎么用?C++ MessageBox使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MessageBox函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetCDepth

void CDX8Disp::UpdateResList(
	unsigned int requested_width, unsigned int requested_height, int requested_cdepth)
{
	int selected_sel = -1;
	bool standard_match = TRUE;

 	m_res_list.ResetContent();

 	if (d3d_interface == NULL)
		return;

	requested_cdepth = GetCDepth(requested_cdepth);

	int selected_adapter  = m_adapter_list.GetCurSel();
	int num_modes		  = d3d_interface->GetAdapterModeCount(selected_adapter);

	int index = -1;
	char mode_string[20] = "";

	// Only list different resolutions and bit type NOT different refresh rates
	int index_count = 0;
	for(int i = 0; i < num_modes; i++)
	{
		D3DDISPLAYMODE mode;
		if(FAILED(d3d_interface->EnumAdapterModes(selected_adapter, i, &mode)))
		{
			MessageBox("Failed EnumAdapterModes", "Error", MB_ICONERROR);
			return;
		}

		if (d3d8_get_mode_bit(mode.Format) != requested_cdepth)
			continue;

		// skip anything below the minimum
		if(	!(mode.Width == 640 && mode.Height == 480) &&
			(mode.Width < 800 || mode.Height < 600))
		{
		  	continue;
		}

/*
		// Lets look ahead and get the lowest refresh rate
		// Can't assume there will be at least 60 or 0
		while(i > 0)
		{
			D3DDISPLAYMODE next_mode;
			if(FAILED(d3d_interface->EnumAdapterModes(selected_adapter, i-1, &next_mode)))
			{
				MessageBox("Failed EnumAdapterModes", "Fatal Error", MB_ICONERROR);
				return;
			}

			// Modes are the same execpt refresh rate
			if( mode.Width == next_mode.Width && 
				mode.Height == next_mode.Height && 
				d3d8_get_mode_bit(mode.Format) == d3d8_get_mode_bit(next_mode.Format)) 
			{
				DBUGFILE_OUTPUT_2("Changing stored mode from %d to %d", i, i-1);
				i--;
			}
			else
			{
				DBUGFILE_OUTPUT_0("Not the same, next!");
				break;
			}
		}
		*/
/*
		char new_string[20];
		sprintf(new_string, "%dx%dx%d", mode.Width, mode.Height, d3d8_get_mode_bit(mode.Format));
		
		if(stricmp(new_string, mode_string) == 0)
		{
			continue;
		}
		strcpy(mode_string,new_string); 
		*/

		// If not the first mode
		if(index > -1)
		{
			bool ignore_this_mode = false;
			int count_back = index;

			while(count_back > -1)
			{
				int back_mode_index = m_res_list.GetItemData(count_back);

				D3DDISPLAYMODE last_mode;
				if(FAILED(d3d_interface->EnumAdapterModes(selected_adapter, back_mode_index, &last_mode)))
				{
					MessageBox("Failed EnumAdapterModes", "Fatal Error", MB_ICONERROR);
					return;
				}

				// If we already have this mode ignore it
				if( mode.Width == last_mode.Width && 
					mode.Height == last_mode.Height && 
					d3d8_get_mode_bit(mode.Format) == d3d8_get_mode_bit(last_mode.Format))
				{
//.........这里部分代码省略.........
开发者ID:scp-fs2open,项目名称:Launcher,代码行数:101,代码来源:DX8Disp.cpp


示例2: _DefMessageHook

MsgAnswer PASCAL _DefMessageHook (MsgKey key, ErrSev sev, 
                                  const char *caption, const char *message)
{
  MsgAnswer answer = ANS_NONE;

#ifdef OS_MSWIN
  if ( !Nlm_HasConsole )
    {
      static UINT _sev_code[SEV_MAX+1] = { 
        /* SEV_NONE */    MB_OK,
        /* SEV_INFO */    MB_ICONINFORMATION,
        /* SEV_WARNING */ MB_ICONASTERISK, /* same as MB_ICONINFORMATION */
        /* SEV_ERROR */   MB_ICONEXCLAMATION,
        /* SEV_REJECT */  MB_ICONEXCLAMATION,
        /* SEV_FATAL */   MB_ICONHAND,
        /* SEV_MAX */     MB_ICONHAND
      };

      UINT flags = MB_TASKMODAL | _sev_code[(int)sev];
      if (key > 0)
        flags |= (key-1);                    
      answer = (MsgAnswer) MessageBox(NULL,message,caption,flags);
      return answer;
    }
#endif

#if defined(WIN_DUMB) || defined(OS_MAC)
  {{
    static char * _key_str [] = { 
      /* KEY_NONE */ "",
      /* KEY_OK   */ "Hit Return  ", 
      /* KEY_OKC  */ "C = Cancel, Anything else = OK  ",
      /* KEY_ARI  */ "A = abort, R = retry, I = ignore  ",
      /* KEY_YNC  */ "Y = yes, N = no, C = cancel  ",
      /* KEY_YN   */ "Y = yes, N = no  ",
      /* KEY_RC   */ "R = retry, C = Cancel  "
    };

    fflush(stdout);
    fprintf(stderr,"[%s] %s\n",
            caption ? caption : "NULL_Caption",
            message ? message : "NULL_Message");

#if defined(OS_UNIX)
  if (isatty(STDIN_FILENO))
#endif
    if (key>KEY_NONE && key<KEY_other)
      {
        int ch;
		
        /* show prompt */		
        fprintf(stderr,"%s  ",_key_str[(int)key]);	

        /* set default value */
        switch (key)  
          {
          case KEY_OK:   case KEY_OKC:
            answer = ANS_OK;     break;
          case KEY_ARI:  case KEY_RC:
            answer = ANS_RETRY;  break;
          case KEY_YNC:  case KEY_YN:
            answer = ANS_YES;    break;
          case KEY_NONE: case KEY_other:
            ASSERT_HARD ( FALSE );
          }
	
        /* get response */
        ch = GetOneChar();
        ch = isalpha(ch) ? toupper(ch) : ch;
        switch (ch)
          {
          case 'A' :
            answer = ANS_ABORT;   break;
          case 'C' :
            answer = ANS_CANCEL;  break;
          case 'I' :
            answer = ANS_IGNORE;  break;
          case 'N' :
            answer = ANS_NO;      break;
          }
      }
  }}
#endif /* WIN_DUMB || OS_MAC */

  return answer;
}
开发者ID:fbtestrepo,项目名称:hw,代码行数:86,代码来源:ncbimsg.c


示例3: WinMain

int
WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    if (set_applet_wd() < 0) 
        return -1;

#ifdef SEAF_LANG_CHINESE
    char *seafile_locale_dir = g_build_filename (seafile_bin_dir,
                                                 "i18n", NULL);
    /* init i18n */
    setlocale (LC_ALL, "zh_CN");
    bindtextdomain(GETTEXT_PACKAGE, seafile_locale_dir);
    bind_textdomain_codeset(GETTEXT_PACKAGE, "GBK");
    textdomain(GETTEXT_PACKAGE);
#endif
    
    if (count_process("seafile-applet") > 1) {
        MessageBox(NULL, _("Seafile is already running"), "Seafile", MB_OK);
        exit(1);
    }
    
    int argc;
    char **argv;
    char  cmdbuf[1024];
    GError *err = NULL;

    WSADATA     wsadata;
    WSAStartup(0x0101, &wsadata);

    UNREFERENCED_PARAMETER(hPrevInstance);

    snprintf(cmdbuf, sizeof(cmdbuf), "seafile-applet.exe %s", lpCmdLine);

    char *xxx = _("Seafile Initialization");
    char tmp[128];

    snprintf(tmp, sizeof(tmp), "%s", xxx);

    if (!g_shell_parse_argv (cmdbuf, &argc, &argv, &err)) {
        if (err)
            applet_warning ("parse arguments failed %s\n", err->message);
        applet_exit(1);
    }

    g_type_init();

    applet = g_new0 (SeafileApplet, 1);

    seafile_applet_init (hInstance);
    seafile_applet_start (argc, argv);

    MSG msg;
    HACCEL hAccelTable;

    memset(&msg, 0, sizeof(msg));
    hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_STARTINTRAY));

    while (GetMessage(&msg, NULL, 0, 0)) {
        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return (int) msg.wParam;
}
开发者ID:simcuslee,项目名称:seafile,代码行数:66,代码来源:seafile-applet.c


示例4: WideString

void __fastcall TForm1::actRedesignClassificationsExecute(TObject *Sender)
{
	lblStatus->Caption = "";
	if(!MakeBackup()) {
		Log->Lines->Add("Не удалось создать резервную копию файла");
		lblStatus->Caption = "Ошибка: Не удалось создать резервную копию файла";
		return;
	}
	m_strRecomendations = "";

	lblStatus->Caption = "Открываю файл на чтение...";
	Variant app = Variant::CreateObject("Excel.Application");
    app.OlePropertySet("Visible", true);
	Variant excel = app.OlePropertyGet("Workbooks").OleFunction("Open", WideString(m_strFileName.c_str()));
	Variant vSheets = excel.OlePropertyGet("Worksheets");
	Variant vSheet = vSheets.OlePropertyGet("Item",m_nPageClassification);
	UnicodeString strPageName = vSheet.OlePropertyGet("Name");
	if (strPageName.UpperCase() != UnicodeString("классификации").UpperCase()) {
		app.OleProcedure("Quit");
		MessageBox (Handle, UnicodeString(L"Не верное имя страницы").c_str(), L"prompt", MB_OK);
		lblStatus->Caption = "Ошибка: Не верное имя страницы";
		return;
	};

	std::vector<exlClass> classes;
	ReadClassifications(vSheet, classes);

	std::vector<exlMonth> months;
	for (unsigned int i = 0; i < m_vMonth.size(); i++) {
		int nMonthPage = m_vMonth[i].Number;
		Variant vSheetMonth = vSheets.OlePropertyGet("Item",nMonthPage);
		ReadMonth(vSheetMonth, months);
	}
//	Log->Lines->Add("Обновляю линки." + IntToStr((int)months.size()));

	int nAll = classes.size() * months.size();
	Log->Lines->Add("Всего записей в месяцах: " + IntToStr((int)months.size()));
	std::vector<exlClass> newclasses;
	int nRemovedClasses = 0;
	ProgressBar1->Max = nAll;
	ProgressBar1->Min = 0;
	ProgressBar1->Position = 0;

	lblStatus->Caption = "Поиск наименований которые отсутвуют в месяцах...";
	Log->Lines->Add("Произвожу поиск наименований которые отсутвуют в месяцах...");
	for (unsigned int iC = 0; iC < classes.size(); iC++) {
		exlClass cl = classes[iC];
		cl.Monthes = "";
		UnicodeString name = classes[iC].Name.UpperCase();
		int nCount = 0;
		for (unsigned int iM = 0; iM < months.size(); iM++) {
			ProgressBar1->Position++;
			Application->ProcessMessages();
			UnicodeString name2 = months[iM].Name.UpperCase();
			if (name == name2) {
			   nCount++;
			   if (cl.Monthes.Pos(months[iM].Month) < 1) {
				  cl.Monthes += months[iM].Month + ";";
			   }
			}
		}
		if (nCount > 0) {
			newclasses.push_back(cl);
		} else {
			nRemovedClasses++;
			Log->Lines->Add("\tНаименование '" + cl.Name + "' - нигде не встречается и будет удалено из классификаций");
		}
	}
	Log->Lines->Add(" ** ");

	nAll = newclasses.size() * months.size();
	ProgressBar1->Max = nAll;
	ProgressBar1->Min = 0;
	ProgressBar1->Position = 0;
	int nAddClasses = 0;
	lblStatus->Caption = "Поиск наименований которые отсутвуют в списке классификаций...";
	Log->Lines->Add("Произвожу поиск наименований которые отсутвуют в списке классификаций...");
	for (unsigned int iM = 0; iM < months.size(); iM++) {
		UnicodeString name = months[iM].Name.UpperCase();
		int nCount = 0;
		for (unsigned int iC = 0; iC < newclasses.size(); iC++) {
			ProgressBar1->Position++;
			Application->ProcessMessages();
			UnicodeString name2 = newclasses[iC].Name.UpperCase();
			if (name == name2) {
			   nCount++;
			}
		}
		if (nCount == 0) {
			Log->Lines->Add("\tНаименование '" + months[iM].Name + "' - будет добавлено в классификации");
			exlClass cl;
			cl.Name = months[iM].Name;
			cl.Class = m_sUnknownClass;
			cl.Monthes += months[iM].Month + ";";
			newclasses.push_back(cl);
			nAddClasses++;

			nAll = newclasses.size() * months.size();
			ProgressBar1->Max = nAll;
		}
//.........这里部分代码省略.........
开发者ID:sea-kg,项目名称:homemoney,代码行数:101,代码来源:main.cpp


示例5: SNDDMA_InitWav

/*
==================
SNDDM_InitWav

Crappy windows multimedia base
==================
*/
qboolean SNDDMA_InitWav( void ) {
	WAVEFORMATEX format;
	int i;
	HRESULT hr;

	Com_Printf( "Initializing wave sound\n" );

	snd_sent = 0;
	snd_completed = 0;

	dma.channels = 2;
	dma.samplebits = 16;

	if ( s_khz->value == 44 ) {
		dma.speed = 44100;
	}
	if ( s_khz->value == 22 ) {
		dma.speed = 22050;
	} else {
		dma.speed = 11025;
	}

	memset( &format, 0, sizeof( format ) );
	format.wFormatTag = WAVE_FORMAT_PCM;
	format.nChannels = dma.channels;
	format.wBitsPerSample = dma.samplebits;
	format.nSamplesPerSec = dma.speed;
	format.nBlockAlign = format.nChannels
						 * format.wBitsPerSample / 8;
	format.cbSize = 0;
	format.nAvgBytesPerSec = format.nSamplesPerSec
							 * format.nBlockAlign;

	/* Open a waveform device for output using window callback. */
	Com_DPrintf( "...opening waveform device: " );
	while ( ( hr = waveOutOpen( (LPHWAVEOUT)&hWaveOut, WAVE_MAPPER,
								&format,
								0, 0L, CALLBACK_NULL ) ) != MMSYSERR_NOERROR )
	{
		if ( hr != MMSYSERR_ALLOCATED ) {
			Com_Printf( "failed\n" );
			return qfalse;
		}

		if ( MessageBox( NULL,
						 "The sound hardware is in use by another app.\n\n"
						 "Select Retry to try to start sound again or Cancel to run Quake 2 with no sound.",
						 "Sound not available",
						 MB_RETRYCANCEL | MB_SETFOREGROUND | MB_ICONEXCLAMATION ) != IDRETRY ) {
			Com_Printf( "hw in use\n" );
			return qfalse;
		}
	}
	Com_DPrintf( "ok\n" );

	/*
	 * Allocate and lock memory for the waveform data. The memory
	 * for waveform data must be globally allocated with
	 * GMEM_MOVEABLE and GMEM_SHARE flags.

	*/
	Com_DPrintf( "...allocating waveform buffer: " );
	gSndBufSize = WAV_BUFFERS * WAV_BUFFER_SIZE;
	hData = GlobalAlloc( GMEM_MOVEABLE | GMEM_SHARE, gSndBufSize );
	if ( !hData ) {
		Com_Printf( " failed\n" );
		FreeSound();
		return qfalse;
	}
	Com_DPrintf( "ok\n" );

	Com_DPrintf( "...locking waveform buffer: " );
	lpData = GlobalLock( hData );
	if ( !lpData ) {
		Com_Printf( " failed\n" );
		FreeSound();
		return qfalse;
	}
	memset( lpData, 0, gSndBufSize );
	Com_DPrintf( "ok\n" );

	/*
	 * Allocate and lock memory for the header. This memory must
	 * also be globally allocated with GMEM_MOVEABLE and
	 * GMEM_SHARE flags.
	 */
	Com_DPrintf( "...allocating waveform header: " );
	hWaveHdr = GlobalAlloc( GMEM_MOVEABLE | GMEM_SHARE,
							(DWORD) sizeof( WAVEHDR ) * WAV_BUFFERS );

	if ( hWaveHdr == NULL ) {
		Com_Printf( "failed\n" );
		FreeSound();
//.........这里部分代码省略.........
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:101,代码来源:win_snd.c


示例6: MessageBox

//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
	edtFile->Text = "";
	m_strFileName = "";
	if (OpenDialog1->Execute()) {
		m_bBackup = false;

		UnicodeString strFileName = OpenDialog1->FileName;
		if (! FileExists (strFileName)) {
			MessageBox (Handle, UnicodeString(L"Файл '" + strFileName + L"' не существует").c_str(), L"prompt", MB_OK);
			edtFile->Text = "";
			return;
		}

		edtFile->Text = strFileName;
		// TODO: create backup now or later?
		// TODO: INIT OPERATIONS
		// TODO: scan month
		Variant var_Book,var_Sheet,var_Cell;

		Variant app = Variant::CreateObject("Excel.Application");
		// app.OlePropertySet("Visible",false);
		Variant excel;
		try {
			excel = app.OlePropertyGet("Workbooks").OleFunction("Open", WideString(strFileName.c_str()));
		} catch (...) {
			MessageBox (Handle, UnicodeString(L"Не получается открыть файл '" + strFileName + L"' как excel").c_str(), L"prompt", MB_OK);
			app.OleProcedure("Quit");
			edtFile->Text = "";
			return;
		}

		Log->Lines->Add("Файл загружен производиться анализ");
		Variant vSheets = excel.OlePropertyGet("Worksheets");

		m_nPageClassification = 0;
		m_vMonth.clear();
		cmbMonth->Items->Clear();
		cmbMonth->Items->Add("");
		int nSheets = vSheets.OlePropertyGet("Count");
		Log->Lines->Add("Всего листов: " + IntToStr(nSheets));
		for (int i = 0; i < nSheets; i++) {
			Variant vSheet = vSheets.OlePropertyGet("Item",i+1);
			UnicodeString str = vSheet.OlePropertyGet("Name");
			if (str.UpperCase() == UnicodeString("классификации").UpperCase()) {
				m_nPageClassification = i+1;
			};
			if (str.UpperCase().Pos("МЕСЯЦ ") > 0) {
				cmbMonth->Items->Add(str);
				exlSheet s;
				s.Number = i+1;
				s.Name = str;
				m_vMonth.push_back(s);
			}
			Log->Lines->Add("Лист " + IntToStr(i+1) + ": " + str);
		}

		if (m_nPageClassification == 0) {
			MessageBox (Handle, UnicodeString(L"Не найден лист 'классификации'").c_str(), L"prompt", MB_OK);
			app.OleProcedure("Quit");
			edtFile->Text = "";
			return;
		}

		if (m_vMonth.size() == 0) {
			MessageBox (Handle, UnicodeString(L"Не найден ни один лист с 'месяц xx'").c_str(), L"prompt", MB_OK);
			app.OleProcedure("Quit");
			edtFile->Text = "";
			return;
        }
		app.OleProcedure("Quit");
		m_strFileName = strFileName;
    }
}
开发者ID:sea-kg,项目名称:homemoney,代码行数:75,代码来源:main.cpp


示例7: memset

BOOL Window::Create(BOOL fullscreen, const char *title, int width, int height, int bits,LPTSTR menu)
{
	if(!Window::RegisterWindow(mHInstance))
		return FALSE;

	GLuint   PixelFormat; // Holds The Results After Searching For A Match
	DWORD    dwExStyle;   // Window Extended Style
	DWORD    dwStyle;     // Window Style
	RECT     ClientRect;
	ClientRect.left   = (long)0;
	ClientRect.right  = (long)width;
	ClientRect.top    = (long)0;
	ClientRect.bottom = (long)height;
	
	mFullscreen = fullscreen;
	if(mFullscreen)
	{
		DEVMODE dm;						// Device Mode
		memset(&dm, 0, sizeof(dm));		// Makes Sure Memory's Cleared
		dm.dmSize = sizeof(dm);			// Size Of The Devmode Structure
		dm.dmPelsHeight = height;		// Selected Screen Height
		dm.dmPelsWidth  = width;		// Selected Screen Width
		dm.dmBitsPerPel = bits;			// Selected Bits Per Pixel
		dm.dmFields     = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;

		if(ChangeDisplaySettings(&dm, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
		{
			if(MessageBox(NULL, TEXT("ÇöÀçÀÇ ºñµð¿ÀÄ«µå¿¡¼­ Ç®½ºÅ©¸°À» Áö¿øÇÏÁö ¾Ê½À´Ï´Ù. º¸ÅëÈ­¸éÀ¸·Î º¸½Ã°Ú½À´Ï±î?"), TEXT("¿À·ù"),
				MB_YESNO | MB_ICONEXCLAMATION) == IDYES)
			{
				mFullscreen = FALSE;
			}
			else
			{
				MessageBox(NULL, TEXT("ÇÁ·Î±×·¥À» Á¾·áÇÕ´Ï´Ù"), TEXT("¾Ë¸²"), MB_OK | MB_ICONSTOP);
				PostQuitMessage(0);
				return FALSE; //exit
			}
		}
	}

	if(mFullscreen)
	{
		dwExStyle = WS_EX_APPWINDOW;
		dwStyle   = WS_POPUP;
		//ShowCursor(false);
	}
	else
	{
      dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
      dwStyle   = WS_OVERLAPPEDWINDOW;               
	}
	
	AdjustWindowRectEx(&ClientRect, dwStyle, false, dwExStyle); // Adjust Window To true Requested Size
	
	mHWnd = CreateWindowEx(
			dwExStyle,
			"eglWindow",
			title,
			dwStyle|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
			0, 0,
			ClientRect.right-ClientRect.left,
			ClientRect.bottom-ClientRect.top,
			(HWND)NULL,
			(HMENU)((!fullscreen) ? LoadMenu(mHInstance, menu) : NULL),
			mHInstance,
			(LPVOID)this); //¸Þ¼¼Áö¸ÊÀ» À§ÇÏ¿© this Æ÷ÀÎÅ͸¦ ³Ñ±ä´Ù.

	if(!mHWnd) 
	{
		MessageBox(NULL, TEXT("À©µµ¿ì¸¦ »ý¼ºÇϴµ¥ ½ÇÆÐÇß½Àˆ•"), TEXT("¿À·ù"), MB_OK | MB_ICONEXCLAMATION);
		return FALSE;
	}

    static PIXELFORMATDESCRIPTOR pfd = {
      sizeof(pfd), // Size Of This Pixel Format Descriptor
      1,                             // Version Number
      PFD_DRAW_TO_WINDOW |           // Format Must Support Window
      PFD_SUPPORT_OPENGL |           // Format Must Support OpenGL
      PFD_DOUBLEBUFFER,              // Must Support Double Buffering
      PFD_TYPE_RGBA,                 // Request An RGBA Format
      bits,                          // Select Our Color Depth
      0, 0, 0, 0, 0, 0,              // Color Bits Ignored
      0,                             // No Alpha Buffer
      0,                             // Shift Bit Ignored
      UseAccumulationBuffer(),                             // No Accumulation Buffer
      0, 0, 0, 0,                    // Accumulation Bits Ignored
      16,                            // 16Bit Z-Buffer (Depth Buffer)
      UseStencilBuffer(),            // No Stencil Buffer
      0,                             // No Auxiliary Buffer
      PFD_MAIN_PLANE,                // Main Drawing Layer
      0,                             // Reserved
      0, 0, 0                        // Layer Masks Ignored
    };
	
	// Did We Get A Device Context?
	if(!(mDC = GetDC(mHWnd)))
	{ 
		DestroyGLWindow();
		MessageBox(NULL, TEXT("GL Device Context ¸¦ »ý¼ºÇÒ ¼ö ¾ø½À´Ï´Ù"), TEXT("¿À·ù"), MB_OK | MB_ICONEXCLAMATION);
//.........这里部分代码省略.........
开发者ID:skyfe79,项目名称:FractalTutorial,代码行数:101,代码来源:eglWindow.cpp


示例8: WndProc


//.........这里部分代码省略.........
        case KEY_MOUSE_LOCK:
          if (lockMouse) {
            lockMouse = 0;
            ClipCursor(0);
          } else {
            lockMouse = 1;
            FocusCurrent();
          }
          break;

        case KEY_TILING_MODE:
          tags[current_tag].tilingMode = (tags[current_tag].tilingMode + 1) % MODE_END;
          ArrangeWindows();
          break;

        case KEY_MOVE_UP:
          if (current) {
            SwapWindowWithNode(GetNextNode());
            ArrangeWindows();
          }
          break;

        case KEY_MOVE_DOWN:
          if (current) {
            SwapWindowWithNode(GetPreviousNode());
            ArrangeWindows();
          }
          break;

        case KEY_DISP_CLASS:
          {
            LPSTR temp = (LPSTR)malloc(sizeof(TCHAR) * 128);
            GetClassName(GetForegroundWindow(), temp, 128);
            MessageBox(NULL, temp, "Window Class", MB_OK);
            free(temp);
          }
          break;

        case KEY_TILE:
          if (IsGoodWindow(GetForegroundWindow())) {
            AddNode(GetForegroundWindow(), current_tag);
            ArrangeWindows();
          }
          break;

        case KEY_UNTILE:
          FullRemoveNode(GetForegroundWindow());
          ArrangeWindows();
          break;

        case KEY_INC_AREA:
          SwapWindowWithFirstNonMasterWindow();
          tags[current_tag].masterarea_count++;
          ArrangeWindows();
          break;

        case KEY_DEC_AREA:
          tags[current_tag].masterarea_count--;
          ArrangeWindows();
          break;

        case KEY_CLOSE_WIN:
          PostMessage(GetForegroundWindow(), WM_CLOSE, 0, 0);
          break;

        case KEY_LEFT:
开发者ID:ZaneA,项目名称:HashTWM,代码行数:67,代码来源:main.c


示例9: MainDlgProc


//.........这里部分代码省略.........
	SetDlgItemInt(hwnd, IDC_BITS, DEFAULT_KEYSIZE, FALSE);

	/*
	 * Initially, hide the progress bar and the key display,
	 * and show the no-key display. Also disable the Save
	 * buttons, because with no key we obviously can't save
	 * anything.
	 */
	ui_set_state(hwnd, state, 0);

	/*
	 * Load a key file if one was provided on the command line.
	 */
	if (cmdline_keyfile)
	    load_key_file(hwnd, state, filename_from_str(cmdline_keyfile), 0);

	return 1;
      case WM_MOUSEMOVE:
	state = (struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
	if (state->collecting_entropy &&
	    state->entropy && state->entropy_got < state->entropy_required) {
	    state->entropy[state->entropy_got++] = lParam;
	    state->entropy[state->entropy_got++] = GetMessageTime();
	    SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETPOS,
			       state->entropy_got, 0);
	    if (state->entropy_got >= state->entropy_required) {
		struct rsa_key_thread_params *params;
		DWORD threadid;

		/*
		 * Seed the entropy pool
		 */
		random_add_heavynoise(state->entropy, state->entropy_size);
		memset(state->entropy, 0, state->entropy_size);
		sfree(state->entropy);
		state->collecting_entropy = FALSE;

		SetDlgItemText(hwnd, IDC_GENERATING, generating_msg);
		SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETRANGE, 0,
				   MAKELPARAM(0, PROGRESSRANGE));
		SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETPOS, 0, 0);

		params = snew(struct rsa_key_thread_params);
		params->progressbar = GetDlgItem(hwnd, IDC_PROGRESS);
		params->dialog = hwnd;
		params->keysize = state->keysize;
		params->is_dsa = state->is_dsa;
		params->key = &state->key;
		params->dsskey = &state->dsskey;

		if (!CreateThread(NULL, 0, generate_rsa_key_thread,
				  params, 0, &threadid)) {
		    MessageBox(hwnd, "Out of thread resources",
			       "Key generation error",
			       MB_OK | MB_ICONERROR);
		    sfree(params);
		} else {
		    state->generation_thread_exists = TRUE;
		}
	    }
	}
	break;
      case WM_COMMAND:
	switch (LOWORD(wParam)) {
	  case IDC_KEYSSH1:
	  case IDC_KEYSSH2RSA:
	  case IDC_KEYSSH2DSA:
	    {
		state = (struct MainDlgState *)
		    GetWindowLong(hwnd, GWL_USERDATA);
		if (!IsDlgButtonChecked(hwnd, LOWORD(wParam)))
		    CheckRadioButton(hwnd, IDC_KEYSSH1, IDC_KEYSSH2DSA,
				     LOWORD(wParam));
		CheckMenuRadioItem(state->keymenu, IDC_KEYSSH1, IDC_KEYSSH2DSA,
				   LOWORD(wParam), MF_BYCOMMAND);
	    }
	    break;
	  case IDC_QUIT:
	    PostMessage(hwnd, WM_CLOSE, 0, 0);
	    break;
	  case IDC_COMMENTEDIT:
	    if (HIWORD(wParam) == EN_CHANGE) {
		state = (struct MainDlgState *)
		    GetWindowLong(hwnd, GWL_USERDATA);
		if (state->key_exists) {
		    HWND editctl = GetDlgItem(hwnd, IDC_COMMENTEDIT);
		    int len = GetWindowTextLength(editctl);
		    if (*state->commentptr)
			sfree(*state->commentptr);
		    *state->commentptr = snewn(len + 1, char);
		    GetWindowText(editctl, *state->commentptr, len + 1);
		    if (state->ssh2) {
			setupbigedit2(hwnd, IDC_KEYDISPLAY, IDC_PKSTATIC,
				      &state->ssh2key);
		    } else {
			setupbigedit1(hwnd, IDC_KEYDISPLAY, IDC_PKSTATIC,
				      &state->key);
		    }
		}
	    }
开发者ID:rdebath,项目名称:sgt,代码行数:101,代码来源:puttygen.c


示例10: MessageBox

STDMETHODIMP IECrossfireBHO::displayMessage(OLECHAR* message) {
	MessageBox(NULL, message, L"Crossfire Server Error", 0);
	return S_OK;
}
开发者ID:AlexRee,项目名称:webtools.jsdt.debug,代码行数:4,代码来源:IECrossfireBHO.cpp


示例11: load_key_file

void load_key_file(HWND hwnd, struct MainDlgState *state,
		   Filename filename, int was_import_cmd)
{
    char passphrase[PASSPHRASE_MAXLEN];
    int needs_pass;
    int type, realtype;
    int ret;
    char *comment;
    struct PassphraseProcStruct pps;
    struct RSAKey newkey1;
    struct ssh2_userkey *newkey2 = NULL;

    type = realtype = key_type(&filename);
    if (type != SSH_KEYTYPE_SSH1 &&
	type != SSH_KEYTYPE_SSH2 &&
	!import_possible(type)) {
	char msg[256];
	sprintf(msg, "Couldn't load private key (%s)",
		key_type_to_str(type));
	MessageBox(NULL, msg,
		   "PuTTYgen Error", MB_OK | MB_ICONERROR);
	return;
    }

    if (type != SSH_KEYTYPE_SSH1 &&
	type != SSH_KEYTYPE_SSH2) {
	realtype = type;
	type = import_target_type(type);
    }

    comment = NULL;
    if (realtype == SSH_KEYTYPE_SSH1)
	needs_pass = rsakey_encrypted(&filename, &comment);
    else if (realtype == SSH_KEYTYPE_SSH2)
	needs_pass =
	ssh2_userkey_encrypted(&filename, &comment);
    else
	needs_pass = import_encrypted(&filename, realtype,
				      &comment);
    pps.passphrase = passphrase;
    pps.comment = comment;
    do {
	if (needs_pass) {
	    int dlgret;
	    dlgret = DialogBoxParam(hinst,
				    MAKEINTRESOURCE(210),
				    NULL, PassphraseProc,
				    (LPARAM) & pps);
	    if (!dlgret) {
		ret = -2;
		break;
	    }
	} else
	    *passphrase = '\0';
	if (type == SSH_KEYTYPE_SSH1) {
	    if (realtype == type)
		ret = loadrsakey(&filename, &newkey1,
				 passphrase, NULL);
	    else
		ret = import_ssh1(&filename, realtype,
				  &newkey1, passphrase);
	} else {
	    if (realtype == type)
		newkey2 = ssh2_load_userkey(&filename,
					    passphrase, NULL);
	    else
		newkey2 = import_ssh2(&filename, realtype,
				      passphrase);
	    if (newkey2 == SSH2_WRONG_PASSPHRASE)
		ret = -1;
	    else if (!newkey2)
		ret = 0;
	    else
		ret = 1;
	}
    } while (ret == -1);
    if (comment)
	sfree(comment);
    if (ret == 0) {
	MessageBox(NULL, "Couldn't load private key.",
		   "PuTTYgen Error", MB_OK | MB_ICONERROR);
    } else if (ret == 1) {
	/*
	 * Now update the key controls with all the
	 * key data.
	 */
	{
	    SetDlgItemText(hwnd, IDC_PASSPHRASE1EDIT,
			   passphrase);
	    SetDlgItemText(hwnd, IDC_PASSPHRASE2EDIT,
			   passphrase);
	    if (type == SSH_KEYTYPE_SSH1) {
		char buf[128];
		char *savecomment;

		state->ssh2 = FALSE;
		state->commentptr = &state->key.comment;
		state->key = newkey1;

		/*
//.........这里部分代码省略.........
开发者ID:rdebath,项目名称:sgt,代码行数:101,代码来源:puttygen.c


示例12: os_get_type_text

/**
 * Generate textfile version of D3D8 caps
 * Allow user to save it where they want then open it
 */
void CDX8Disp::OnGenCaps() 
{
	if(d3d_interface == NULL) return;

	int selected_adapter  = m_adapter_list.GetCurSel();
	char mass_buffer[50000];
	int  i = 0;

	// OS
	char os_string[100];
  	os_get_type_text(os_string);
 	i += sprintf(mass_buffer + i, "Operating System: %s\n", os_string); 
 	i += sprintf(mass_buffer + i, "Memory: %d MB\n", memory_get_ammount() / 1048576);


	// Adapter data
	D3DADAPTER_IDENTIFIER8 identifier;
	if(FAILED(d3d_interface->GetAdapterIdentifier(selected_adapter, D3DENUM_NO_WHQL_LEVEL, &identifier)))
	{
		MessageBox("Failed GetAdapterIdentifier in OnGenCaps", "Fatal Error", MB_ICONERROR);
		return;
	}

	// Lets get the all mode data
	int num_modes = d3d_interface->GetAdapterModeCount(selected_adapter);

	i += sprintf(mass_buffer + i, "Adapter: %s\n\n", identifier.Description); 
	i += sprintf(mass_buffer + i, "Modes:\n\n"); 
	for(int j = num_modes - 1; j >= 0; j--)
	{
		D3DDISPLAYMODE mode;
		if(FAILED(d3d_interface->EnumAdapterModes(selected_adapter, j, &mode))) 
		{
			MessageBox("Failed EnumAdapterModes in OnGenCaps", "Fatal Error", MB_ICONERROR);
			return;
		}

		i += sprintf(mass_buffer + i, 
			"%d: (%dx%d)x%d bit, %d rr\n",
			j, mode.Width, mode.Height, 
			d3d8_get_mode_bit(mode.Format),
			mode.RefreshRate);
	}

	// Now output the caps
	D3DCAPS8 caps;
	HRESULT hr = d3d_interface->GetDeviceCaps(selected_adapter, D3DDEVTYPE_HAL, &caps);

	// Don't quit, continue on; sometimes it doesn't matter!
   	if(FAILED(hr))
	{
		char buffer[100];
		sprintf(buffer, "Failed to generate caps, please report to coder");
		MessageBox(buffer, "Error", MB_ICONERROR);
	}
	else
	{
		char *temp;

// Internal MACRO, only for use in this function
#define SPRINTF_FLAG(cap, flag) \
		temp = #cap "." #flag ":"; \
		i += sprintf(mass_buffer + i, "%-63s %s\n", temp, (cap & flag) ? "yes" : "no");

// Internal MACRO, only for use in this function
#define SPRINTF_NL() i += sprintf(mass_buffer + i, "\n")

		// This outputs all the DX8 caps to text
		i += sprintf(mass_buffer + i, "\n\nD3D8 Caps:\n\n"); 
		SPRINTF_FLAG(caps.Caps, D3DCAPS_READ_SCANLINE);
		SPRINTF_NL();
		SPRINTF_FLAG(caps.Caps2, D3DCAPS2_CANCALIBRATEGAMMA); 
		SPRINTF_FLAG(caps.Caps2, D3DCAPS2_CANRENDERWINDOWED); 
		SPRINTF_FLAG(caps.Caps2, D3DCAPS2_CANMANAGERESOURCE); 
		SPRINTF_FLAG(caps.Caps2, D3DCAPS2_DYNAMICTEXTURES); 
		SPRINTF_FLAG(caps.Caps2, D3DCAPS2_FULLSCREENGAMMA); 
   		SPRINTF_FLAG(caps.Caps2, D3DCAPS2_NO2DDURING3DSCENE);
		SPRINTF_NL();
		SPRINTF_FLAG(caps.Caps3, D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD);
		SPRINTF_NL();
		SPRINTF_FLAG(caps.PresentationIntervals, D3DPRESENT_INTERVAL_IMMEDIATE); 
		SPRINTF_FLAG(caps.PresentationIntervals, D3DPRESENT_INTERVAL_ONE); 
		SPRINTF_FLAG(caps.PresentationIntervals, D3DPRESENT_INTERVAL_TWO); 
		SPRINTF_FLAG(caps.PresentationIntervals, D3DPRESENT_INTERVAL_THREE); 
		SPRINTF_FLAG(caps.PresentationIntervals, D3DPRESENT_INTERVAL_FOUR); 
		SPRINTF_NL();
		SPRINTF_FLAG(caps.CursorCaps, D3DCURSORCAPS_COLOR); 
		SPRINTF_FLAG(caps.CursorCaps, D3DCURSORCAPS_LOWRES); 
		SPRINTF_NL();
		SPRINTF_FLAG(caps.DevCaps, D3DDEVCAPS_CANBLTSYSTONONLOCAL); 
		SPRINTF_FLAG(caps.DevCaps, D3DDEVCAPS_CANRENDERAFTERFLIP); 
		SPRINTF_FLAG(caps.DevCaps, D3DDEVCAPS_DRAWPRIMTLVERTEX); 
		SPRINTF_FLAG(caps.DevCaps, D3DDEVCAPS_EXECUTESYSTEMMEMORY); 
		SPRINTF_FLAG(caps.DevCaps, D3DDEVCAPS_EXECUTEVIDEOMEMORY); 
		SPRINTF_FLAG(caps.DevCaps, D3DDEVCAPS_HWRASTERIZATION); 
		SPRINTF_FLAG(caps.DevCaps, D3DDEVCAPS_HWTRANSFORMANDLIGHT); 
//.........这里部分代码省略.........
开发者ID:scp-fs2open,项目名称:Launcher,代码行数:101,代码来源:DX8Disp.cpp


示例13: DBUGFILE_OUTPUT_0

void CDX8Disp::UpdateAntialiasList(int select)
{
 	m_antialias_list.ResetContent();
	if(d3d_interface == NULL) 
	{
		DBUGFILE_OUTPUT_0("d3d_interface == NULL");
		return;
	}

	int selected_adapter  = m_adapter_list.GetCurSel();
	int selected_mode	  = m_res_list.GetItemData(m_res_list.GetCurSel());

	D3DDISPLAYMODE mode;
	if(FAILED(d3d_interface->EnumAdapterModes(selected_adapter, selected_mode, &mode))) 
	{
		MessageBox("Failed EnumAdapterModes in UpdateAntialiasList", "Fatal Error", MB_ICONERROR);
		return;
	}

	{
		// do a quick standard res check while we're here...

		// identify whether this is one of the standard video modes or not
		bool standard_match = ((mode.Width == 1024 && mode.Height == 768) ||
							(mode.Width == 640 && mode.Height == 480));

		// show or hide the non-standard video mode text if needed
		GetDlgItem(IDC_NSVM_TEXT)->ShowWindow( (standard_match) ? SW_HIDE : SW_SHOW );
	}


	// Now fill the avaliable anti aliasing  for this mode
	typedef struct {
		int   type;
		char *text;
	} MultisampleInfo;

	const int MAX_MULTISAMPLE = 16;
	const MultisampleInfo multisample_info[MAX_MULTISAMPLE] =
	{
 		D3DMULTISAMPLE_NONE,     "D3DMULTISAMPLE_NONE",
		D3DMULTISAMPLE_2_SAMPLES,"D3DMULTISAMPLE_2_SAMPLES",
		D3DMULTISAMPLE_3_SAMPLES,"D3DMULTISAMPLE_3_SAMPLES",
		D3DMULTISAMPLE_4_SAMPLES,"D3DMULTISAMPLE_4_SAMPLES",
		D3DMULTISAMPLE_5_SAMPLES,"D3DMULTISAMPLE_5_SAMPLES",
		D3DMULTISAMPLE_6_SAMPLES,"D3DMULTISAMPLE_6_SAMPLES",
		D3DMULTISAMPLE_7_SAMPLES,"D3DMULTISAMPLE_7_SAMPLES",
		D3DMULTISAMPLE_8_SAMPLES,"D3DMULTISAMPLE_8_SAMPLES",
		D3DMULTISAMPLE_9_SAMPLES,"D3DMULTISAMPLE_9_SAMPLES",
		D3DMULTISAMPLE_10_SAMPLES,"D3DMULTISAMPLE_10_SAMPLES",
		D3DMULTISAMPLE_11_SAMPLES,"D3DMULTISAMPLE_11_SAMPLES",
		D3DMULTISAMPLE_12_SAMPLES,"D3DMULTISAMPLE_12_SAMPLES",
		D3DMULTISAMPLE_13_SAMPLES,"D3DMULTISAMPLE_13_SAMPLES",
		D3DMULTISAMPLE_14_SAMPLES,"D3DMULTISAMPLE_14_SAMPLES",
		D3DMULTISAMPLE_15_SAMPLES,"D3DMULTISAMPLE_15_SAMPLES",
		D3DMULTISAMPLE_16_SAMPLES,"D3DMULTISAMPLE_16_SAMPLES"
	};


	for(int i = 0; i < MAX_MULTISAMPLE; i++) 
	{		
		if( FAILED( d3d_interface->CheckDeviceMultiSampleType( 
			selected_adapter, 
			D3DDEVTYPE_HAL , 
			mode.Format, FALSE, 
			(D3DMULTISAMPLE_TYPE) multisample_info[i].type ) ) ) {
			 break;
		}

		m_antialias_list.InsertString(i, multisample_info[i].text);
	}

	if(select > MAX_MULTISAMPLE)
		select = 0;


	m_antialias_list.SetCurSel(select);
}
开发者ID:scp-fs2open,项目名称:Launcher,代码行数:78,代码来源:DX8Disp.cpp


示例14: CreateGLWindow

BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag)
{
	GLuint		PixelFormat;			// Holds The Results After Searching For A Match
	WNDCLASS	wc;						// Windows Class Structure
	DWORD		dwExStyle;				// Window Extended Style
	DWORD		dwStyle;				// Window Style
	RECT		WindowRect;				// Grabs Rectangle Upper Left / Lower Right Values
	WindowRect.left=(long)0;			// Set Left Value To 0
	WindowRect.right=(long)width;		// Set Right Value To Requested Width
	WindowRect.top=(long)0;				// Set Top Value To 0
	WindowRect.bottom=(long)height;		// Set Bottom Value To Requested Height

	fullscreen=fullscreenflag;			// Set The Global Fullscreen Flag

	hInstance			= GetModuleHandle(NULL);				// Grab An Instance For Our Window
	wc.style			= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;	// Redraw On Size, And Own DC For Window.
	wc.lpfnWndProc		= (WNDPROC) WndProc;					// WndProc Handles Messages
	wc.cbClsExtra		= 0;									// No Extra Window Data
	wc.cbWndExtra		= 0;									// No Extra Window Data
	wc.hInstance		= hInstance;							// Set The Instance
	wc.hIcon			= LoadIcon(NULL, IDI_WINLOGO);			// Load The Default Icon
	wc.hCursor			= LoadCursor(NULL, IDC_ARROW);			// Load The Arrow Pointer
	wc.hbrBackground	= NULL;									// No Background Required For GL
	wc.lpszMenuName		= NULL;									// We Don't Want A Menu
	wc.lpszClassName	= "OpenGL";								// Set The Class Name

	if (!RegisterClass(&wc))									// Attempt To Register The Window Class
	{
		MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);
		return FALSE;											// Return FALSE
	}
	
	if (fullscreen)												// Attempt Fullscreen Mode?
	{
		DEVMODE dmScreenSettings;								// Device Mode
		memset(&dmScreenSettings,0,sizeof(dmScreenSettings));	// Makes Sure Memory's Cleared
		dmScreenSettings.dmSize=sizeof(dmScreenSettings);		// Size Of The Devmode Structure
		dmScreenSettings.dmPelsWidth	= width;				// Selected Screen Width
		dmScreenSettings.dmPelsHeight	= height;				// Selected Screen Height
		dmScreenSettings.dmBitsPerPel	= bits;					// Selected Bits Per Pixel
		dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;

		// Try To Set Selected Mode And Get Results.  NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
		if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
		{
			// If The Mode Fails, Offer Two Options.  Quit Or Use Windowed Mode.
			if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
			{
				fullscreen=FALSE;		// Windowed Mode Selected.  Fullscreen = FALSE
			}
			else
			{
				// Pop Up A Message Box Letting User Know The Program Is Closing.
				MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP);
				return FALSE;									// Return FALSE
			}
		}
	}

	if (fullscreen)												// Are We Still In Fullscreen Mode?
	{
		dwExStyle=WS_EX_APPWINDOW;								// Window Extended Style
		dwStyle=WS_POPUP;										// Windows Style
		ShowCursor(FALSE);										// Hide Mouse Pointer
	}
	else
	{
		dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;			// Window Extended Style
		dwStyle=WS_OVERLAPPEDWINDOW;							// Windows Style
	}

	AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);		// Adjust Window To True Requested Size

	// Create The Window
	if (!(hWnd=CreateWindowEx(	dwExStyle,							// Extended Style For The Window
								"OpenGL",							// Class Name
								title,								// Window Title
								dwStyle |							// Defined Window Style
								WS_CLIPSIBLINGS |					// Required Window Style
								WS_CLIPCHILDREN,					// Required Window Style
								0, 0,								// Window Position
								WindowRect.right-WindowRect.left,	// Calculate Window Width
								WindowRect.bottom-WindowRect.top,	// Calculate Window Height
								NULL,								// No Parent Window
								NULL,								// No Menu
								hInstance,							// Instance
								NULL)))								// Dont Pass Anything To WM_CREATE
	{
		KillGLWindow();								// Reset The Display
		MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);
		return FALSE;								// Return FALSE
	}

	static	PIXELFORMATDESCRIPTOR pfd=				// pfd Tells Windows How We Want Things To Be
	{
		sizeof(PIXELFORMATDESCRIPTOR),				// Size Of This Pixel Format Descriptor
		1,											// Version Number
		PFD_DRAW_TO_WINDOW |						// Format Must Support Window
		PFD_SUPPORT_OPENGL |						// Format Must Support OpenGL
		PFD_DOUBLEBUFFER,							// Must Support Double Buffering
//.........这里部分代码省略.........
开发者ID:xtmacbook,项目名称:OpenGL_NeHe,代码行数:101,代码来源:Lesson14.cpp


示例15: WinMain

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
  WNDCLASSEX winClass;
  HWND hwnd;
  MSG msg;

  // Process command line
  LPWSTR *argv = NULL;
  int argc;
  int i;
  unsigned short tilingMode = DEFAULT_TILING_MODE;

  argv = CommandLineToArgvW(GetCommandLineW(), &argc);

  for (i = 0; i < argc; i++) {
    char arg[128];
    wsprintfA(arg, "%S", argv[i]);

    if (i < (argc - 1)) {
      char nextarg[128];
      wsprintfA(nextarg, "%S", argv[i + 1]);

      if (!strcmp(arg, "-o")) {
        alpha = atoi(nextarg);
      } else if (!strcmp(arg, "-i")) {
        if (ignoreCount < MAX_IGNORE) {
          sprintf(ignoreClasses[ignoreCount++], "%s", nextarg);
        }
      } else if (!strcmp(arg, "-a")) {
        include_mode = 1; // Include mode instead of exclude

        if (includeCount < MAX_IGNORE) {
          sprintf(includeClasses[includeCount++], "%s", nextarg);
        }
      } else if (!strcmp(arg, "-m")) {
        int y;
        modkeys = 0;

        for (y = 0; y < strlen(nextarg); y++) {
          switch (nextarg[y])
          {
            case 'c':
              modkeys |= MOD_CONTROL;
              break;
            case 'a':
              modkeys |= MOD_ALT;
              break;
            case 's':
              modkeys |= MOD_SHIFT;
              break;
            case 'w':
              modkeys |= MOD_WIN;
              break;
          }
        }
      } else if (!strcmp(arg, "-t")) {
        tilingMode = atoi(nextarg);
      } else if (!strcmp(arg, "-left")) {
        screen_x = atoi(nextarg);
      } else if (!strcmp(arg, "-top")) {
        screen_y = atoi(nextarg);
      } else if (!strcmp(arg, "-width")) {
        screen_width = atoi(nextarg);
      } else if (!strcmp(arg, "-height")) {
        screen_height = atoi(nextarg);
      }
    }
    if (!strcmp(arg, "-v")) {
      MessageBox(NULL, VERSION, "Version", MB_OK);
      LocalFree(argv);
      return 1;
    } else if (!strcmp(arg, "-l")) {
      lockMouse = 1;
    } else if (!strcmp(arg, "-x")) {
      experimental_mouse = 1;
    } else if (!strcmp(arg, "--one-tag")) {
      one_tag_per_window = 1;
    }
  }

  // Initialize tags
  for (i = 0; i < TAGS; i++) {
    tags[i].nodes = NULL;
    tags[i].last_node = NULL;
    tags[i].current_window = NULL;
    tags[i].tilingMode = tilingMode;
    tags[i].masterarea_count = 1;
  }

  LocalFree(argv);

  winClass.cbSize = sizeof(WNDCLASSEX);
  winClass.style = 0;
  winClass.lpfnWndProc = WndProc;
  winClass.cbClsExtra = 0;
  winClass.cbWndExtra = 0;
  winClass.hInstance = hInstance;
  winClass.hIcon = NULL;
  winClass.hIconSm = NULL;
  winClass.hCursor = NULL;
//.........这里部分代码省略.........
开发者ID:ZaneA,项目名称:HashTWM,代码行数:101,

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MessageBoxA函数代码示例发布时间:2022-05-30
下一篇:
C++ MessageBeep函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap