|
.Net is for managed C++/CLI.
MFC does nt support "managed" code, only the native one. So you have to create a new C++/CLI project and try to work with this DirectorySearcher class in there.
|
|
|
|
|
Can you think about the problem to implement the use of DirectorySearcher class?
I have System.DirectoryServices.dll suitable exactly for my version of Microsoft .Net Framework 1.1 Version 1.1.4322.
Other versions of System.DirectoryServices.dll are refused to be added to the References folder in the project.
About to upgrade software that will be suitable to new Visual Studio version - it not so simple.
It is huge old software. I has performed conversion today but can not yet to see the result today. There were errors that conversion raised during it
|
|
|
|
|
|
Plus, let's not forget the "bible" of native/managed interop, C++/CLI in Action[^] by our friend Nish.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I seriously recommend upgrading Visual Studio to latest and use a version of the .NET Framework that hasn't been dead for the last 10 years.
|
|
|
|
|
About to upgrade software that will be suitable to new Visual Studio version - it not so simple.
It is huge old software. I has performed conversion today but can not yet to see the result today. There were errors that conversion raised during it
|
|
|
|
|
So my app works using MFC toolbar creation without issue. If I set a flag, I can make it Dock or Float when the program is started using m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); . The code that does it lives in the OnCreate which of course can only be called once. What I'm looking to do is use my property sheet to allow the user to select the mode of the toolbars Docked or Floating which requires a method outside of the OnCreate . So I have two buttons for testing, one to destroy the toolbar (working) and create which "rebuilds" the toolbar....
I start off with the app in the Docked mode, then I test by destroying the toolbar and then rebuilding it. The rebuild is where my issue is. On the rebuild , it is "adding" some blank space equivalent to the two toolbars (Menu and Button ) and the toolbars float ....I can drag it out of where it was docked.....and the floating bar works.....but it "leaves behind" the a non functional version of the floating toolbar where it was once docked. If I double click the floating bar, it jumps back to its previously docked location.
So I'm trying to figure out what is needed to correct my code that partially does what I want.....and fix the artifacts.
The code to destroy:
int CMainFrame::OnToolBarDestroy()
{
CDockingManager myPane;
myPane.RemovePaneFromDockManager(&m_wndToolBar, TRUE, TRUE, TRUE, NULL);
m_wndToolBar.Invalidate();
m_wndToolBar.DestroyWindow();
myPane.SaveState();
CPaneContainer myContainer;
myContainer.RemoveNonValidPanes();
RecalcLayout();
return 0;
}
The code to rebuild the toolbar:
int CMainFrame::OnToolBarCreate()
{
if (m_wndToolBar)
{
m_wndOutput.AddStringStatusTab(_T("Error: Icon toolbar is already active, action cancelled"));
m_wndOutput.AddStringDebugTab(_T("Debug: MainFrame--Error: Icon toolbar is already active, action cancelled"));
return -1;
}
CMFCPopupMenu::SetForceMenuFocus(FALSE);
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to Create Dialog ToolBar\n");
return -1;
}
CMFCToolBar myTools;
myTools.IsFloating();
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndToolBar);
EnableAutoHidePanes(CBRS_ALIGN_ANY);
CRect rcClientOld;
CRect rcClientNew;
GetClientRect(rcClientOld);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, rcClientNew);
m_wndOutput.AddStringStatusTab(_T("I'm created 1 times"));
m_wndToolBar.ShowPane(TRUE, FALSE, TRUE); RecalcLayout();
return 0;
}
In the rebuild, note the comment of where the problem begins.....If I comment out that line.....I can destroy and rebuild the toolbar with no issue, it is once I enable that line of code which creates the "float" of the toolbar action. I thought by destroying the toolbar and rebuilding it with the same options as the OnCreate function with the float line mentioned above would do it.....but I get weird issues with the toolbar.
Here are images showing:
Docked Menu:
http://kittmaster.com/imagedump/codeproject/Toolbar1.png
Destroyed Toolbar:
http://kittmaster.com/imagedump/codeproject/Toolbar2.png
Rebuilt Toolbar with issues described:
http://kittmaster.com/imagedump/codeproject/Toolbar3.png
Any ideas how I can solve this issue?
I can't find any code examples anywhere the float option isn't done outside of the OnCreate function.
Hopefully someone can guide me?
You can see with all the commented code of things I've tried to see if I could fix it...
Thanks in advance!
Chris
|
|
|
|
|
Hi,
I haven't used the MFC classes in nearly a decade but maybe I can help you debug it.
kittmaster wrote: but it "leaves behind" the a non functional version of the floating toolbar where it was once docked. My instincts are telling me that the non-client area[^] has expanded down when your CControlBar was created.
Can you check for this for me? You can get the non-client area by calling GetWindowRect [^] and subtracting the GetClientRect[^].
If I am correct then you will need to send the WM_NCCALCSIZE message[^] to reclaim your top client area.
Best Wishes,
-David Delaune
|
|
|
|
|
|
Well,
Your Debug window is showing a 39 pixel difference on the Y axis, so the client area size has certainly changed.
Go through the CControlBar documentation to make sure there isn't a built-in way to avoid the non-client area resizing. I don't remember off the top of my head.
If not then maybe use a sledge hammer to fix it by sending a WM_NCCALCSIZE to resize it manually.
Best Wishes,
-David Delaune
|
|
|
|
|
I added this line of code after the difference calculation:
AdjustWindowRectEx(&rect, m_wndToolBar.GetStyle(), FALSE, m_wndToolBar.GetExStyle());
It zeroed out the values but the same ghost blocks still remain. I can't find direct access to that variable you mentioned, any code example/tips you could point me to?
Thanks,
Chris
|
|
|
|
|
|
I found that via the class I was looking at and reading the class methods when we were looking at the rectangle offsets. I read it as it would recalc the rectangles of the toolbar and plant it, clearly I was incorrect as my result are as you mentioned...not working.
I will look at the code samples you linked to.
Thank you,
Chris
|
|
|
|
|
To check given string is Palindrome or not in Mfc c++
|
|
|
|
|
I see your randomness and raise you, "The golf course maintains a luxury garden or not."
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
It isn't really specific of MFC .
Let's say you have a string s with length L , then you just need to check if (s[i] == s[L-1-i]) evaluates true for every i in the 0, .., (L/2) range.
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
|
|
No.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
First, the assignment is incomplete as you tried to post the entire thing in the subject line instead of the body of the post.
Second, no, we're not here to do your work for you. Asking for such is insulting.
If you've got questions about your your own code, fine, we can help with that, but you have to ask the questions with proper detail to answer them.
|
|
|
|
|
Does it even matter?
I suppose if you need something uniquely implemented in the new SDK, you're want to build/link against it. But if you have a basic app, why worry about it?
As a rule, do you just keep your SDK on your machine current to the latest from Microsoft?
thx
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
Whatever gets installed along with Visual Studio and the compilers works for me.
|
|
|
|
|
My perception as well.
Context: so I typically have one development machine for about 4 years. The one I'm typing on is 5+ years old (dang, I need to replace). So what happens over that period of time is that I collect SDKs. I don't pay attention. But I'm trying to position code I need in a "highly secure environment" - which means its elephanting impossible to get any work done, but the IT guy promises to install what I request.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
turns out cleaning up after using a linked list isn`t as simple as I thought.
I know this is wrong but it`s the best code I was able to come up with. Any help for setting me on the correct path is appreciated.
void CleanUp(SomeNode * FrontTip)
{
SomeNode * Temp;
Temp = (SomeNode*)malloc(sizeof(SomeNode));
while(FrontTip->next != NULL)
{
Temp = FrontTip;
FrontTip = Temp->next;
free(Temp);
}
}
|
|
|
|
|
You don't need to malloc Temp : it's just a pointer. You also forgot to free it. You also didn't free the FrontTip argument if it's the only thing allocated (i.e. if its next is NULL ). I would write
while(FrontTip != NULL)
{
SomeNode* Temp = FrontTip->next;
free(FrontTip);
FrontTip = Temp;
}
|
|
|
|