掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
HMONITOR、MONITORINFOのビルドエラーを解消するには (ID:66116)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
すみません、先の質問で解決していないのに解決のチェックをしてしまいました。 改めて記載しますので、宜しくお願いします。 やりたいことは、マルチモニタへの対応ですが、以下のエラーが発生します。 ●WindowsXP VC++6 MFC ダイアログベース ●エラー内容 コンパイル中... StdAfx.cpp コンパイル中... ClientSocket.cpp DIDS.cpp DIDSDlg.cpp D:\〜\DIDSDlg.cpp(1530) : error C2065: 'HMONITOR' : 定義されていない識別子です。 D:\〜\DIDSDlg.cpp(1530) : error C2146: 構文エラー : ';' が、識別子 'MonitorHandle' の前に必要です。 D:\〜\DIDSDlg.cpp(1530) : error C2065: 'MonitorHandle' : 定義されていない識別子です。 D:\〜\DIDSDlg.cpp(1531) : error C2065: 'MONITORINFO' : 定義されていない識別子です。 D:\〜\DIDSDlg.cpp(1531) : error C2146: 構文エラー : ';' が、識別子 'MonitorInfo' の前に必要です。 D:\〜\DIDSDlg.cpp(1531) : error C2065: 'MonitorInfo' : 定義されていない識別子です。 D:\〜\DIDSDlg.cpp(1586) : error C2039: 'MonitorFromPoint' : '`global namespace'' のメンバではありません。 D:\〜\DIDSDlg.cpp(1586) : error C2065: 'MonitorFromPoint' : 定義されていない識別子です。 D:\〜\DIDSDlg.cpp(1586) : error C2065: 'MONITOR_DEFAULTTOPRIMARY' : 定義されていない識別子です。 D:\〜\DIDSDlg.cpp(1587) : error C2228: '.cbSize' : 左側がクラス、構造体、共用体ではありません。 D:\〜\DIDSDlg.cpp(1588) : error C2039: 'GetMonitorInfo' : '`global namespace'' のメンバではありません。 D:\〜\DIDSDlg.cpp(1588) : error C2065: 'GetMonitorInfo' : 定義されていない識別子です。 D:\〜\DIDSDlg.cpp(1594) : error C2228: '.rcWork' : 左側がクラス、構造体、共用体ではありません。 D:\〜\DIDSDlg.cpp(1594) : error C2228: '.left' : 左側がクラス、構造体、共用体ではありません。 D:\〜\DIDSDlg.cpp(1594) : error C2228: '.rcWork' : 左側がクラス、構造体、共用体ではありません。 D:\〜\DIDSDlg.cpp(1594) : error C2228: '.top' : 左側がクラス、構造体、共用体ではありません。 D:\〜\DIDSDlg.cpp(1594) : error C2228: '.rcWork' : 左側がクラス、構造体、共用体ではありません。 D:\〜\DIDSDlg.cpp(1594) : error C2228: '.right' : 左側がクラス、構造体、共用体ではありません。 D:\〜\DIDSDlg.cpp(1594) : error C2228: '.rcWork' : 左側がクラス、構造体、共用体ではありません。 D:\〜\DIDSDlg.cpp(1594) : error C2228: '.left' : 左側がクラス、構造体、共用体ではありません。 D:\〜\DIDSDlg.cpp(1594) : error C2228: '.rcWork' : 左側がクラス、構造体、共用体ではありません。 D:\〜\DIDSDlg.cpp(1594) : error C2228: '.bottom' : 左側がクラス、構造体、共用体ではありません。 Setting.cpp コードを生成中... cl.exe の実行エラー ●StdAfx.cpp // stdafx.cpp : 標準インクルードファイルを含むソース ファイル // DIDS.pch : 生成されるプリコンパイル済ヘッダー // stdafx.obj : 生成されるプリコンパイル済タイプ情報 #include "stdafx.h" // add start #ifndef STDAFX_CPP #define STDAFX_CPP #define COMPILE_MULTIMON_STUBS #include <windows.h> #include <multimon.h> #endif // add end ●DIDSDlg.cpp BOOL CDIDSDlg::OnInitDialog() { // add start blRet = SetDidsDlg(); // add end } BOOL CDIDSDlg::SetDidsDlg() { CRect crectDialog; RECT rectDesktop; HMONITOR MonitorHandle; MONITORINFO MonitorInfo; // ダイアログサイズ GetWindowRect(&crectDialog); // 画面(プライマリ)サイズ:画面下タスクバーを除いたサイズ SystemParametersInfo(SPI_GETWORKAREA, 0, &rectDesktop, 0); // 画面(セカンダリ)サイズ POINT Point = {(long)rectDesktop.right, (long)rectDesktop.top}; MonitorHandle = ::MonitorFromPoint(Point, MONITOR_DEFAULTTOPRIMARY); MonitorInfo.cbSize = sizeof(MonitorInfo); ::GetMonitorInfo(MonitorHandle, &MonitorInfo); // ダイアログの表示位置 SetWindowPos(&wndTop, MonitorInfo.rcWork.left,MonitorInfo.rcWork.top, MonitorInfo.rcWork.right -MonitorInfo.rcWork.left,MonitorInfo.rcWork.bottom, SWP_SHOWWINDOW); return(TRUE); }
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.