I'm trying to not display the description part of a tooltip in a MFC application.
The description part is, I assume, the 2nd line of the default tooltip.
This is what I tried to do (in a straighforward wizard generated MFC application)
// in the InitInstance of the application.
ttParams.m_bVislManagerTheme = TRUE;
ttParams.m_bDrawDescription = FALSE;/// here
CTooltipManager* tooltipManager = theApp.GetTooltipManager();
tooltipManager->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
I would assume that the m_bDrawDescription in the struct, and the call to SetTooltipParams would change the whole behavior of the tooltips of the application, but it does not, when those lines are added, nothing seems to changed.
creating a mFC project. Saving a image in bmp,for that I am using BITMAPINFOHEADER.
In Debug build,its working fine. But in release Build, BITMAPINFOHEADER fields are not accepting values that I am putting,it is still showing some garbage value.
Do I need to change in properties for release build ?
Release builds usually optimize and this makes the debugger go wrong often.
If you want to see the values in Release it's probably better to use other means, writing them to a file or other external resource/tool.
I found on net that whenever you found something working on debug but not in release build then first of all Disable optimization under Project properties ->c/c++ Tab,Under Optimization category - >under option (optimization).
I choose to Disable from maximize speed in release build then its working.
But,I have doubt over this. What it should be the optimization in release build and If it is other than Disable option then how this problem can be solved.
Any Views ??
But,Anyway mine BitmapInfoheader problem is Solved.
Is there any way of doing it? I am trying to write some simple class for showing modeless dialog box and just cannot understand what is wrong with it. While it is pretty easy with DialogBoxParam - there seems to be no way with CreateDialog. My goal is to pass somehow a pointer to a class to call my dlgProc. The way i am doing it with modal dlgbox:
First, you probably have a main message loop somewhere that dispatches messages to every window (and dialog), not only to a specified window:
// global variable, it contains the handle of all dialogs
// your main loop somewhere near your main()
while (::GetMessage(&msg, NULL, 0, 0))
// copying the global array because it might be modified during iteration
// and we iterate over the copy...
bool was_dialog_message = false;
for (size_t i=0,e=dialogs.size(); i<e; ++i)
if (::IsWindow(dialogs[i]) && ::IsDialogMessage(dialogs[i], &msg))
was_dialog_message = true;
When you want a modeless dialog, you just create it with CreateDialog(), put its handle to g_Dialogs and thats it. You don't have to run a local message loop like with modal messageboxes, especially not with a specified single window handle (m_hWnd). A modeless dialog works almost like a normal window that you created with CreateWindowEx(), you just have to handle it a bit specially with IsDialogMessage(). In a modeless multi-windowed gui program its always enough one message loop - the main message loop pumps the messages for all modeless windows.
EDIT: warning: while you are iterating over the g_Dialogs vector, the contents of the vector might change because you dispatch messages to dialogs that can respond to those messages by creating/deleting dialogs! To avoid bugs caused by this you either use a custom container that can be modified during iteration or solve it somehow else. One good solution can be copying the vector before iteration and iterating on the copied vector, still some HWNDs might become invalid during iteration so before IsDialogMessage() it might be wise to call IsWindow() on the handles.
Hey, thanks for your reply. My problem was that i couldn't find a way to put the whole thing into nice C++ class of my own. But, problem was solved by using CreateDialogParam instead. So i can pass a pointer to the dialog class to a main message loop so i can call my own virtual methods inside children classes.
I though that your problem is the messagebox because your loop was inside the DoModeless() method. Anyway, your previous hooking is also fine, you just miss a few messages that come before the return of your CreateDialog() call and you have to handle uninitialized GWLP_USERDATA cases as well. Even if you initialize userdata from WM_INITDIALOG it might be better to handle uninitialized cases, who knows what the future brings?
EDIT: The trick is simple: the sendto address is in the header of the datagram you received, but your recvfrom returns just the payload from that and the address of the sender. You need a method to reach other fields of the received UDP packet header, one way is using raw sockets.
Programs under windows need administrator privilege must get user's permission when they start. And they can also run with administrator privilege by right click the EXE and select "Run as Administrator". But, before the EXE start, a message box will show up. It's really disgusting.
Now I want my application to run as the Administrator, and I don't want the popup message box when user click the EXE file.
Now I wonder whether AdjustTokenPrivileges can help me achieve this.
Any one can help me?
modified 18-Aug-12 10:13am.
Last Visit: 31-Dec-99 18:00 Last Update: 27-Oct-16 12:50