|
johny10151981 wrote: WM_CLOSE. And It does its job.
As I said.
johny10151981 wrote: If you want to check how many thread is used by your program ...
Agreed, but it's not me who wants to know.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
My Bad It was not for you, It was for The OP.
|
|
|
|
|
I just came to that conclusion, that I did not handle my WndProc Correctly. So I started to remodel it with a better understanding. I must admit that I should check for open threads still running during one of the events.
I do need some help in organization and clarity here.
WM_CLOSE
Gives me a chance to do something before WM_DESTROY is called
WM_DESTROY
That's it, shutting down, I must do something, or it just shuts down
WM_QUIT
I'm suppose to PostQuitMessage(0), 0 means close, 1 means abort?
case IDM_FILE_EXIT:
PostMessage(hWnd, WM_CLOSE, 0, 0);
break;
case WM_CLOSE:
{
msgboxID = MessageBoxEx(g_hWndMainFrame,
L"Are you sure you wish to quite Internet Commerce Engine 5",
L"Question",
MB_OKCANCEL | MB_DEFBUTTON1 | MB_ICONINFORMATION,
LANG_NEUTRAL
);
}
switch ( msgboxID )
{
case IDOK:
PostQuitMessage(0);
DestroyWindow(hWnd);
break;
case IDCANCEL:
PostQuitMessage(1);
break;
}
break;
case WM_DESTROY:
break;
case WM_QUIT:
PostQuitMessage(0);
break;
|
|
|
|
|
jkirkerx wrote: PostQuitMessage(0), 0 means close, 1 means abort?
The parameter is an exit code that you want to return from your program. The numbers do not mean anything unless you, as the programmer, define a meaning for them.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Yah that didn't work. Think I'm closer now
case WM_CLOSE:
{
msgboxID = MessageBoxEx(g_hWndMainFrame,
L"Are you sure you wish to quite Internet Commerce Engine 5",
L"Question",
MB_OKCANCEL | MB_DEFBUTTON1 | MB_ICONINFORMATION,
LANG_NEUTRAL
);
switch ( msgboxID )
{
case IDOK:
Sleep(1000);
PostQuitMessage(0);
return 0;
break;
case IDCANCEL:
return 1;
break;
}
}
break;
case WM_DESTROY:
break;
case WM_QUIT:
DestroyWindow(hWnd);
break;
|
|
|
|
|
jkirkerx wrote: case WM_QUIT:
DestroyWindow(hWnd);
break;
When the thread retrieves the WM_QUIT message from its message queue, it should exit its message loop and return control to the system.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
I need to fix my child window first. I think I have the main window fixed. I have the same loop in the parent window and child window, so the child window is still running the loop when I try to shutdown the main window.
Now I'm starting to think that I have to call DestroyWindow for each control as well.
Main Window
case WM_CLOSE:
{
msgboxID = MessageBoxEx(g_hWndMainFrame,
L"Are you sure you wish to quit Internet Commerce Engine 5",
L"Question",
MB_OKCANCEL | MB_DEFBUTTON1 | MB_ICONINFORMATION,
LANG_NEUTRAL
);
switch ( msgboxID )
{
case IDOK:
Sleep(1000);
PostQuitMessage(0);
break;
case IDCANCEL:
return 1;
break;
}
}
break;
case WM_DESTROY:
DestroyWindow(hWnd);
break;
case WM_QUIT:
break;
Child Window
case WM_CLOSE:
{
HMENU hMenu;
HMENU hManagementMenu;
hMenu = GetMenu( gUserAccount_Index_GAC );
EnableMenuItem(hMenu, 1, MF_BYPOSITION | MF_ENABLED);
hManagementMenu = GetSubMenu(hMenu, 1);
EnableMenuItem(hManagementMenu, IDM_MANAGEMENT, MF_BYCOMMAND | MF_ENABLED);
DrawMenuBar( gUserAccount_Index_GAC );
}
return 0;
break;
case WM_DESTROY:
{
if ( hUserAccount_Index )
hUserAccount_Index = NULL;
DestroyWindow(lbl_UserAccount_Index_Label);
DestroyWindow(lb_UserAccount_Index_Listbox_Field);
DestroyWindow(bt_UserAccount_Index_Add);
DestroyWindow(bt_UserAccount_Index_Edit);
DestroyWindow(bt_UserAccount_Index_Delete);
DestroyWindow(bt_UserAccount_Index_Exit);
DestroyWindow(cWnd);
}
return 0;
break;
case WM_QUIT:
break;
|
|
|
|
|
If I take this out of the mdi child main, the main parent window and process shuts down fine.
But I want to have access to the tab key, so I'm not quite sure how to proceed. This is the thread that is running from the mdi child window.
MSG msg;
int bReturn;
while ((bReturn = GetMessage(&msg, NULL, 0, 0)) !=0) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
ReleaseDC(NULL, hdc);
return (int) msg.wParam;
|
|
|
|
|
jkirkerx wrote: I'm suppose to PostQuitMessage(0), 0 means close, 1 means abort?
This just created the visual of a dialog box in my mind:
+-----------------------------+
| |
| Do you want to abort? |
| |
| [ Yes ] [Abort] |
| |
+-----------------------------+
|
|
|
|
|
That's funny, but pretty much what it is.
I narrowed it down to the message loop in my child window. guess I need to test for the WM_DESTROY message manually to kill the loop.
|
|
|
|
|
Hi,
I am trying to compile a .cpp program which contains RichOle.h I get compiler error which make no sense to me
typedef struct _reobject
line 18 {
line 19 DWORD cbStruct;
LONG cp;
CLSID clsid;
LPOLEOBJECT poleobj;
LPSTORAGE pstg;
LPOLECLIENTSITE polesite;
SIZEL sizel;
DWORD dvaspect;
DWORD dwFlags;
DWORD dwUser;
} REOBJECT;
compiler errors
C:\Program Files\Microsoft Platform SDK\Include\RichOle.h(18) : error C2146: syntax error : missing ; before identifier ;once;
C:\Program Files\Microsoft Platform SDK\Include\RichOle.h(18) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files\Microsoft Platform SDK\Include\RichOle.h(19) : error C2143: syntax error : missing ; before ;class-head;
C:\Program Files\Microsoft Platform SDK\Include\RichOle.h(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
;progdialog.cpp
I think I need some pragma directive to to compile the above structure as a "C" type progam
any help would
|
|
|
|
|
There's nothing wrong with that line, it's a C-style structure definition, which is also valid in C++. You probably have a problem somewhere before that header is loaded and it's just causing the compiler to think there's a problem with that definition. Look for missing ';' characters in the file where you included this header.
|
|
|
|
|
look at the lines in your cpp code before the include of richole.h, there might be a syntax error there that is manifesting itself in the h file. Don't forget, "include" is the equivalent of "paste the file here" so you should think of the cpp file as one continuous piece.
|
|
|
|
|
ForNow wrote: I get compiler error which make no sense to me
It is telling you there's a syntax error in the included RichOle.h header file, at line 18.
Pardon the silly question: "Did you include windows.h, before it?"
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified 10-Jan-12 16:55pm.
|
|
|
|
|
Nothing silly about that question. IMHO.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thank you, Richard. I was downvoted for the previous sentence (though my sarcasm was completely switched OFF while writing it).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Sometime some Visual Studio compiler error is really confusing.
As far I can understand may be there is no error in neither your source code or your RichOle.h Source code. Probably its missing some special header file that defines lots of macros. Make sure your windows.h is defined before RichOle.h
|
|
|
|
|
I, too, consider this the most likely cause.
It's sad how in so many years of compiler history, MS still fails to create their headers in a way that does not require a specific order of inclusion. It wouldn't be so bad, if that wouldn't trigger totally unrelated error messages, but apparently they don't get that either.
A practical solution is to use the VS Project Wizard to create a new Windows application (MDI, SDI, or dialog-based, depending on your needs), and switch on precompiled headers, then copy the resulting stdafx.h into your own project. It should contain the inclusion statements for windows.h and pretty much everything else you need, and in the correct order. (this is only to get the full list of include statements, and in the right order - you can also just copy the include lines from stdafx.h to the relevant cpp files in your project instead if you don't use PCH)
|
|
|
|
|
include "windows.h", "richedit.h", and "richole.h" in your "stdafx.h" header file. Then include "stdafx.h" in my main cpp file.
As in MSDN[^]!
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
Hello,
I have an application that carries out multiple tasks in succession. I was hoping to mimic the Windows style install list akin http://imageshack.us/photo/my-images/85/win7installex.png/
I have the required icons and animation files but as of yet an unable to display an .ani file on the dialog.
Thanks in advance.
|
|
|
|
|
You need to give some more detail about exactly what you are trying to do and what parts of your code you are having a problem with.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
|
Essentially I was just trying to display an ani file on the dialog.
I've converted the ani file to byte array and using CreateIconFromResourceEx to create the cursor.
All working now, thanks for the advice.
|
|
|
|
|
Hello
I would like to add a CDialog-derived template as a pane in a CMFCOutlookbar (instead of simple controls as shown on lots of samples) ... I saw some code on the Web but nothing is working...
Thanks for any clue or sample code to do this ...
Thierry
|
|
|
|
|
You could try adding a CDialogBar class to the pane.
|
|
|
|