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

C++ FindWindow函数代码示例

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

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



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

示例1: CaptureThread

DWORD WINAPI CaptureThread(HANDLE hDllMainThread)
{
    bool bSuccess = false;

    //wait for dll initialization to finish before executing any initialization code
    if(hDllMainThread)
    {
        WaitForSingleObject(hDllMainThread, INFINITE);
        CloseHandle(hDllMainThread);
    }

    TCHAR lpLogPath[MAX_PATH];
    SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, lpLogPath);
    wcscat_s(lpLogPath, MAX_PATH, TEXT("\\OBS\\pluginData\\captureHookLog.txt"));

    dummyEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

    if(!logOutput.is_open())
        logOutput.open(lpLogPath, ios_base::in | ios_base::out | ios_base::trunc, _SH_DENYNO);

    wstringstream str;
    str << OBS_KEEPALIVE_EVENT << UINT(GetCurrentProcessId());
    strKeepAlive = str.str();

    logOutput << CurrentDateTimeString() << "we're booting up: " << endl;

    InitializeCriticalSection(&d3d9EndMutex);
    InitializeCriticalSection(&glMutex);

    DWORD procID = GetCurrentProcessId();

    wstringstream strRestartEvent, strEndEvent, strReadyEvent, strExitEvent, strInfoMemory;
    strRestartEvent << RESTART_CAPTURE_EVENT << procID;
    strEndEvent     << END_CAPTURE_EVENT     << procID;
    strReadyEvent   << CAPTURE_READY_EVENT   << procID;
    strExitEvent    << APP_EXIT_EVENT        << procID;
    strInfoMemory   << INFO_MEMORY           << procID;

    hSignalRestart  = GetEvent(strRestartEvent.str().c_str());
    hSignalEnd      = GetEvent(strEndEvent.str().c_str());
    hSignalReady    = GetEvent(strReadyEvent.str().c_str());
    hSignalExit     = GetEvent(strExitEvent.str().c_str());

    DWORD bla;
    HANDLE hWindowThread = CreateThread(NULL, 0, DummyWindowThread, NULL, 0, &bla);
    if (!hWindowThread) {
        logOutput << CurrentTimeString() << "CaptureThread: could not create window thread for some reason" << endl;
        return 0;
    }

    CloseHandle(hWindowThread);

    hInfoFileMap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(CaptureInfo), strInfoMemory.str().c_str());
    if(!hInfoFileMap)
    {
        logOutput << CurrentTimeString() << "CaptureThread: could not info file mapping" << endl;
        return 0;
    }

    infoMem = (CaptureInfo*)MapViewOfFile(hInfoFileMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(CaptureInfo));
    if(!infoMem)
    {
        logOutput << CurrentTimeString() << "CaptureThread: could not map view of info shared memory" << endl;
        CloseHandle(hInfoFileMap);
        hInfoFileMap = NULL;
        return 0;
    }

    hwndOBS = FindWindow(OBS_WINDOW_CLASS, NULL);
    if(!hwndOBS)
    {
        logOutput << CurrentTimeString() << "CaptureThread: could not find main application window?  wtf?  seriously?" << endl;
        return 0;
    }

    textureMutexes[0] = OpenMutex(MUTEX_ALL_ACCESS, FALSE, TEXTURE_MUTEX1);
    if (textureMutexes[0]) {
        textureMutexes[1] = OpenMutex(MUTEX_ALL_ACCESS, FALSE, TEXTURE_MUTEX2);
        if (textureMutexes[1]) {
            while(!AttemptToHookSomething())
                Sleep(50);

            logOutput << CurrentTimeString() << "(half life scientist) everything..  seems to be in order" << endl;

            while (1) {
                AttemptToHookSomething();
                Sleep(4000);
            }

            CloseHandle(textureMutexes[1]);
            textureMutexes[1] = NULL;
        } else {
            logOutput << CurrentTimeString() << "could not open texture mutex 2" << endl;
        }

        CloseHandle(textureMutexes[0]);
        textureMutexes[0] = NULL;
    } else {
        logOutput << CurrentTimeString() << "could not open texture mutex 1" << endl;
    }
//.........这里部分代码省略.........
开发者ID:Andypro1,项目名称:OBS,代码行数:101,代码来源:GraphicsCaptureHook.cpp


示例2: ErrorMsg

void ErrorMsg(char *message)
{
	MessageBox(FindWindow("ConsoleWindowClass",NULL),(LPCTSTR)message,(LPCTSTR)"Error",MB_OK|MB_ICONWARNING);
	WSACleanup();
	exit(0);
}
开发者ID:tmdgus0118,项目名称:CNOM,代码行数:6,代码来源:ver_1.cpp


示例3: FindWindow

HWND
FormDeploy::getTabHwnd()
{
	return FindWindow(WC_TABCONTROL,  L"tab1");
}
开发者ID:counterm,项目名称:MyFirstMeetingInitializer,代码行数:5,代码来源:FormDeploy.cpp


示例4: wxLogMessage

void DataViewerAddColDlg::CreateControls()
{
    wxLogMessage("DataViewerAddColDlg::CreateControls()");
    SetBackgroundColour(*wxWHITE);
	if (time_variant && fixed_lengths) {
		wxXmlResource::Get()->LoadDialog(this, GetParent(), "ID_DATA_VIEWER_ADD_COL_TIME_FIXED_DLG");
	} else if (time_variant && !fixed_lengths) {
		wxXmlResource::Get()->LoadDialog(this, GetParent(), "ID_DATA_VIEWER_ADD_COL_TIME_DLG");
	} else if (!time_variant && fixed_lengths) {
		wxXmlResource::Get()->LoadDialog(this, GetParent(), "ID_DATA_VIEWER_ADD_COL_FIXED_DLG");
	} else { // !time_variant && !fixed_lengths 
		wxXmlResource::Get()->LoadDialog(this, GetParent(), "ID_DATA_VIEWER_ADD_COL_DLG");
	}
	m_apply_button = wxDynamicCast(FindWindow(XRCID("wxID_OK")), wxButton);
	
	m_name = wxDynamicCast(FindWindow(XRCID("ID_TEXT_NEW_NAME")), wxTextCtrl);
	m_name->SetValue(default_name);
	wxString name_chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789";
	wxTextValidator name_validator(wxFILTER_INCLUDE_CHAR_LIST);
	name_validator.SetCharIncludes(name_chars);
	m_name->SetValidator(name_validator);
	m_name_valid = false;
		
	m_type = wxDynamicCast(FindWindow(XRCID("ID_CHOICE_TYPE")), wxChoice);
	// add options for Float, Integer, String, or Date
	m_type->Append("real (eg 1.03, 45.7)");
	m_type->Append("integer (eg -1, 0, 23)");
	m_type->Append("string (eg New York)");
	//m_type->Append("date (eg 20110131)");
	
	wxStaticText* mt = wxDynamicCast(FindWindow(XRCID("ID_STATIC_INSERT_POS")), wxStaticText);
	m_insert_pos = wxDynamicCast(FindWindow(XRCID("ID_CHOICE_INSERT_POS")), wxChoice);
    
    //if ( !project->IsFileDataSource()) {
    //    mt->Disable();
    //    m_insert_pos->Disable();
    //}

	m_displayed_decimals_lable =  wxDynamicCast(FindWindow(XRCID("ID_STATIC_DISPLAYED_DECIMALS")), wxStaticText);
	m_displayed_decimals = wxDynamicCast(FindWindow(XRCID("ID_DISPLAYED_DECIMALS")), wxChoice);
	m_displayed_decimals->Append("default");
	m_displayed_decimals->Append("1");
	m_displayed_decimals->Append("2");
	m_displayed_decimals->Append("3");
	m_displayed_decimals->Append("4");
	m_displayed_decimals->Append("5");
	m_displayed_decimals->Append("6");
	m_displayed_decimals->Append("7");
	m_displayed_decimals->Append("8");
	m_displayed_decimals->Append("9");
	m_displayed_decimals->Append("10");
	
	if (fixed_lengths) {
		m_length_lable = wxDynamicCast(FindWindow(XRCID("ID_STATIC_LENGTH")), wxStaticText);
		m_length = wxDynamicCast(FindWindow(XRCID("ID_TEXT_LENGTH")), wxTextCtrl);
		m_length->SetValidator(wxTextValidator(wxFILTER_DIGITS));
		m_length_valid = true;

		m_decimals_lable = wxDynamicCast(FindWindow(XRCID("ID_STATIC_DECIMALS")), wxStaticText);
		m_decimals = wxDynamicCast(FindWindow(XRCID("ID_TEXT_DECIMALS")), wxTextCtrl);
		m_decimals->SetValidator(wxTextValidator(wxFILTER_DIGITS));
		m_decimals_valid = true;
	
		m_max_label = wxDynamicCast(FindWindow(XRCID("ID_STATIC_MAX_LABEL")), wxStaticText);
		m_max_val = wxDynamicCast(FindWindow(XRCID("ID_STATIC_MAX_VAL")),  wxStaticText);

		m_min_label = wxDynamicCast(FindWindow(XRCID("ID_STATIC_MIN_LABEL")), wxStaticText);
		m_min_val = wxDynamicCast(FindWindow(XRCID("ID_STATIC_MIN_VAL")), wxStaticText);
	}
	
	if (default_field_type == GdaConst::double_type) {
		m_type->SetSelection(0);
	} else if (default_field_type == GdaConst::long64_type) {
		m_type->SetSelection(1);
	} else if (default_field_type == GdaConst::string_type) {
		m_type->SetSelection(2);
	} else if (default_field_type == GdaConst::date_type) {
		m_type->SetSelection(3);
	} else {
		m_type->SetSelection(0);
	}

    
    Connect(XRCID("ID_TEXT_NEW_NAME"), wxEVT_COMMAND_TEXT_ENTER,
            wxCommandEventHandler(DataViewerAddColDlg::OnOkClick));
    Connect(XRCID("ID_TEXT_LENGTH"), wxEVT_COMMAND_TEXT_ENTER,
            wxCommandEventHandler(DataViewerAddColDlg::OnOkClick));
    Connect(XRCID("ID_TEXT_DECIMALS"), wxEVT_COMMAND_TEXT_ENTER,
            wxCommandEventHandler(DataViewerAddColDlg::OnOkClick));
    
	CheckName();
	SetDefaultsByType(default_field_type);
}
开发者ID:lixun910,项目名称:geoda,代码行数:93,代码来源:DataViewerAddColDlg.cpp


示例5: WinMain

int CALLBACK WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmd, int show)
{
//  AllocConsole();
//  AttachConsole(GetCurrentProcessId());
#pragma warning(push)
#pragma warning( disable : 4996 )
//  freopen("CON", "w", stdout);
#pragma warning(pop)

  HANDLE mutex = CreateMutex(NULL, TRUE, g_mutex_name);
  if(!mutex) return 0;

  if(GetLastError() == ERROR_ALREADY_EXISTS)
  {
    HWND hwnd = FindWindow(g_class_name, g_title);
    if(hwnd)
    {
      ShowWindow(hwnd, SW_SHOW);
      SetForegroundWindow(hwnd);
    }
    ReleaseMutex(mutex);
    CloseHandle(mutex);
    return 0;
  }

  WMU_SNAPIT_UNINSTALL = RegisterWindowMessage(g_message_name);

  g_icon = (HICON)LoadImage(NULL, g_icon_name, IMAGE_ICON, 0, 0, LR_LOADFROMFILE);

  WNDCLASSEX wc;
  ZeroMemory(&wc, sizeof(wc));
  wc.cbSize        = sizeof(wc);
  wc.style         = CS_VREDRAW | CS_HREDRAW;
  wc.lpfnWndProc   = fproc;
  wc.cbClsExtra    = 0;
  wc.cbWndExtra    = 0;
  wc.hIcon         = g_icon;
  wc.hCursor       = LoadCursor(0, IDC_ARROW);
  wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
  wc.lpszMenuName  = 0;
  wc.lpszClassName = g_class_name;
  wc.hInstance     = hinst;
  wc.hIconSm       = g_icon;

  RegisterClassEx(&wc);

  HWND hwnd = CreateWindowEx(
    WS_EX_CLIENTEDGE,
    g_class_name, g_title,
    WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
    CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
    0, 0, hinst, 0
  );

  ReleaseMutex(mutex);

  if(hwnd == 0)
  {
    CloseHandle(mutex);
    return 0;
  }

  memset(&g_idata, 0, sizeof(g_idata));
  g_idata.cbSize = sizeof(g_idata);
  g_idata.hWnd = hwnd;
  g_idata.uFlags = NIF_MESSAGE | NIF_ICON;
  g_idata.uCallbackMessage = WMU_TRAYICON;
  g_idata.hIcon = g_icon;

  g_menu = CreatePopupMenu();
  AppendMenu(g_menu, MF_STRING | MF_GRAYED, ID_MENU_INSTALL, "Install");
  AppendMenu(g_menu, MF_STRING | MF_GRAYED, ID_MENU_UNINSTALL, "Uninstall");
  AppendMenu(g_menu, MF_STRING, ID_MENU_HIDE, "Hide");
  AppendMenu(g_menu, MF_STRING, ID_MENU_EXIT, "Exit");

  Shell_NotifyIcon(NIM_ADD, &g_idata);
  hook_install_();

  MSG msg;
  while(GetMessage(&msg, 0, 0, 0) > 0)
  {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }

  hook_uninstall_();
  Shell_NotifyIcon(NIM_DELETE, &g_idata);

  CloseHandle(mutex);
  return 0;
}
开发者ID:akozlins,项目名称:snapit,代码行数:91,代码来源:snapit.cpp


示例6: wxBoxSizer


//.........这里部分代码省略.........
  itemStaticBoxSizer14->Add(itemBoxSizer16, 0, wxGROW|wxALL, 5);

  m_passwordCtrl = new wxTextCtrl( itemDialog1, ID_PASSWORD_TXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
  itemBoxSizer16->Add(m_passwordCtrl, 5, wxALIGN_CENTER_VERTICAL|wxALL, 5);

  wxBitmapButton* itemBitmapButton18 = new wxBitmapButton( itemDialog1, ID_BITMAPBUTTON, itemDialog1->GetBitmapResource(wxT("graphics/toolbar/new/copypassword.xpm")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
  wxBitmap itemBitmapButton18BitmapDisabled(itemDialog1->GetBitmapResource(wxT("graphics/toolbar/new/copypassword_disabled.xpm")));
  itemBitmapButton18->SetBitmapDisabled(itemBitmapButton18BitmapDisabled);
  if (CManagePasswordPolicies::ShowToolTips())
    itemBitmapButton18->SetToolTip(_("Copy Password to clipboard"));
  itemBoxSizer16->Add(itemBitmapButton18, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

  m_lowerTableDesc = new wxStaticText( itemDialog1, wxID_STATIC, _("Selected policy details:"), wxDefaultPosition, wxDefaultSize, 0 );
  itemBoxSizer2->Add(m_lowerTableDesc, 0, wxALIGN_LEFT|wxALL, 5);

  wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
  itemBoxSizer2->Add(itemBoxSizer20, 0, wxGROW|wxALL, 5);

  m_PolicyDetails = new wxGrid( itemDialog1, ID_POLICYPROPERTIES, wxDefaultPosition, wxSize(-1, 150), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
  m_PolicyDetails->SetDefaultColSize(210);
  m_PolicyDetails->SetDefaultRowSize(25);
  m_PolicyDetails->SetColLabelSize(25);
  m_PolicyDetails->SetRowLabelSize(50);
  m_PolicyDetails->CreateGrid(5, 2, wxGrid::wxGridSelectRows);
  itemBoxSizer20->Add(m_PolicyDetails, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

  m_PolicyEntries = new wxGrid( itemDialog1, ID_POLICYENTRIES, wxDefaultPosition, wxSize(-1, 150), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
  m_PolicyEntries->SetDefaultColSize(140);
  m_PolicyEntries->SetDefaultRowSize(25);
  m_PolicyEntries->SetColLabelSize(25);
  m_PolicyEntries->SetRowLabelSize(50);
  m_PolicyEntries->CreateGrid(5, 3, wxGrid::wxGridSelectRows);
  itemBoxSizer20->Add(m_PolicyEntries, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

  wxStdDialogButtonSizer* itemStdDialogButtonSizer23 = new wxStdDialogButtonSizer;

  itemBoxSizer2->Add(itemStdDialogButtonSizer23, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
  wxButton* itemButton24 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
  itemStdDialogButtonSizer23->AddButton(itemButton24);

  wxButton* itemButton25 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
  itemStdDialogButtonSizer23->AddButton(itemButton25);

  wxButton* itemButton26 = new wxButton( itemDialog1, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
  itemStdDialogButtonSizer23->AddButton(itemButton26);

  itemStdDialogButtonSizer23->Realize();

////@end CManagePasswordPolicies content construction

  if (m_core.IsReadOnly()) {
    FindWindow(wxID_NEW)->Enable(false);
    FindWindow(wxID_DELETE)->Enable(false);

    // Hide cancel button & change OK button text
    FindWindow(wxID_CANCEL)->Enable(false);
    FindWindow(wxID_CANCEL)->Show(false);

    FindWindow(wxID_OK)->SetLabel(_("Close"));
    FindWindow(ID_EDIT_PP)->SetLabel(_("View"));
  }

  // We have 2 grids, but we show only one at a time,
  // toggle when user clicks on ID_LIST button.
  // Setting these up:
  m_PolicyNames->SetRowLabelSize(0);
  int col0Width = m_PolicyNames->GetColSize(0);
  col0Width += 45;
  m_PolicyNames->SetColSize(0, col0Width);
  m_PolicyNames->SetColLabelValue(0, _("Policy Name"));
  m_PolicyNames->SetColLabelValue(1, _("Use count"));
  UpdateNames();
  m_PolicyNames->SelectRow(0);

  // Since we select the default policy, disable List & Delete
  FindWindow(ID_LIST)->Enable(false);
  FindWindow(wxID_DELETE)->Enable(false);

  m_PolicyDetails->SetRowLabelSize(0);
  m_PolicyDetails->SetColLabelValue(0, _("Policy Field"));
  m_PolicyDetails->SetColLabelValue(1, _("Value"));
  UpdateDetails();

  m_PolicyEntries->SetRowLabelSize(0);
  m_PolicyEntries->SetColLabelValue(0, _("Group"));
  m_PolicyEntries->SetColLabelValue(1, _("Title"));
  m_PolicyEntries->SetColLabelValue(2, _("User Name"));

  ShowPolicyDetails();

  // Max. of 255 policy names allowed - only 2 hex digits used for number
  if (m_MapPSWDPLC.size() >= 255)
    FindWindow(wxID_NEW)->Enable(false);

  // No changes yet
  FindWindow(wxID_UNDO)->Enable(false);
  FindWindow(wxID_REDO)->Enable(false);

  m_PolicyNames->SetFocus();
}
开发者ID:pwsafe,项目名称:pwsafe,代码行数:101,代码来源:ManagePwdPolicies.cpp


示例7: RestoreSettings

BOOL RestoreSettings(HWND hWnd)
{	
	// Check whether locate32 is running
	HWND hLocateSTWindow=FindWindow("LOCATEAPPST",NULL);
	if (hLocateSTWindow!=NULL)
	{
		char szText[100];
		LoadString(hInst,IDS_LOCATE32RUNNING,szText,100);
		if (MessageBox(hWnd,szText,NULL,MB_OKCANCEL|MB_ICONINFORMATION))
			return FALSE;
	}



	char szPath[MAX_PATH]="";
	char szTitle[100],szFilter[200];
	OSVERSIONINFO ve;
	ve.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
	if (GetVersionEx(&ve))
	{
		if (ve.dwPlatformId==VER_PLATFORM_WIN32_NT)
			LoadString(hInst,IDS_RESTOREFILTER,szFilter,200);
		else
			LoadString(hInst,IDS_RESTOREFILTER9x,szFilter,200);
	}
	else
		LoadString(hInst,IDS_RESTOREFILTER,szFilter,200);
	
	LoadString(hInst,IDS_RESTORESETTINGS,szTitle,100);

	for (int i=0;szFilter[i]!='\0';i++)
	{
		if (szFilter[i]=='|')
			szFilter[i]='\0';
	}

	OPENFILENAME ofn;
	ZeroMemory(&ofn,sizeof(OPENFILENAME));
	ofn.lStructSize=OPENFILENAME_SIZE_VERSION_400;
	ofn.hwndOwner=hWnd;
	ofn.hInstance=hInst;
	ofn.lpstrFilter=szFilter;
	ofn.lpstrFile=szPath;
	ofn.nMaxFile=MAX_PATH;
	ofn.lpstrTitle=szTitle;
	ofn.Flags=OFN_ENABLESIZING|OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_LONGNAMES|OFN_HIDEREADONLY;
	ofn.lpstrDefExt="*.reg";

	if (!GetOpenFileName(&ofn))
		return FALSE;
	
	int nDotIndex;
	for (nDotIndex=(int)strlen(szPath)-1;nDotIndex>=0 && szPath[nDotIndex]!='.';nDotIndex--);

	if (nDotIndex>=0 && _stricmp(szPath+nDotIndex+1,"reg")==0)
	{
		char szBackup[MAX_PATH];
		CopyMemory(szBackup,szPath,nDotIndex+1);
		strcpy_s(szBackup+nDotIndex+1,MAX_PATH-nDotIndex-1,"old.reg");
				
		// Backing up
		char szCommand[2000];
		sprintf_s(szCommand,2000,"regedit /ea \"%s\" HKEY_CURRENT_USER\\Software\\Update",szBackup);

		PROCESS_INFORMATION pi;
		STARTUPINFO si; // Ansi and Unicode versions are same
		ZeroMemory(&si,sizeof(STARTUPINFO));
		si.cb=sizeof(STARTUPINFO);
		
		if (CreateProcess(NULL,szCommand,NULL,
			NULL,FALSE,CREATE_DEFAULT_ERROR_MODE|NORMAL_PRIORITY_CLASS,
			NULL,NULL,&si,&pi))
		{
			WaitForSingleObject(pi.hProcess,2000);
			CloseHandle(pi.hThread);
			CloseHandle(pi.hProcess);	
		}
		else
			ShowError(hWnd,IDS_ERRORCANNOTRUNREGEDIT,GetLastError());

		
		
		// Restore key
		DeleteSubKey(HKEY_CURRENT_USER,"SOFTWARE\\Update");
		sprintf_s(szCommand,2000,"regedit /s \"%s\"",szPath);

		ZeroMemory(&si,sizeof(STARTUPINFO));
		si.cb=sizeof(STARTUPINFO);
		
		if (CreateProcess(NULL,szCommand,NULL,
			NULL,FALSE,CREATE_DEFAULT_ERROR_MODE|NORMAL_PRIORITY_CLASS,
			NULL,NULL,&si,&pi))
		{
			CloseHandle(pi.hThread);
			CloseHandle(pi.hProcess);	
		}
		else
			ShowError(hWnd,IDS_ERRORCANNOTRUNREGEDIT,GetLastError());


//.........这里部分代码省略.........
开发者ID:quachdnguyen,项目名称:locate-src,代码行数:101,代码来源:SettingsTool.cpp


示例8: InitInstance

//
//  FUNCTION: InitInstance(HANDLE, int)
//
//  PURPOSE: Saves instance handle and creates main window
//
//  COMMENTS:
//
//    In this function, we save the instance handle in a global variable and
//    create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow, LPTSTR lpCmdLine)
{
	HWND	hWnd = NULL;
	TCHAR	szTitle[MAX_LOADSTRING];			// The title bar text
	TCHAR	szWindowClass[MAX_LOADSTRING];		// The window class name
    BOOL    bAlreadyRunning = FALSE;

	hInst = hInstance;		// Store instance handle in our global variable
	// Initialize global strings
	LoadString(hInstance, IDC_STARTAPP, szWindowClass, MAX_LOADSTRING);
	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);

	//If it is already running, then focus on the window
	hWnd = FindWindow(szWindowClass, szTitle);	
	if (hWnd) 
	{
        SetForegroundWindow ((HWND) (((DWORD)hWnd) | 0x01));

		// Set return value to indicate that we
		// want to close down this process.
        bAlreadyRunning = TRUE;
	}
    else
    {
	    MyRegisterClass(hInstance, szWindowClass);
	    
	    RECT	rect;
	    GetClientRect(hWnd, &rect);
	    
	    hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
		    CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
	    if (!hWnd)
	    {	
		    return FALSE;
	    }
    }

	// Data on the command line means we have a notication.
	// Send details to main window.
	if (_tcslen(lpCmdLine) > 0)
	{
		COPYDATASTRUCT cds;
		cds.cbData = (_tcslen(lpCmdLine)+1) * sizeof(TCHAR);
		cds.dwData = 0;
		cds.lpData = lpCmdLine;

		SendMessage(hWnd, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
	}

	if (bAlreadyRunning)
	    return FALSE;

	// If started by user, request notifications.
	if (_tcslen(lpCmdLine) == 0)
	{
	    TCHAR tchApp[MAX_PATH];
		GetModuleFileName(hInstance, tchApp, MAX_PATH);

		// First, clear out any previous requests.
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_NONE);

		// Now, let's register some more.z
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_DEVICE_CHANGE);
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_RESTORE_END);
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_RS232_DETECTED);
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_SYNC_END);
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_TIME_CHANGE);


#ifdef NOTIFICATION_EVENT_TZ_CHANGE
		// New for CE 3.0
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_TZ_CHANGE);
#endif
#ifdef NOTIFICATION_EVENT_WAKEUP
		// New for CE 3.0
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_WAKEUP);
#endif

		// Docs say these aren't supported. Are they?
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_ON_AC_POWER);
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_OFF_AC_POWER);
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_NET_CONNECT);
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_NET_DISCONNECT);
		CeRunAppAtEvent(tchApp, NOTIFICATION_EVENT_IR_DISCOVERED);
	}

//

	ShowWindow(hWnd, nCmdShow);
	UpdateWindow(hWnd);
//.........这里部分代码省略.........
开发者ID:venkatarajasekhar,项目名称:repo,代码行数:101,代码来源:STARTAPP.cpp


示例9: FindWindow

void GraphicsCaptureSource::AttemptCapture()
{
    //Log(TEXT("attempting to capture.."));

    if (!bUseHotkey)
        hwndTarget = FindWindow(strWindowClass, NULL);
    else
    {
        hwndTarget = hwndNextTarget;
        hwndNextTarget = NULL;
    }

    if (hwndTarget)
    {
        GetWindowThreadProcessId(hwndTarget, &targetProcessID);
        if(!targetProcessID)
        {
            AppWarning(TEXT("GraphicsCaptureSource::BeginScene: GetWindowThreadProcessId failed, GetLastError = %u"), GetLastError());
            bErrorAcquiring = true;
            return;
        }
    }
    else
    {
        if (!bUseHotkey && !warningID)
            warningID = API->AddStreamInfo(Str("Sources.SoftwareCaptureSource.WindowNotFound"), StreamInfoPriority_High);

        bCapturing = false;

        return;
    }

    if(warningID)
    {
        API->RemoveStreamInfo(warningID);
        warningID = 0;
    }

    //-------------------------------------------
    // see if we already hooked the process.  if not, inject DLL

    char pOPStr[12];
    mcpy(pOPStr, "NpflUvhel{x", 12); //OpenProcess obfuscated
    for (int i=0; i<11; i++) pOPStr[i] ^= i^1;

    OPPROC pOpenProcess = (OPPROC)GetProcAddress(GetModuleHandle(TEXT("KERNEL32")), pOPStr);

    HANDLE hProcess = (*pOpenProcess)(PROCESS_ALL_ACCESS, FALSE, targetProcessID);
    if(hProcess)
    {
        //-------------------------------------------
        // load keepalive event

        hOBSIsAlive = CreateEvent(NULL, FALSE, FALSE, String() << OBS_KEEPALIVE_EVENT << UINT(targetProcessID));

        //-------------------------------------------

        hwndCapture = hwndTarget;

        hSignalRestart = OpenEvent(EVENT_ALL_ACCESS, FALSE, String() << RESTART_CAPTURE_EVENT << UINT(targetProcessID));
        if(hSignalRestart)
        {
            SetEvent(hSignalRestart);
            bCapturing = true;
            captureWaitCount = 0;
        }
        else
        {
            BOOL bSameBit = TRUE;

            if(Is64BitWindows())
            {
                BOOL bCurrentProcessWow64, bTargetProcessWow64;
                IsWow64Process(GetCurrentProcess(), &bCurrentProcessWow64);
                IsWow64Process(hProcess, &bTargetProcessWow64);

                bSameBit = (bCurrentProcessWow64 == bTargetProcessWow64);
            }

            if(bSameBit)
            {
                String strDLL;
                DWORD dwDirSize = GetCurrentDirectory(0, NULL);
                strDLL.SetLength(dwDirSize);
                GetCurrentDirectory(dwDirSize, strDLL);

                strDLL << TEXT("\\plugins\\GraphicsCapture\\GraphicsCaptureHook");

                BOOL b32bit = TRUE;
                if(Is64BitWindows())
                    IsWow64Process(hProcess, &b32bit);

                if(!b32bit)
                    strDLL << TEXT("64");

                strDLL << TEXT(".dll");

                if(InjectLibrary(hProcess, strDLL))
                {
                    captureWaitCount = 0;
//.........这里部分代码省略.........
开发者ID:AaronMike,项目名称:OBS,代码行数:101,代码来源:GraphicsCaptureSource.cpp


示例10: UdpSocketThread

bool GNSx30Proxy::open(int gnsType)
{
	bool res = true;

    if(stateInitialized != m_state)
    {
        res = false;
        return res;
    }


    HKEY hKey;
    DWORD dwDisposition;

    //Default frquencies
    m_comActive = 134100;
    m_comStandby = 130825;
    m_navActive = 108700;
    m_navStandby = 111450;

    m_pvData->gnsType = gnsType;

    m_pvData->garminTrainerPort = TRAINER_PORT;
    m_pvData->proxyPort = PROXY_PORT;


    //Start the serverThread
    m_pServerSocketThread = new UdpSocketThread(m_pvData->proxyPort);
    m_pServerSocketThread->create();
    m_pServerSocketThread->setCallback(UdpDataCallback, this);
    m_pServerSocketThread->resume();
    

    m_pClientSocket  = new UdpSocket();
    m_pClientSocket->openForSending("127.0.0.1", m_pvData->garminTrainerPort);


    if (ERROR_SUCCESS!= RegCreateKeyEx(HKEY_CURRENT_USER, GARMIN_INTERNATIONAL_SETTINGS, 0, NULL, 
        REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey,&dwDisposition)
        )
    {
        logMessageEx("??? GNSx30Proxy::open Error creating key " GARMIN_INTERNATIONAL_SETTINGS);

        res = false;
        return res;
    }

    if(TYPE_GNS430 == gnsType)
    {

        //Create the trainer settings values
        if (ERROR_SUCCESS != RegSetValueEx(hKey, "CDUType", 0, REG_SZ, (LPBYTE)GNS_430AWT, strlen(GNS_430AWT) + 1))
        {
            logMessageEx("??? GNSx30Proxy::open Error writing key CDUType");

            res = false;
            return res;
        }
    }else if(TYPE_GNS530 == gnsType)
    {
        //Create the trainer settings values
        if (ERROR_SUCCESS != RegSetValueEx(hKey, "CDUType", 0, REG_SZ, (LPBYTE)GNS_530AWT, strlen(GNS_530AWT) + 1))
        {
            logMessageEx("??? GNSx30Proxy::open Error writing key CDUType");

            res = false;
            return res;
        }
    }

    
    RegFlushKey(hKey);
    RegCloseKey(hKey);



	memset(m_pvData->LCD_data,0x00, OFFSCREEN_BUFFER_WIDTH*OFFSCREEN_BUFFER_HEIGHT*4);

    startAndInject(m_trainter_exe, m_trainter_path, m_interface_lib, m_hideGUI);




	int count = 0;
	bool procesStarted = false;
	while(count < 20) // 10 sec
	{
		m_win = FindWindow("AfxFrameOrView42", "GARMIN 400W/500W Trainer");
		if(NULL != m_win)
		{
			procesStarted = true;
			break;
		}
		Sleep(500);
		count++;
	}

	if(!procesStarted)
	{
		logMessageEx("??? GNSx30Proxy::Open Error starting process %s", m_trainter_exe);
//.........这里部分代码省略.........
开发者ID:rwwende,项目名称:garmin-gns-430-530-interface,代码行数:101,代码来源:gnsx30proxy.cpp


示例11: WinMain

int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine,int nCmdShow)
{
  HWND hprevwnd = FindWindow(szWindowClass,NULL);
  if ( hprevwnd != NULL){
    MessageBox(NULL,"「かぜそみそ」はすでに起動しています","(・◇・)",MB_OK);
    return 0;
  }

  // GDI+が使えるかチェック
  HMODULE hmd = LoadLibrary("gdiplus.dll");
  if(hmd != NULL){
    gdiplus_useable = TRUE;
    FreeLibrary(hmd); // 遅延ロードで勝手にロードしてくれるはずなのでFreeする
  }else{
    gdiplus_useable = FALSE;
  }

  ULONG_PTR gdiplusToken = NULL;
  if(gdiplus_useable){
    Gdiplus::GdiplusStartupInput gdiplusStartupInput;
    Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
  }
  srand(GetTickCount());

  SetCurrentDirectoryToExePath();

  if(!LoadTorifuda()){
    return 0;
  }
  if(!LoadYomiFuda()){
    return 0;
  }
  std::string s1,s2;
  std::vector<int> notnigate;

  currentdesign.tori = & currenttori;

  currentdesign.yomi = & currentyomi;

  tori_or_yomi = TORI;
  LoadFromIniFile(0,currentdesign,&notnigate);

  tori_or_yomi = YOMI;
  LoadFromIniFile(0,currentdesign,NULL);

  tori_or_yomi = TORI;
  currentdesign.UpdateSize();

  std::vector<int>::iterator it;
  for(it = notnigate.begin(); it != notnigate.end(); it++){
   torifuda[*it].nigatefuda = FALSE;
  }
  firstfuda.simonoku = firstfudalist[myrandint(sizeof(firstfudalist) / sizeof(*firstfudalist))];
  firstfuda.kimariji = std::string("きまりじ");

  currentfuda = &firstfuda;
  currentdesign.kimariji = currentfuda->kimariji;
  currentdesign.simonoku = currentfuda->simonoku;
  currentdesign.waka = std::string("難波津(なにはづ)に\n咲(さ)くやこの花(はな)\n冬(ふゆ)ごもり\n今(いま)を春(はる)べと\n咲(さ)くやこの花(はな)");

  MSG msg;
  MyRegisterClass(hInstance);
  if (!InitInstance (hInstance, nCmdShow))
  {
    return FALSE;
  }
  HACCEL hAccelTable;
  hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_KAZESOMISO);
  BeginPrinter();
  while (GetMessage(&msg, NULL, 0, 0))
  {
    if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) 
    {
      if(hDlgWnd == NULL || !IsDialogMessage(hDlgWnd,&msg)){
        TranslateMessage(&msg);
        DispatchMessage(&msg);
      }
    }
  }
  EndPrinter();
  if(gdiplusToken != NULL){
    Gdiplus::GdiplusShutdown(gdiplusToken);
  }
  return (int) msg.wParam;
}
开发者ID:pjmtdw,项目名称:kazesomiso,代码行数:85,代码来源:kazesomiso.cpp


示例12: FindWindow

bool ecAdminDialog::PopulatePackageTree (const wxString& packageDatabase)
{
    wxTreeCtrl* treeCtrl = (wxTreeCtrl*) FindWindow( ecID_ADMIN_DIALOG_TREE) ;

    // delete any existing CDL database
    
    if (m_CdlPkgData)
    {
        delete m_CdlPkgData;
        m_CdlPkgData = NULL;
    }
    
    // load the package database
    
    try
    {
        // Cdl asserts unless the handlers are present.
        m_CdlPkgData = CdlPackagesDatabaseBody::make (ecUtils::UnicodeToStdStr (packageDatabase), &CdlErrorHandler, &CdlWarningHandler);
    }
    catch (CdlStringException exception)
    {
        wxString strMessage;
        strMessage.Printf (_("Error loading database:\n\n%s"), (const wxChar*) wxString (exception.get_message ().c_str ()));
        wxMessageBox(strMessage, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK);
        return FALSE;
    }
    catch (...)
    {
        wxMessageBox(_("Error loading database"), (const wxChar*) wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK);
        return FALSE;
    }
    
    // clear the old package tree
    
    ClearPackageTree ();
    
    // Add a root item
    wxTreeItemId rootId = m_treeCtrl->AddRoot(_("Packages"), 0, -1);

    // populate the new package tree
    
    const std::vector<std::string>& packages = m_CdlPkgData->get_packages ();
    for (std::vector<std::string>::const_iterator package = packages.begin (); package != packages.end (); package++)
    {
        // add a package node
        
        wxTreeItemId hPackage = treeCtrl->AppendItem (treeCtrl->GetRootItem(), wxString (m_CdlPkgData->get_package_aliases (*package) [0].c_str ()));
        treeCtrl->SetItemData (hPackage, new ecAdminItemData(wxString (package->c_str ())));
        treeCtrl->SetItemImage (hPackage, 0, wxTreeItemIcon_Normal);
        treeCtrl->SetItemImage (hPackage, 0, wxTreeItemIcon_Selected);
        treeCtrl->SetItemImage (hPackage, 0, wxTreeItemIcon_Expanded);
        treeCtrl->SetItemImage (hPackage, 0, wxTreeItemIcon_SelectedExpanded);
        
        const std::vector<std::string>& versions = m_CdlPkgData->get_package_versions (* package);
        for (std::vector<std::string>::const_iterator version = versions.begin (); version != versions.end (); version++)
        {
            // add a version node
            const wxTreeItemId hVersion = treeCtrl->AppendItem ( hPackage, wxString (version->c_str ()));
            treeCtrl->SetItemImage (hVersion, 1, wxTreeItemIcon_Normal);
            treeCtrl->SetItemImage (hVersion, 1, wxTreeItemIcon_Selected);
            treeCtrl->SetItemImage (hVersion, 1, wxTreeItemIcon_Expanded);
            treeCtrl->SetItemImage (hVersion, 1, wxTreeItemIcon_SelectedExpanded);
        }
        treeCtrl->SortChildren (hPackage); // sort the version nodes
    }
    
    treeCtrl->SortChildren (treeCtrl->GetRootItem()); // sort the package nodes
    treeCtrl->Expand(treeCtrl->GetRootItem());
    
    return TRUE;
}
开发者ID:Undrizzle,项目名称:yolanda,代码行数:71,代码来源:admindlg.cpp


示例13: gui_init

pj_status_t gui_init(gui_menu *menu)
{
    WNDCLASS wc;
    HWND hWnd = NULL;	
    RECT r;
    DWORD dwStyle;

    pj_status_t status  = PJ_SUCCESS;
    
    /* Check if app is running. If it's running then focus on the window */
    hWnd = FindWindow(MAINWINDOWCLASS, MAINWINDOWTITLE);

    if (NULL != hWnd) {
	SetForegroundWindow(hWnd);    
	return status;
    }

    g_menu = menu;

    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = (WNDPROC)DialogProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = g_hInst;
    wc.hIcon = 0;
    wc.hCursor = 0;
    wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName	= 0;
    wc.lpszClassName = MAINWINDOWCLASS;
    
    if (!RegisterClass(&wc) != 0) {
	DWORD err = GetLastError();
	return PJ_RETURN_OS_ERROR(err);
    }

    /* Create the app. window */
    g_hWndMain = CreateWindow(MAINWINDOWCLASS, MAINWINDOWTITLE,
			      WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 
			      CW_USEDEFAULT, CW_USEDEFAULT,
			      (HWND)NULL, NULL, g_hInst, (LPSTR)NULL);

    /* Create edit control to print log */
    GetClientRect(g_hWndMain, &r);
    dwStyle = WS_CHILD | WS_VISIBLE | WS_VSCROLL |
	      ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL | ES_LEFT;
    g_hWndLog = CreateWindow(
                TEXT("EDIT"),   // Class name
                NULL,           // Window text
                dwStyle,        // Window style
                0,		// x-coordinate of the upper-left corner
                0,              // y-coordinate of the upper-left corner
		r.right-r.left, // Width of the window for the edit
                                // control
		r.bottom-r.top, // Height of the window for the edit
                                // control
                g_hWndMain,     // Window handle to the parent window
                (HMENU) 0,	// Control identifier
                g_hInst,        // Instance handle
                NULL);          // Specify NULL for this parameter when 
                                // you create a control

    /* Resize the log */
    if (g_hWndMenuBar) {
	RECT r_menu = {0};

	GetWindowRect(g_hWndLog, &r);
	GetWindowRect(g_hWndMenuBar, &r_menu);
	if (r.bottom > r_menu.top) {
	    MoveWindow(g_hWndLog, 0, 0, r.right-r.left, 
		       (r.bottom-r.top)-(r_menu.bottom-r_menu.top), TRUE);
	}
    }

    /* Focus it, so SP user can scroll the log */
    SetFocus(g_hWndLog);

    /* Get the log thread */
    g_log_thread = pj_thread_this();

    /* Redirect log & update log decor setting */
    /*
    log_decor = pj_log_get_decor();
    log_decor = PJ_LOG_HAS_NEWLINE | PJ_LOG_HAS_CR;
    pj_log_set_decor(log_decor);
    */
    g_log_writer_orig = pj_log_get_log_func();
    pj_log_set_log_func(&log_writer);

    return status;
}
开发者ID:carlosdelfino,项目名称:WorkshopTelefoniaAutomacao,代码行数:90,代码来源:main_wm.c


示例14: WinMain

// Windows メイン
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
#ifdef _DEBUG
	int newFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) ;
	newFlag |= _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF ; // | _CRTDBG_DELAY_FREE_MEM_DF ;
	_CrtSetDbgFlag(newFlag) ;
	_ASSERTE(_CrtCheckMemory()) ;
#endif

	// スクリーンセーバモードで起動中のものがあれば
	// その場で終了
	HWND win ;
	win = FindWindow("GLUT", "glclock screen saver") ;
	if (win) return EXIT_FAILURE ;

	hInstanceGlClock = hInstance ;

	// 実行ファイルパスを \Windows\System\glclock.ini ファイルに保存
	String glclockExePath, glclockIniPath ;
	glclockExePath = String(__argv[0]) ;

	char buf[MAX_PATH + 1] ;
	int len ;
	len = GetSystemDirectory(buf, MAX_PATH) ;
	if (len)
		glclockIniPath = String(buf) + '\\' + GLCLOCK_INI ;

	FILE *fpGlClockIni = fopen(glclockIniPath, "w") ;
	if (fpGlClockIni)
	{
//		fprintf(fpGlClockIni, "%s\n", (char *)glclockExePath) ;
		fprintf(fpGlClockIni, glclockExePath) ;
		fclose(fpGlClockIni) ;
	}


	int ret ;

#ifndef GLCLOCK_DLL_EXPORT

	// dll を使わない場合
	ret = glclock(__argc, __argv) ;

	if (ret)
		ret = FALSE ;
	else
		ret = TRUE ;

#else
	// glclock.dll に明示的にリンクする使用する場合

	// glclock.dll から glclock() をリンク
	// 関数アドレスをゲットできた場合 glclock コール

	HINSTANCE hLib_glclock = NULL ;
	hLib_glclock = LoadLibrary(_T(GLCLOCK_DLL)) ;
	if (hLib_glclock)
	{
		// DLL ロードに成功したら
		// glclock() の エントリポイントを取得
		PFNGLCLOCKARGPROC pglclock_arg ;
		pglclock_arg = (PFNGLCLOCKARGPROC)GetProcAddress(hLib_glclock, _T("[email protected]")) ;

		if (!pglclock_arg)
		{
			MessageBox(NULL, _T("Failed to get glclock_arg entry point"), _T("GetProcAddress Error"), MB_OK | MB_ICONSTOP) ;
			ret = EXIT_FAILURE ;
		}
		else
		{
#define glclock_arg (*pglclock_arg)
			ret = glclock_arg(__argc, __argv) ;
#undef glclock_arg
		}

		// DLL を開放
		if (hLib_glclock)
			FreeLibrary(hLib_glclock) ;

		if (ret)
			ret = FALSE ;
		else
			ret = TRUE ;
	}
	else
	{
		// DLL のロードに失敗
		MessageBox(NULL, _T("Failed to load glclock.dll"), _T("LoadLibrary Error"), MB_OK | MB_ICONSTOP) ;
		ret = FALSE ;
	}


#endif	// #ifndef GLCLOCK_DLL_EXPORT ... #else


	return ret ;
}
开发者ID:OS2World,项目名称:APP-CLOCK-glclock,代码行数:98,代码来源:main.cpp


示例15: OnUpdateUI

void EditPathDlg::OnUpdateUI(wxUpdateUIEvent& /*event*/)
{
    wxButton* btn = (wxButton*)FindWindow(wxID_OK);
    if (btn)
        btn->Enable(!XRCCTRL(*this, "txtPath", wxTextCtrl)->GetValue().IsEmpty());
}
开发者ID:stahta01,项目名称:EmBlocks,代码行数:6,代码来源:editpathdlg.cpp


示例16: main

int main(int argc, char **argv)
{
	HWND navitWindow;
	COPYDATASTRUCT cd;
	char opt;

	TCHAR *g_szClassName  = TEXT("TellNavitWND");
	WNDCLASS wc;
	HWND hwnd;
	HWND hWndParent=NULL;


	if(argc>0) {
		while((opt = getopt(argc, argv, ":hvc:d:e:s:")) != -1) {
			switch(opt){
			case 'h':
				print_usage();
				exit(0);
				break;
			case 'e':
				errormode=atoi(optarg);
				break;
			default:
				err("Unknown option %c\n", opt);
				exit(1);
				break;
			}
		}
	} else {
	print_usage();
	exit(1);
	}
	if(optind==argc) {
		err("Navit command to execute is needed.");
		exit(1);
	}


	memset(&wc, 0 , sizeof(WNDCLASS));
	wc.lpfnWndProc	= message_handler;
	wc.hInstance	= GetModuleHandle(NULL);
	wc.lpszClassName = g_szClassName;

	if (!RegisterClass(&wc))
	{
		err(TEXT("Window class registration failed\n"));
		return 1;
	} else {
		hwnd = CreateWindow(
				g_szClassName,
				TEXT("Tell Navit"),
				0,
				0,
				0,
				0,
				0,
				hWndParent,
				NULL,
				GetModuleHandle(NULL),
				NULL);
		if(!hwnd) {
			err(TEXT("Can't create hidden window\n"));
			UnregisterClass(g_szClassName,NULL);
			return 1;
		}
	}
    
	navitWindow=FindWindow( TEXT("NAVGRA"), NULL );
	if(!navitWindow) {
		err(TEXT("Navit window not found\n"));
		DestroyWindow(hwnd);
		UnregisterClass(g_szClassName,NULL);
		return 1;
	} else {
		int rv;
		char *command=g_strjoinv(" ",argv+optind);
		struct navit_binding_w32_msg *msg;
		int sz=sizeof(*msg)+strlen(command);

		cd.dwData=NAVIT_BINDING_W32_DWDATA;
		msg=g_malloc0(sz);
		msg->version=NAVIT_BINDING_W32_VERSION;
		g_strlcpy(msg->magic,NAVIT_BINDING_W32_MAGIC,sizeof(msg->magic));
		g_strlcpy(msg->text,command,sz-sizeof(*msg)+1);
		cd.cbData=sz;
		cd.lpData=msg;
		rv=SendMessage( navitWindow, WM_COPYDATA, (WPARAM)hwnd, (LPARAM) (LPVOID) &cd );
		g_free(command);
		g_free(msg);
		if(rv!=0) {
			err(TEXT("Error %d sending message, SendMessage return value is %d\n"), GetLastError(), rv);
			DestroyWindow(hwnd);
			UnregisterClass(g_szClassName,NULL);
			return 1;
		}
	}
	DestroyWindow(hwnd);
	UnregisterClass(g_szClassName,NULL);
	return 0;
}
开发者ID:Jalakas,项目名称:navit,代码行数:100,代码来源:tell_navit.c


示例17: TEXT

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FindWindowA函数代码示例发布时间:2022-05-30
下一篇:
C++ FindWidget函数代码示例发布时间: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