|
Hi, I have programmed a program that shows information about windows services and can stop/start it. And when I compile the program in DEBUG mode the program works perfectly but not in release. ( I use a lot of C code in my MFC vc++ program)
Please Help me..
|
|
|
|
|
|
Thanks, I am going to check that out.
Where can I upload the code ?
|
|
|
|
|
Make sure you're not using the ASSERT macro where you should be using VERIFY . Remember that the ASSERT macro translates to nothing in a release build, so if you do any processing inside the macro, it doesn't happen in release mode.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Thanks, but I have already checked that possibility.
|
|
|
|
|
I'm trying to write a replacement taskbar, but I've hit a snag. When a window minimises, the caption animates towards the taskbar button. As my taskbar will keep its buttons in a different place, I need a way to control where the caption animation goes. Similarly, when a window is un-minimised, I need some way to tell Windows where to originate the animation.
I thought the WH_SHELL hook would do this, as it detects a "minimised rectangle" request; but it seems that this hook is for monitoring only - I cannot modify the rectangle.
Does anyone have a solution, please? Or even a hint?
|
|
|
|
|
maybe handle NC_PAINT ???
|
|
|
|
|
Okay, could I have a suggestion from someone who actually understands the question, now, please?
|
|
|
|
|
I am trying to add a context menu to the list portion of a CBS_DROPDOWN style CComboBox control. I started by replacing the COMBOLBOX dropdown with my own CListBox derived class (technique here[^]). The problem I have is that when my context menu pops up, the drop down list disappears. I would like it to stay visible. I tried to catch the CB_SHOWDROPDOWN message in the CComboBox class and the WM_SHOWWINDOW message in the CListBox class. both methods fail to prevent the list from closing.
Any body have any ideas (or maybe a link to a control that already does this)?
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Hi PJ,
Do you know what message is being sent to your listbox to get it to close and who is sending it? Spy++ might help. I wonder whether you could kludge the combo style and switch it between simple and dropdown on the fly!
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
The list box recieves WM_SHOWWINDOW, WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED messages. I do not know who is sending them, but I assume it is the combo box control. I tried overriding these messages, no luck I tried to hook these messages using WH_GETMESSAGE and WH_CALLWNDPROC hooks, also no luck I am beginning to think that the only way this will be possible is by rewriting the entire combo box control, not something I want to do.
I think what I will have to do instead is modify the combo's edit control's context menu.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I still don't understand precisely what is causing your list cntrl to close. Is it being destroyed, sent a WM_CLOSE or ... Do you have an OnDestroy() or OnClose() and are these being called. Or who is calling the dtor (looking at stack trace).
Why did you have to use your own list box in the first place. Was it because the right click -> popupmenu closed the drop down list.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
From what I have been able to figure out, the drop list is not actually closed or destroyed, it is just hidden (in spy++ its HWND stays active, even though it is not visible). I have to use my own list control, because the drop list of the combo box (class COMBOLBOX) does not generate a WM_RBUTTONDOWN or a WM_CONTEXTMENU message when I right click on it (The edit control portion of the combo control does however). The problem I am having now is that when I handle the WM_CONTEXTMENU message in my own subclassed list control, I pop up a popupmenu and the list disappears. It is all rather annoying.
I know I am being as clear as mud, but thanks for the help anyway
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
From what I have been able to figure out, the drop list is not actually closed or destroyed, it is just hidden (in spy++ its HWND stays active, even though it is not visible).
Aha. What Styles does Spy++ say it has when it is hidden. Is WS_VISIBLE set? Maybe it is be placed behind the app. From memory either the edit or list portion of a combo has the desktop as its parent.
PJ Arends wrote:
I have to use my own list control, because the drop list of the combo box (class COMBOLBOX) does not generate a WM_RBUTTONDOWN or a WM_CONTEXTMENU message when I right click on it (The edit control portion of the combo control does however).
What about reverting to the standard combo box and doing a hit test when you get the WM_CONTEXTMENU in the edit control and if it is over the list ctrl do your menu thing.
PJ Arends wrote:
The problem I am having now is that when I handle the WM_CONTEXTMENU message in my own subclassed list control, I pop up a popupmenu and the list disappears. It is all rather annoying.
Can you do a ShowWindow(), BringWindowToTop() on the list ctrl from your popup menu?
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi,
first, excuse me for my english ...
I've created a SDI application based on CHtmlView. And I'd like to know when a file (.exe,.zip,etc...) will be downloaded, so I'll be able to open this file without asking the user to choose between open it or save it.
What I'd like to have is the method FileDownload() from the simple DWebBrowserEvents2 composant in my CHtmlView.
I'm quite a beginner in MFC, so I don't really understand all the stuff with the ActiveX (invokehelper, dispatch, etc ...) and I don't manage to do it by myself .
thx for your help.
|
|
|
|
|
I'll try to explain what I want in a better way :
I want to know if an url is diplayable or downloadable. So I'll be able to download automatically all downloads to a same path.
Anybody ?
|
|
|
|
|
I have MDI app and I need to get combo box pointer from toolbar.
I tried PreCreateWindow and OnCreate with no success - assertions in mfc core fails.
I solved this problem by calling GetDlgItem in button message handler, but I think there should be more smart way to do that.
|
|
|
|
|
[edit]Got the function prototype wrong /edit]
The combo box is a child of the toolbar, not of the frame window. You don't call GetDlgItem() in CMainFrame, but in your toolbar (or dialog bar).
int CMainFrame::OnCreate(LPCREATESTRUCT lpcs)
{
if(CMDIFrameWnd::OnCreate(lpcs) == -1)
return -1;
CWnd *pComboWnd = m_ToolBarWithComboBoxOn.GetDlgItem(IDC_COMBO_BOX);
return 0;
}
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Yes I know that, but my first post wasn't clear enough.
Actually I need to get pointer to class object of class delivered from CComboBox.
[code]
// CDialogBar m_wndSearchBar;
// create m_wndSearchBar and pass to ReBar::AddBar ...
CHistoryCombo *m_pcomboSearchQuery = (CHistoryCombo *)m_wndSearchBar.GetDlgItem(IDC_COMBO_SEARCH_QUERY);
m_pcomboSearchQuery->LoadHistory("Settings", "SearchQueryHistory");
[/code]
The ChistoryCombo class is derived from CComboBox class.
The last string cause assertion in CString code.
So I think I acually get CComboBox pointer not CHistoryCombo.
Is there any way to get a CHistoryCombo pointer?
I know that I can constuct CHistoryCombo directly and then pass to CReBar::AddBar()
but is I think to build all toolbars from dialog resources is more good code style.
|
|
|
|
|
kydfru wrote:
So I think I acually get CComboBox pointer not CHistoryCombo
That's correct, unless you have created it as a CHistoryCombo...
Have you used ClassWizard to bind the IDC_COMBO_SEARCH_QUERY to a control member variable? If you bind it as a CComboBox, and then change the definition to a CHistoryComboBox instead of CComboBox, then you can use this CHistoryCombo variable as you need.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Is it suitable in CMainFrame?
I see that all ClassWizard can do is to generate some strings for DDX support.
So I write:
[code]
void CMainFrame::DoDataExchange(CDataExchange* pDX)
{
CMDIFrameWnd::DoDataExchange(pDX);
DDX_Control(pDX, IDC_COMBO_SEARCH_QUERY, m_comboTest);
}
[/code]
And when I call m_comboTest.GetWindowText(str) I get assertion of ASSERT(::IsWindow(m_hWnd));
So I think DDX is not working in CMainFrame and I need to construct custom class for toolbar dialog resource.
|
|
|
|
|
kydfru wrote:
Is it suitable in CMainFrame?
No. The combo box is a child of your dialog bar. It has to be done in your dialog bar class.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Hiya I have a buffer and starting from position 12, I need to extract the next 6 chars for display. Need to do it in c++.
How do I do this??
Thanks.
|
|
|
|
|
char *buf = "12345678901234567890";<br />
char szNext6Chars[7];<br />
strncpy(szNext6Chars, buf + 12, 6);
|
|
|
|
|
One solution is strcpy. Another solution is memcpy(). Pass in a pointer to the string that points to the the first character to be copied, which in this is at position 12.
Kuphryn
|
|
|
|