本文整理汇总了C++中IsDialogMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ IsDialogMessage函数的具体用法?C++ IsDialogMessage怎么用?C++ IsDialogMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsDialogMessage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: VTranslateDialogMessage
/** Global Function to translate dialog messages.*/
VBOOL VTranslateDialogMessage(MSG const& msg)
{
HWND hWndTop = msg.hwnd;
/* Obtain the top level window. All dialogs are typically defined
as top level popups.*/
while ( hWndTop )
{
if ( GetWindowLong(hWndTop, GWL_STYLE) & WS_CHILD )
hWndTop = GetParent(hWndTop);
else
break;
}
/* Obtain the associated window pointer (if a VWCL window).*/
VWindow* pWindow = VWindow::GetVWindowFromHandle(hWndTop);
if ( !pWindow )
return VFALSE;
VBOOL bResult = VFALSE;
/* Is it a dialog box?*/
if ( pWindow->IsVDialogType() )
{
bResult = IsDialogMessage(hWndTop, (MSG*)&msg);
/* Is it a modeless property sheet?*/
if ( !bResult &&
pWindow->GetRTTI() == VWindow::VWCL_RTTI_PROPERTY_SHEET &&
!((VDialog*)pWindow)->IsModal() )
bResult = PropSheet_IsDialogMessage(hWndTop, &msg);
}
/* Return result.*/
return bResult;
}
开发者ID:OCLC-Developer-Network,项目名称:MARCView-Convert,代码行数:38,代码来源:vwindow.cpp
示例2: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// создание главного окна
HWND hwnd;
MSG msg;
WNDCLASS w;
memset(&w, 0, sizeof(WNDCLASS));
w.style = CS_HREDRAW | CS_VREDRAW;
w.lpfnWndProc = WndProc;
w.hInstance = hInstance;
w.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
w.lpszClassName = L"Основное окно";
//регистрируем класс окна
RegisterClass(&w);
hwnd = CreateWindow(w.lpszClassName, w.lpszClassName, WS_OVERLAPPEDWINDOW, 10, 10, 290, 100, NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
// добавление кнопки на главное окно
CreateWindow(L"Button", L"Создать модальный диалог!", WS_CHILD | WS_VISIBLE, 10, 10, 250, 30, hwnd, (HMENU)ID_BUTTON, hInstance, NULL);
//запускаем цикл обработки сообщений
while (GetMessage(&msg, NULL, 0, 0))
{
if (hDlgModal == 0 || !IsDialogMessage(hDlgModal, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}
开发者ID:ShartepStudy,项目名称:STUDY,代码行数:36,代码来源:1234.cpp
示例3: WinMain
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdParam, int nCmdShow)
{
MSG msg;
bstr *str;
product = GetProduct();
str = bstr_new();
bstr_assign(str, "Are you sure you want to uninstall ");
bstr_append(str, product);
bstr_append(str, " ?");
if (MessageBox(NULL, str->text, "Uninstall", MB_YESNO) == IDNO)
return (1);
bstr_free(str, TRUE);
hInst = hInstance;
if (!hPrevInstance)
RegisterSepClass(hInstance);
mainDlg = CreateDialog(hInstance, MAKEINTRESOURCE(1), NULL, MainDlgProc);
SetGuiFont(mainDlg);
EnableWindow(GetDlgItem(mainDlg, BT_DELOK), FALSE);
ShowWindow(mainDlg, SW_SHOW);
ShowWindow(GetDlgItem(mainDlg, ST_DELDONE), SW_HIDE);
while (GetMessage(&msg, NULL, 0, 0)) {
if (!IsDialogMessage(mainDlg, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return 0;
}
开发者ID:dror-g,项目名称:nn-colletion,代码行数:36,代码来源:uninstall.c
示例4: while
bool GWMain::processMessage()
{
while (PeekMessage(¤tMsg, NULL, 0, 0, PM_REMOVE)) {
// Check for exit.
if (currentMsg.message == WM_QUIT) {
exitCode = currentMsg.wParam;
return false;
}
// Dialog boxes need to have their messages
// translated differently.
GWWindow* win = GWMap::getWindow(currentMsg.hwnd);
if (win && dynamic_cast<GWDialog*>(win))
if (IsDialogMessage(currentMsg.hwnd,¤tMsg))
return true;
if (hAccel && TranslateAccelerator(currentMsg.hwnd,hAccel,¤tMsg))
return true;
// Normal translate/dispatch
TranslateMessage(¤tMsg);
DispatchMessage(¤tMsg);
}
return true;
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:24,代码来源:gwMain.cpp
示例5: _tWinMain
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPTSTR lpCmdLine,
_In_ int nCmdShow)
{
HWND hDlg = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_DLG_MAIN), NULL , DlgProc, reinterpret_cast<LPARAM>(hInstance));
ShowWindow(hDlg, SW_SHOW);
// Main message loop:
BOOL ret;
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
if(!IsDialogMessage(hDlg, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
开发者ID:Kerogi,项目名称:swas,代码行数:24,代码来源:swas.cpp
示例6: GetMsgProc
static LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam)
{
LPMSG lpMsg = (LPMSG) lParam;
if ( (nCode >= 0) && (wParam == PM_REMOVE) )
{
// Don't translate non-input events.
if ( (lpMsg->message >= WM_KEYFIRST) && (lpMsg->message <= WM_KEYLAST) )
{
if ( IsDialogMessage(s_hDlg, lpMsg) )
{
// The value returned from this hookproc is ignored,
// and it cannot be used to tell Windows the message has been handled.
// To avoid further processing, convert the message to WM_NULL
// before returning.
lpMsg->message = WM_NULL;
lpMsg->lParam = 0;
lpMsg->wParam = 0;
}
}
}
return CallNextHookEx(s_hMsgHook, nCode, wParam, lParam);
}
开发者ID:tbourg,项目名称:perso,代码行数:24,代码来源:DlgConsoleOutputFilter.cpp
示例7: CallNextHookEx
/*
================
rvGETransformer::GetMsgProc
Ensures normal dialog functions work in the transformer dialog
================
*/
LRESULT FAR PASCAL rvGETransformer::GetMsgProc ( int nCode, WPARAM wParam, LPARAM lParam )
{
LPMSG lpMsg = (LPMSG) lParam;
if ( nCode >= 0 && PM_REMOVE == wParam )
{
// Don't translate non-input events.
if ( lpMsg->message != WM_SYSCHAR && (lpMsg->message >= WM_KEYFIRST && lpMsg->message <= WM_KEYLAST) )
{
if ( IsDialogMessage( gTransDlg, lpMsg) )
{
// The value returned from this hookproc is ignored,
// and it cannot be used to tell Windows the message has been handled.
// To avoid further processing, convert the message to WM_NULL
// before returning.
lpMsg->message = WM_NULL;
lpMsg->lParam = 0;
lpMsg->wParam = 0;
}
}
}
return CallNextHookEx(gTransHook, nCode, wParam, lParam);
}
开发者ID:Salamek,项目名称:Shadow-of-Dust,代码行数:31,代码来源:GETransformer.cpp
示例8: IsDialogMessage
BOOL CSelectUserDlg::PreTranslateMessage(MSG* pMsg)
{
return IsDialogMessage(pMsg);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:4,代码来源:SelectUserDlg.cpp
示例9: ShowUpdateDialogThreadStart
static NTSTATUS ShowUpdateDialogThreadStart(
__in PVOID Parameter
)
{
BOOL result;
MSG message;
PH_AUTO_POOL autoPool;
PhInitializeAutoPool(&autoPool);
UpdateDialogHandle = CreateDialog(
(HINSTANCE)PluginInstance->DllBase,
MAKEINTRESOURCE(IDD_UPDATE),
PhMainWndHandle,
UpdaterWndProc
);
PhSetEvent(&InitializedEvent);
while (result = GetMessage(&message, NULL, 0, 0))
{
if (result == -1)
break;
if (!IsDialogMessage(UpdateDialogHandle, &message))
{
TranslateMessage(&message);
DispatchMessage(&message);
}
PhDrainAutoPool(&autoPool);
}
PhDeleteAutoPool(&autoPool);
PhResetEvent(&InitializedEvent);
// Ensure global objects are disposed and reset when window closes.
if (SetupFilePath)
{
PhDereferenceObject(SetupFilePath);
SetupFilePath = NULL;
}
if (UpdateCheckThreadHandle)
{
NtClose(UpdateCheckThreadHandle);
UpdateCheckThreadHandle = NULL;
}
if (DownloadThreadHandle)
{
NtClose(DownloadThreadHandle);
DownloadThreadHandle = NULL;
}
if (UpdaterDialogThreadHandle)
{
NtClose(UpdaterDialogThreadHandle);
UpdaterDialogThreadHandle = NULL;
}
if (FontHandle)
{
DeleteObject(FontHandle);
FontHandle = NULL;
}
FreeXmlData();
if (UpdateDialogHandle)
{
DestroyWindow(UpdateDialogHandle);
UpdateDialogHandle = NULL;
}
return STATUS_SUCCESS;
}
开发者ID:john-peterson,项目名称:processhacker,代码行数:78,代码来源:updater.c
示例10: PreTranslateMessage
BOOL PreTranslateMessage(MSG* pMsg)
{
return IsDialogMessage(pMsg);
}
开发者ID:GordonSmith,项目名称:eclide,代码行数:4,代码来源:CommentDlg.cpp
示例11: IsDialogMessage
BOOL CRepositoryFilterView::PreTranslateMessage(MSG* pMsg)
{
BOOL retVal = IsDialogMessage(pMsg);
return retVal;
}
开发者ID:dehilsterlexis,项目名称:eclide-1,代码行数:5,代码来源:RepositoryFilterView.cpp
示例12: WinMain
//.........这里部分代码省略.........
memcpy(clock64, api.root, api.root_len+1);
add_title(clock64,"Clock" ARCH_SUFFIX_64 ".exe");
api.Exec(clock64,lpCmdLine,NULL);
}
return 0;
}
#endif // _WIN64
// Do Not Allow the Program to Execute Twice!
updated = 25; /**< wait up to 5 sec in 1/5th seconds for other instance */
do{
HANDLE processlock=CreateMutex(NULL,FALSE,g_szClassName); // we leak handle here, but Windows closes on process exit anyway (so why do it manually?)
if(processlock && GetLastError()==ERROR_ALREADY_EXISTS){
CloseHandle(processlock);
hwndMain = FindWindow(g_szClassName, NULL);
if(hwndMain) { // This One Sends Commands to the Instance
ProcessCommandLine(hwndMain,lpCmdLine); // That is Currently Running.
return 0;
}
Sleep(200);
continue;
}
break;
}while(updated--);
// Update settings if required and setup defaults
if((updated=CheckSettings())<0){
return 1;
}
CancelAllTimersOnStartUp();
// Message of the taskbar recreating - Special thanks to Mr.Inuya
g_WM_TaskbarCreated = RegisterWindowMessage("TaskbarCreated");
// register a window class
wndclass.style = 0;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = g_instance;
wndclass.hIcon = g_hIconTClock;
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(intptr_t)(COLOR_WINDOW+1);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = g_szClassName;
g_atomTClock = RegisterClass(&wndclass);
if(api.OS >= TOS_VISTA) { // allow non elevated processes to send control messages (eg, App with admin rights, explorer without)
#define MSGFLT_ADD 1
#define MSGFLT_REMOVE 2
typedef BOOL (WINAPI* ChangeWindowMessageFilter_t)(UINT message,DWORD dwFlag);
ChangeWindowMessageFilter_t ChangeWindowMessageFilter=(ChangeWindowMessageFilter_t)GetProcAddress(GetModuleHandle("user32"), "ChangeWindowMessageFilter");
if(ChangeWindowMessageFilter){
int msgid;
ChangeWindowMessageFilter(g_WM_TaskbarCreated,MSGFLT_ADD);
ChangeWindowMessageFilter(WM_COMMAND,MSGFLT_ADD);
for(msgid=WM_MOUSEFIRST; msgid<=WM_MOUSELAST; ++msgid)
ChangeWindowMessageFilter(msgid,MSGFLT_ADD);
for(msgid=MAINMFIRST; msgid<=MAINMLAST; ++msgid)
ChangeWindowMessageFilter(msgid,MSGFLT_ADD);
}
}
// create a hidden window
g_hwndTClockMain = hwndMain = CreateWindowEx(WS_EX_NOACTIVATE, MAKEINTATOM(g_atomTClock),NULL, 0, 0,0,0,0, NULL,NULL,g_instance,NULL);
// This Checks for First Instance Startup Options
ProcessCommandLine(hwndMain,lpCmdLine);
GetHotKeyInfo(hwndMain);
if(api.OS > TOS_2000) {
if(api.GetInt("Desktop", "MonOffOnLock", 0))
RegisterSession(hwndMain);
}
if(updated==1){
PostMessage(hwndMain,WM_COMMAND,IDM_SHOWPROP,0);
}
while(GetMessage(&msg, NULL, 0, 0)) {
if(!(g_hwndSheet && IsWindow(g_hwndSheet) && PropSheet_IsDialogMessage(g_hwndSheet,&msg))
&& !(g_hDlgTimer && IsWindow(g_hDlgTimer) && IsDialogMessage(g_hDlgTimer,&msg))
&& !(g_hDlgTimerWatch && IsWindow(g_hDlgTimerWatch) && IsDialogMessage(g_hDlgTimerWatch,&msg))
&& !(g_hDlgStopWatch && IsWindow(g_hDlgStopWatch) && IsDialogStopWatchMessage(g_hDlgStopWatch,&msg))){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
UnregisterHotKey(hwndMain, HOT_TIMER);
UnregisterHotKey(hwndMain, HOT_WATCH);
UnregisterHotKey(hwndMain, HOT_STOPW);
UnregisterHotKey(hwndMain, HOT_PROPR);
UnregisterHotKey(hwndMain, HOT_CALEN);
UnregisterHotKey(hwndMain, HOT_TSYNC);
UnregisterSession(hwndMain);
EndNewAPI(NULL);
return (int)msg.wParam;
}
开发者ID:andrejtm,项目名称:T-Clock,代码行数:101,代码来源:main.c
示例13: LoadAccelerators
WPARAM CFidgetApp::Run(void)
{
HACCEL hAccelTable = LoadAccelerators(m_hInstance, (LPCTSTR)IDC_FIDGET);
// Main message loop:
//
WPARAM iReturn = 0;
bool bFinished = false;
while (!bFinished)
{
CLinearTimeAbsolute ltaCurrent;
ltaCurrent.GetUTC();
// Execute background tasks at specifically scheduled times.
//
scheduler.RunTasks(ltaCurrent);
CLinearTimeAbsolute ltaWakeUp;
if (!scheduler.WhenNext(<aWakeUp))
{
ltaWakeUp = ltaCurrent + time_30m;
}
else if (ltaWakeUp < ltaCurrent)
{
// This is necessary to deal with computer time jumping backwards
// which can happen when someone sets or resets the computer clock.
//
ltaWakeUp = ltaCurrent;
}
CLinearTimeDelta ltdTimeOut = ltaWakeUp - ltaCurrent;
DWORD dwTimeout = ltdTimeOut.ReturnMilliseconds();
DWORD nHandles = 0;
DWORD dwObject = MsgWaitForMultipleObjectsEx(nHandles, NULL, dwTimeout, QS_ALLINPUT, 0);
if (WAIT_OBJECT_0 + nHandles == dwObject)
{
for (; !bFinished;)
{
// There is at least one new message waiting to be processed.
//
MSG msg;
BOOL bGM = GetMessage(&msg, NULL, 0, 0);
if (0 == bGM)
{
// WM_QUIT message was received. It is time to terminate
// ourselves.
//
iReturn = msg.wParam;
bFinished = true;
}
else if (-1 == bGM)
{
// An unexpected problem occured.
//
bFinished = true;
}
else
{
// Translate and dispatch message to Windows Procedure.
//
if ( ( NULL == m_hwndNewSession
|| !IsDialogMessage(m_hwndNewSession, &msg))
&& ( NULL == m_hwndAbout
|| !IsDialogMessage(m_hwndAbout, &msg))
&& !TranslateMDISysAccel(g_theApp.m_pMainFrame->m_pMDIControl->m_hwnd, &msg)
&& !TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
// We must process all messages in the queue before making
// another MsgWaitForMultipleObjectsEx() call.
//
if (!PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE|PM_NOYIELD))
{
break;
}
}
}
else if (WAIT_TIMEOUT != dwObject)
{
// An unexpected event occured.
//
bFinished = true;
}
// It's time to perform some background task.
//
}
DestroyAcceleratorTable(hAccelTable);
return iReturn;
}
开发者ID:sanjayui,项目名称:tinymux,代码行数:94,代码来源:fidget.cpp
示例14: PhMainMessageLoop
LONG PhMainMessageLoop(
VOID
)
{
BOOL result;
MSG message;
HACCEL acceleratorTable;
acceleratorTable = LoadAccelerators(PhInstanceHandle, MAKEINTRESOURCE(IDR_MAINWND_ACCEL));
while (result = GetMessage(&message, NULL, 0, 0))
{
BOOLEAN processed = FALSE;
ULONG i;
if (result == -1)
return 1;
if (FilterList)
{
for (i = 0; i < FilterList->Count; i++)
{
PPH_MESSAGE_LOOP_FILTER_ENTRY entry = FilterList->Items[i];
if (entry->Filter(&message, entry->Context))
{
processed = TRUE;
break;
}
}
}
if (!processed)
{
if (
message.hwnd == PhMainWndHandle ||
IsChild(PhMainWndHandle, message.hwnd)
)
{
if (TranslateAccelerator(PhMainWndHandle, acceleratorTable, &message))
processed = TRUE;
}
if (DialogList)
{
for (i = 0; i < DialogList->Count; i++)
{
if (IsDialogMessage((HWND)DialogList->Items[i], &message))
{
processed = TRUE;
break;
}
}
}
}
if (!processed)
{
TranslateMessage(&message);
DispatchMessage(&message);
}
PhDrainAutoPool(&BaseAutoPool);
}
return (LONG)message.wParam;
}
开发者ID:ventsislav-georgiev,项目名称:processhacker2,代码行数:67,代码来源:main.c
示例15: startwin_idle
int32_t startwin_idle(void *v)
{
if (!startupdlg || !IsWindow(startupdlg)) return 0;
if (IsDialogMessage(startupdlg, (MSG*)v)) return 1;
return 0;
}
开发者ID:Daedolon,项目名称:erampage,代码行数:6,代码来源:startwin.editor.c
示例16: _tWinMain
int WINAPI _tWinMain(HINSTANCE hinstExe, HINSTANCE, PTSTR pszCmdLine, int) {
// Counter fiber execution context
PVOID pFiberCounter = NULL;
// Convert this thread to a fiber.
/* Converts the current thread into a fiber.
* You must convert a thread into a fiber
* before you can schedule other fibers. */
g_FiberInfo.pFiberUI = ConvertThreadToFiber(NULL);
/* Allocates a fiber local storage (FLS) index.
* Any fiber in the process can subsequently use this index
* to store and retrieve values that are local to the fiber. */
g_dwSlot = FlsAlloc(LogMessage);
FlsSetValue(g_dwSlot, TEXT("UI fiber"));
// Create the application's UI window.
g_FiberInfo.hwnd = CreateDialog(hinstExe, MAKEINTRESOURCE(IDD_COUNTER),
NULL, Dlg_Proc);
// Update the window showing which fiber is executing.
SetDlgItemText(g_FiberInfo.hwnd, IDC_FIBER, TEXT("User interface"));
// Initially, there is no background processing to be done.
g_FiberInfo.bps = BPS_DONE;
// While the UI window still exists...
BOOL fQuit = FALSE;
while (!fQuit) {
// UI messages are higher priority than background processing.
MSG msg;
/* Dispatches incoming sent messages, checks
* the thread message queue for a posted message,
* and retrieves the message (if any exist).
* PM_REMOVE 0x0001
* Messages are removed from the queue after processing by PeekMessage.
*/
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
// If a message exists in the queue, process it.
/* Determines whether a message is intended
* for the specified dialog box and,
* if it is, processes the message.
* hDlg [in] Type: HWND A handle to the dialog box.
* lpMsg [in] Type: LPMSG A pointer to an MSG structure
* that contains the message to be checked.
*/
if (!IsDialogMessage(g_FiberInfo.hwnd, &msg))
{
/* Translates virtual-key messages into character messages.
* The character messages are posted to the calling thread's message queue,
* to be read the next time the thread calls the GetMessage or PeekMessage function */
TranslateMessage(&msg);
/* Dispatches a message to a window procedure.
* It is typically used to dispatch a message retrieved by the GetMessage function. */
DispatchMessage(&msg);
}
fQuit = (msg.message == WM_QUIT);
if (fQuit)
{
// Release FLS slot
FlsFree(g_dwSlot);
// The background processing must be stopped.
if (pFiberCounter != NULL) {
// A recalculation fiber exists; delete it
DeleteFiber(pFiberCounter);
pFiberCounter = NULL;
}
// Quit the fiber mode and return to simple thread mode
ConvertFiberToThread();
g_FiberInfo.pFiberUI = NULL;
}
} else {
// No UI msgs exist; check the state of the background processing.
switch (g_FiberInfo.bps) {
case BPS_DONE:
// No background processing to do; wait for a UI event.
/* Yields control to other threads when a thread has no other messages
* in its message queue.
* The WaitMessage function suspends the thread
* and does not return until a new message
* is placed in the thread's message queue. */
WaitMessage();
break;
case BPS_STARTOVER:
// User changed the count;
// cancel the current background processing.
if (pFiberCounter != NULL) {
// A recalculation fiber exists; delete it so that
//.........这里部分代码省略.........
开发者ID:melvinvarkey,项目名称:ANCI_C_Training,代码行数:101,代码来源:Counter.cpp
示例17: WinMain
//.........这里部分代码省略.........
if(*pszCmdline == '\"')
{
GetArg(pszCmdline, arg, MAX_PATH);
pszCmdline = arg;
}
if(!TouchFile(pszCmdline))
{
HexWinErrorBox(GetLastError(), 0);
return 1;
}
return 0;
}
else
{
pszCmdline = GetArg(pszCmdline, arg, MAX_PATH);
}
}
{
INITCOMMONCONTROLSEX icex = { sizeof(icex), -1 };
InitCommonControlsEx(&icex);
}
/*g_Config = OpenConfig(TEXT("mapsize.exe.129082349834.bookmarks"));
smeg(g_Config, TEXT("bookmarks.bookmark."), TEXT("mapsize.exe"));
SaveConfig(TEXT("oof.config"), g_Config);*/
LoadSettings();
RegisterTabView();
InitMainWnd();
CreateMainWnd();
// open file specified on commmand line?
if(pszCmdline && *pszCmdline)
{
// check to see if it's a quoted filename
if(*pszCmdline == '\"')
{
GetArg(pszCmdline, arg, MAX_PATH);
pszCmdline = arg;
}
if(!HexeditOpenFile(g_hwndMain, pszCmdline, DefaultFileMode()))//HVOF_DEFAULT))
{
SendMessage(g_hwndMain, WM_COMMAND, IDM_FILE_NEW, 0);
}
}
// automatically create new document if none specified
else
{
SendMessage(g_hwndMain, WM_COMMAND, IDM_FILE_NEW, 0);
}
InitDockingBars(g_hwndMain);
if(g_fRestoreWinPos)
nShowCmd = SW_SHOW;
ShowWindow(g_hwndMain, nShowCmd);
// force any floating popups (i.e. the DOCKWNDs) to
// become visible at the same time
//ShowOwnedPopups(g_hwndMain, TRUE);
DockWnd_ShowDeferredPopups(g_hwndMain);
//
// load keyboard accelerator table
//
hAccel = LoadAccelerators(GetModuleHandle(0)/*g_hResourceModule*/, MAKEINTRESOURCE(IDR_ACCELERATOR1));
//
// message-pump
//
while(GetMessage(&msg, 0, 0, 0) > 0)
{
if(!TranslateAccelerator(g_hwndMain, hAccel, &msg))
{
if( !IsDialogMessage(g_hwndSearch, &msg) &&
!IsDialogMessage(g_hwndGoto, &msg) &&
!DockWnd_IsDialogMessage(g_hwndMain, DWID_TYPEVIEW, &msg) &&
!DockWnd_IsDialogMessage(g_hwndMain, DWID_SEARCHBAR, &msg) &&
!DockWnd_IsDialogMessage(g_hwndMain, DWID_HIGHLIGHT, &msg)
)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
SaveSettings();
// Shutdown COM
OleUninitialize();
return 0;
}
开发者ID:rajeshpillai,项目名称:HexEdit,代码行数:101,代码来源:HexEdit.c
示例18: WinMain
//.........这里部分代码省略.........
MSG msg ;
WNDCLASSEX wndclass ;
HWND hDummyWnd;
int NTVersion;
int len = 256;
HANDLE hToken;
SYSTEM_CACHE_INFORMATION newCacheSize;
ULONG minSize, maxSize;
// save instance
hInst = hInstance;
// init common controls
InitCommonControls();
// get NT version
NTVersion = GetVersion();
if( NTVersion >= 0x80000000 ) {
Abort( NULL, TEXT("Not running on Windows NT"));
return TRUE;
}
// Enable increase quota privilege
if(!OpenProcessToken( GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
&hToken )) {
printf("You do not have the necessary privilege to run this program\n");
return -1;
}
// Enable SeDebugPrivilege
if(!SetPrivilege(hToken, SE_INCREASE_QUOTA_NAME, TRUE))
{
Abort(NULL, TEXT("You must have the INCREASE_QUOTA privilege to run CacheSet"));
CloseHandle(hToken);
return -1;
}
CloseHandle( hToken );
// locate the calls we need in NTDLL
LocateNTDLLCalls();
// If there are command line arguments, set the cache size
if( lpCmdLine && (sscanf( lpCmdLine," %d %d", &minSize, &maxSize ) == 2) ) {
// set the cache size
newCacheSize.MinimumWorkingSet = minSize * 1024;
newCacheSize.MaximumWorkingSet = maxSize * 1024;
NtSetSystemInformation( SYSTEMCACHEINFORMATION,
&newCacheSize, sizeof(newCacheSize) );
return 0;
}
// create a dummy class and window that will hide the task tray icon for us
wndclass.cbSize = sizeof( WNDCLASSEX );
wndclass.style = 0 ;
wndclass.lpfnWndProc = (WNDPROC) DummyProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (hInstance, "APPICON") ;
wndclass.hIconSm = LoadIcon (hInstance, "APPICON");
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1);
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = "Dummy" ;
RegisterClassEx (&wndclass) ;
hDummyWnd = CreateWindowEx( WS_EX_TOOLWINDOW, "Dummy", "",
0, -1, -1, 0, 0, 0, 0, hInstance, 0 );
// create the main window class
wndclass.cbSize = sizeof( WNDCLASSEX );
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = (WNDPROC) MainDialog ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = DLGWINDOWEXTRA ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (hInstance, "APPICON") ;
wndclass.hIconSm = LoadIcon (hInstance, "APPICON");
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1);
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
RegisterClassEx (&wndclass) ;
// create the dialog
hMainDlg = CreateDialog( hInstance, "CACHESET", hDummyWnd, (DLGPROC)MainDialog) ;
ShowWindow( hMainDlg, nCmdShow) ;
while (GetMessage (&msg, NULL, 0, 0)) {
if( !IsDialogMessage( hMainDlg, &msg )) {
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
}
return msg.wParam ;
}
开发者ID:caidongyun,项目名称:libs,代码行数:101,代码来源:CACHESET.C
示例19: ProcessCommandLine
//========================================================================================
// /exit exit T-Clock 2010
// /prop show T-Clock 2010 properties
// /SyncOpt SNTP options
// /Sync synchronize the system clock with an NTP server
// /start start the Stopwatch (open as needed)
// /stop stop (pause really) the Stopwatch
// /reset reset Stopwatch to 0 (stop as needed)
// /lap record a (the current) lap time
//================================================================================================
//---------------------------------------------//---------------+++--> T-Clock Command Line Option:
void ProcessCommandLine(HWND hwndMain,const char* cmdline) //-----------------------------+++-->
{
int justElevated = 0;
const char* p = cmdline;
if(g_hwndTClockMain != hwndMain){
g_hwndTClockMain = CreateWindow("STATIC",NULL,0,0,0,0,0,HWND_MESSAGE_nowarn,0,0,0);
SubclassWindow(g_hwndTClockMain, MsgOnlyProc);
}
while(*p != '\0') {
if(*p == '/') {
++p;
if(strncasecmp(p, "prop", 4) == 0) {
SendMessage(hwndMain, WM_COMMAND, IDM_SHOWPROP, 0);
p += 4;
} else if(strncasecmp(p, "exit", 4) == 0) {
SendMessage(hwndMain, MAINM_EXIT, 0, 0);
p += 4;
} else if(strncasecmp(p, "start", 5) == 0) {
SendMessage(hwndMain, WM_COMMAND, IDM_STOPWATCH_START, 0);
p += 5;
} else if(strncasecmp(p, "stop", 4) == 0) {
SendMessage(hwndMain, WM_COMMAND, IDM_STOPWATCH_STOP, 0);
p += 4;
} else if(strncasecmp(p, "reset", 5) == 0) {
SendMessage(hwndMain, WM_COMMAND, IDM_STOPWATCH_RESET, 0);
p += 5;
} else if(strncasecmp(p, "pause", 5) == 0) {
SendMessage(hwndMain, WM_COMMAND, IDM_STOPWATCH_PAUSE, 0);
p += 5;
} else if(strncasecmp(p, "resume", 6) == 0) {
SendMessage(hwndMain, WM_COMMAND, IDM_STOPWATCH_RESUME, 0);
p += 6;
} else if(strncasecmp(p, "lap", 3) == 0) {
SendMessage(hwndMain, WM_COMMAND, IDM_STOPWATCH_LAP, 0);
p += 3;
} else if(strncasecmp(p, "SyncOpt", 7) == 0) {
if(HaveSetTimePermissions()){
if(!SendMessage(hwndMain, WM_COMMAND, MAKEWPARAM(IDM_SNTP,1), 0)){
NetTimeConfigDialog(justElevated);
}
}else{
SendMessage(hwndMain, WM_COMMAND, IDM_SNTP, 0);
}
p += 7;
} else if(strncasecmp(p, "Sync", 4) == 0) {
p += 4;
SendMessage(hwndMain, WM_COMMAND, MAKEWPARAM(IDM_SNTP_SYNC,justElevated), 0);
if(g_hwndTClockMain == hwndMain)
SendMessage(hwndMain, MAINM_EXIT, 0, 0);
} else if(strncmp(p, "Wc", 2) == 0) { // Win10 calendar "restore"
if(p[2] == '1') // restore to previous
api.SetSystemInt(HKEY_LOCAL_MACHINE, kSectionImmersiveShell, kKeyWin32Tray, 1);
else // use the slow (new) one
api.DelSystemValue(HKEY_LOCAL_MACHINE, kSectionImmersiveShell, kKeyWin32Tray);
p += 2;
} else if(strncmp(p, "UAC", 3) == 0) {
justElevated = 1;
p += 3;
}
continue;
}
++p;
}
if(g_hwndTClockMain != hwndMain){
const DWORD kTimeout = 10000;
const DWORD kStartTicks = GetTickCount();
DWORD timeout;
MSG msg;
msg.message = 0;
for(;;){
int have_ui = IsWindow(g_hwndSheet) || IsWindow(g_hDlgTimer) || IsWindow(g_hDlgTimerWatch) || IsWindow(g_hDlgSNTP) || IsWindow(g_hDlgStopWatch);
if(have_ui)
timeout = INFINITE;
else if(IsPlaying())
timeout = 200;
else
break;
MsgWaitForMultipleObjectsEx(0, NULL, timeout, QS_ALLEVENTS, MWMO_INPUTAVAILABLE);
while(PeekMessage(&msg,NULL,0,0,PM_REMOVE)){
if(msg.message == WM_QUIT)
break;
if(!(g_hwndSheet && IsWindow(g_hwndSheet) && PropSheet_IsDialogMessage(g_hwndSheet,&msg))
&& !(g_hDlgTimer && IsWindow(g_hDlgTimer) && IsDialogMessage(g_hDlgTimer,&msg))
&& !(g_hDlgTimerWatch && IsWindow(g_hDlgTimerWatch) && IsDialogMessage(g_hDlgTimerWatch,&msg))
&& !(g_hDlgSNTP && IsWindow(g_hDlgSNTP) && IsDialogMessage(g_hDlgSNTP,&msg))
&& !(g_hDlgStopWatch && IsWindow(g_hDlgStopWatch) && IsDialogStopWatchMessage(g_hDlgStopWatch,&msg))){
TranslateMessage(&msg);
//.........这里部分代码省略.........
开发者ID:dubepaul,项目名称:T-Clock,代码行数:101,代码来源:main.c
示例20: mswin_display_splash_window
//.........这里部分代码省略.........
/* Fill the text control */
Sprintf(buf, "%s\r\n%s\r\n%s\r\n%s\r\n\r\n", COPYRIGHT_BANNER_A,
COPYRIGHT_BANNER_B, COPYRIGHT_BANNER_C, COPYRIGHT_BANNER_D);
strsize = strlen(buf);
if (show_ver) {
/* Show complete version information */
dlb *f;
char verbuf[BUFSZ];
int verstrsize = 0;
getversionstring(verbuf);
verstrsize = strlen(verbuf);
if (verstrsize + strlen("\r\n\r\n") + 1 < BUFSZ - 1)
strcat(verbuf, "\r\n\r\n");
verstrsize = strlen(verbuf);
if (strsize + verstrsize + 1 > bufsize) {
bufsize += BUFSZ;
buf = realloc(buf, bufsize);
if (buf == NULL)
panic("out of memory");
}
strcat(buf, verbuf);
strsize = strlen(buf);
/* Add compile options */
f = dlb_fopen(OPTIONS_USED, RDTMODE);
if (f) {
char line[LLEN + 1];
while (dlb_fgets(line, LLEN, f)) {
size_t len;
len = strlen(line);
if (len > 0 && line[len - 1] == '\n') {
line[len - 1] = '\r';
line[len] = '\n';
line[len + 1] = '\0';
len++;
}
if (strsize + (int) len + 1 > bufsize) {
bufsize += BUFSZ;
buf = realloc(buf, bufsize);
if (buf == NULL)
panic("out of memory");
}
strcat(buf, line);
strsize += len;
}
(void) dlb_fclose(f);
}
} else {
/* Show news, if any */
if (iflags.news) {
FILE *nf;
iflags.news = 0; /* prevent newgame() from re-displaying news */
nf = fopen(NEWS, "r");
if (nf != NULL) {
char line[LLEN + 1];
while (fgets(line, LLEN, nf)) {
size_t len;
len = strlen(line);
if (len > 0 && line[len - 1] == '\n') {
line[len - 1] = '\r';
line[len] = '\n';
line[len + 1] = '\0';
len++;
}
if (strsize + (int) len + 1 > bufsize) {
bufsize += BUFSZ;
buf = realloc(buf, bufsize);
if (buf == NULL)
panic("out of memory");
}
strcat(buf, line);
strsize += len;
}
(void) fclose(nf);
} else {
strcat(buf, "No news.");
}
}
}
SetWindowText(GetDlgItem(hWnd, IDC_EXTRAINFO), buf);
free(buf);
ShowWindow(hWnd, SW_SHOW);
while (IsWindow(hWnd) && GetMessage(&msg, NULL, 0, 0) != 0) {
if (!IsDialogMessage(hWnd, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
GetNHApp()->hPopupWnd = NULL;
mswin_destroy_splashfonts();
}
开发者ID:MaddTheSane,项目名称:nh3d_OSX-j,代码行数:101,代码来源:mhsplash.c
注:本文中的IsDialogMessage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论