|
The CFolderPickerDialog class inherits from CFileDialog[^], you should check there for details on customisation.
|
|
|
|
|
|
I have a video which I want to split into 4 parts according to the coordinate values while transmitting it from 1 device to another.
So how can I do that? Please someone help me.
|
|
|
|
|
|
I've read the following statement and I cannot understand something within it "In all binary trees, there are at most 2^i nodes at level i + 1" what I cannot understand is that tree's levels start at level 0, however, if we apply what is written in this statement there will be no level 0 at all as it says level i + 1 which mean 0 + 1 = level 1, 1 + 1 = level 2, etc. So is this statement wrong?!!! or I am missing something?!!!
|
|
|
|
|
Where did you read that?
Here[^], for instance, is stated: In general, each level of a binary tree can have, at most, 2N nodes, where N is the level of the tree
|
|
|
|
|
I read it in 2 books "Data Structures Through C in Depth" and "Data Structures and Algorithms in C++, 4th Edition" and even the link you gave to me saying "The root of the tree, therefore, is at level 0" which means that tree's level starts at 0. So I am confused because those books also saying that tree's level starts at 0?!!!
|
|
|
|
|
Well, that's correct if you say 2N (instead of 2(N-1)) as maximum number of nodes at level N.
|
|
|
|
|
I know it is correct to say 2^N, however, to say for level N+1 is what makes me confused because tree's level starts at level 0 which mean that N = 0 so if we apply the above statement it will be 2^0 for level 0 + 1 which means 1 node for level number 1 I hope you get what I meant
|
|
|
|
|
I know it is correct to say 2^N, however, to say for level N+1 is what makes me confused because tree's level starts at level 0 which mean that N = 0 so if we apply the above statement it will be 2^0 for level 0 + 1 which means 1 node for level number 1 I hope you get what I meant.
|
|
|
|
|
* Level 0 2^0 = 1 node
/ \
/ \
/ \
* * Level 1 2^1 = 2 nodes
/ \ / \
* * * * Level 2 2^2 = 4 nodes
It is 2<sup>N</sup> for level N .
If you find written 2<sup>N-1</sup> then levels are numbered differently, starting from 1 (instead of 0 ).
|
|
|
|
|
Thanks for your reply I just get confused a little bit as some books state that level start at 0 and others state that level starts at 1. We need a unified solution between those authors 
|
|
|
|
|
You are welcome.
|
|
|
|
|
I have a service I wrote that uses a filewatcher. On create it takes the excel file and truncates table and import it.
It works on my Windows 7 box. When I drag a new file into the folder it imports it. If i drag a newer file it deletes the old data and imports the new data.
On Windows 2012 Server the service works on the first import. on the second drop of a excel file I get
Error durring import of file 20151106.xls
Exception occured in Microsoft JET Database Engine
Exception: The Microsoft Jet database engine cannot open the file. It is already opened exclusively by another user, or you need permission to view its data.
This shouldnt happen as I have
finally
{
if (oraConn.State == ConnectionState.Open)
{
oraConn.Close();
}
if (oleDbConn.State == ConnectionState.Open)
{
oleDbConn.Close();
}
oraConn.Dispose();
oleDbCmd.Dispose();
oleDbConn.Dispose();
}
The service works fine on my windows 7 box and works for the first file on Windows 2012 server. Why is the service leaving the connection oleDbConn open on Windows Enterprise Server 2012? ?
modified 4-Dec-15 19:07pm.
|
|
|
|
|
I have a large legacy application being updated to use newer CMFCRibbonBar. This application is large and the creation of the CMFCRibbonBar involves converting a lot of legacy icons and menu structures so is a bit complicated to extract and post here. I will add further details as people request them.
But the general gist is:
The application works fine and has a valid and working CMFCRibbonBar.
That ribbon bar has 11 categories across the top. With hundreds of panel buttons and menu buttons.
I have also recreated the same structure using CMFCRibbonButton to create a quick old style menu system which has been added to the m_wndRibbonBar via the AddToTabs. This give me a working drop down menu in the top right had corner. I believe there is a general web example which people may be familiar with which create a “window style” dropdown where you to change the MFC window manager style from windows 2000 through to windows7.
My menu is created from scratch at application startup and is not taken from a menu resource as this application predates this structure.
I use commands like the following to construct this menu:
pQuickMenu = new CMFCRibbonButton(ID_MENU++,TEXT("Quick Menu"),-1,-1,0);
…
pQuickButton = new CMFCRibbonButton(ID_MENU++,wMenuCommand,-1,-1,0);
pQuickMenu->AddSubItem(pQuickButton,-1);
…
…
m_wndRibbonBar.AddToTabs(pQuickMenu);
The problem I am having is dynamically adding new buttons to this quick menu at a later date.
When I originally created this quick menu I kept the pointer to this structure that was used to add to the ribbon. Therefore I am able to add to the quickmenu.
pQuickBut = new CMFCRibbonButton(ID_MENU,wMenuCommand,NULL,0,hSmall,0,0);
pQuickMenu->AddSubItem(pQuickBut,ilp);
If I add a new button to the existing stored top level quick menu using the stored pQuickMenu pointer, the button does appear. The text is correct and the button is selectable.
Except that the button is not operated upon when clicked.
If I add the button to the m_wndRibbonBar instead then it works so I know there is a valid command handler.
Down within the MFC code, clicking on my new quick access menu enters a routine called:
CMFCRibbonBaseElement::NotifyCommand(BOOL bWithDelay)
This extracts the command id correctly.
UINT uiID = GetNotifyID();
But it then checks for a valid ribbonbar.
CMFCRibbonBar* pRibbonBar = GetTopLevelRibbonBar();
This fails and returns a null pointer. Thus the command processing structure is exited.
As a test, if I call m_wndRibbonBar.AddToTabs(pQuickMenu) again for a second time adding the same menu to the RibbonBar a second time, then the origial becomes corrupt but the new command does work.
I am therefore assuming (guessing) that when the AddToTabs is called there is a ribbon handle stored with the commands. When I add directly to the existing structure after the original call to AddToTabs, a valid ribbon handle is not happening.
In the old style of things I would detach my quick menu, update it and then reattach. But I do not know how to do this (or even if it is nessesary) in the new CMFC classes.
The command: m_wndRibbonBar.removeallfromtabs(); deletes the whole of my pQuickMenu structure so I can not then add to it.
Is there anyone who can help explain how to dynamicaly add new buttons to an exising menu that has been added to a ribbonbar tab.
Any help appreciated.
Thanks.
Steve.
-- modified 7-Dec-15 4:13am.
|
|
|
|
|
I now have a simple MFC example which demonstrates my issue.
Is it possible for me to upload this somewhere hoping that someone can pinpoint where I’ve gone wrong and help correct it.
Thanks.
Steve.
-- modified 7-Dec-15 5:49am.
|
|
|
|
|
Can anyone help me?
I am still unable to add to a ribbonbar “tab”.
Here is an example bit of code, which when added to a new MFC MDI basing ribbon example generated from the wizard works correctly until I add the bit at the bottom.
Add to MainFrm.h
public:
void CMainFrame::CreateAddtoTabs();
void CMainFrame::AddToExistingTab();
void CMainFrame::DoIWork(UINT ID);
public:
CMFCRibbonButton *pQuickMenu;
CMFCRibbonBar m_wndRibbonBar;
Add to MainFrm.cpp
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx)
ON_COMMAND(2000,&CMainFrame::AddToExistingTab)
ON_COMMAND_RANGE(1000,1001,&CMainFrame::DoIWork)
END_MESSAGE_MAP()
//Replace the existing InitializeRibbon routine.
void CMainFrame::InitializeRibbon()
{
BOOL bNameValid;
CString strTemp;
bNameValid = strTemp.LoadString(IDS_RIBBON_FILE);
ASSERT(bNameValid);
m_PanelImages.SetImageSize(CSize(16, 16));
m_PanelImages.Load(IDB_BUTTONS);
m_MainButton.SetImage(IDB_MAIN);
m_MainButton.SetText(_T("\nf"));
m_MainButton.SetToolTipText(strTemp);
m_wndRibbonBar.SetApplicationButton(&m_MainButton, CSize (45, 45));
CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(strTemp, IDB_FILESMALL, IDB_FILELARGE);
CreateAddtoTabs();
}
//Include new routines in MainFrm.cpp
void CMainFrame::CreateAddtoTabs()
{
pQuickMenu = new CMFCRibbonButton(1000,TEXT("QuickMenu"),NULL,0,0,0,0);
AddToExistingTab();
m_wndRibbonBar.AddToTabs(pQuickMenu);
}
void CMainFrame::AddToExistingTab()
{
pQuickMenu->AddSubItem(new CMFCRibbonButton(1001,TEXT("Do I work?"),NULL,0,0,0,0),-1);
}
void CMainFrame::DoIWork(UINT ID)
{
MessageBox(TEXT ("Yes I Do!"),TEXT("Do I Work?"), MB_ICONWARNING) ;
}
If I add the above strucutre to a ribbon based MDI MFC application, a new “QuicMenu” tab appears on the menu system. It works. If I click the “Do I work?” menu entry then it pops up a panel saying “yes I do!”
If I now add a button to the ribbonbar at time of initialisation, which when clicked will adds a new button to the “QuickMenu” menu then all is good. The additional button turns up and is selectable.
void CMainFrame::InitializeRibbon()
…
…
…
…
CMFCRibbonCategory *pCat = m_wndRibbonBar.AddCategory(TEXT("Update AddToTabs"),0,0,CSize(16,16),CSize(32,32),-1,0);
CMFCRibbonPanel *pPan = pCat->AddPanel(TEXT("Single Button"),0,0);
pPan->Add(new CMFCRibbonButton(2000,TEXT("Click to add to quickmenu"),0,0,0,0,0));
CreateAddtoTabs();
}
But when I select this new menu entry from the “quickmenu”, the click is registered but in the lower MFC code it fails to recognise a valid ribbonbar handle and exists without processing the message (see my first post for more info).
Can anyone help?
I am realy stuck and may have to scrap the ribbon and revert to basic menus only if I can not dynamicaly add to my quickmenu as rquired.
What am I missing or overlooking when I'm adding to my QuickMenu structure?
Any help would be appreciated.
Thanks.
Steve.
|
|
|
|
|
|
In my project I created object for class using new operator. After use I deleted that object and set that to NULL. But even after deletion, I could able to access and able to run other functions using that (deleted)object.
Please go through example:
CTemp *objTemp = new CTemp;
objTemp->Fun1();
delete objTemp;
objTemp = NULL;
objTemp->Fun2(); // It is illegal still works, why?
Why this is happening?
modified 4-Dec-15 6:09am.
|
|
|
|
|
Because the method is generated for the class, not for the instance of the class (that is you don't delete code).
|
|
|
|
|
In addition to the answer by CPallini:
It will only work when your CTemp::Fun2() function does not access non-static member variables or call other member functions that would do so. Then the implicit this pointer will be used which is NULL generating an access violation.
|
|
|
|
|
Of course. 
|
|
|
|
|
I am in the process of trying to code the transmission of floating point data over an ethernet cable. I decided to send two bytes, the first with the "whole" part and the second with the "fractional" part (but as an unsigned char). The first byte works fine, but the second (trivial) part is giving me a strange (to me) problem which is driving me nuts - I can't see WHAT I'm getting wrong. Here is the test code:-
float flTest = 0.04;
float flResult;
flResult = flTest * 100;
unsigned char ucResult;
ucResult = (unsigned char)flResult;
flResult ends up as 4.00000 which is correct, but ucResult gives 3 !!
If I change flTest to 0.05, ucResult is 4 !!
There is clearly a decrementation involved here, but I can't understand why !
I'm sure that when some kind soul explains it, I shall be kicking myself - HARD !!
Doug
|
|
|
|
|
Hate float, try decimal. every time I have used float, the results are unpredictable for what seems like straight forward math, decimal behaves itself.
|
|
|
|
|
Float (and double) do exactly what they are supposed to do. The problem is that too many users do not understand how to use it.
|
|
|
|
|