|
Which is indeed what I advised my clients. However, there are several clients using this software and if there is one thing I learned over the years: Sysadmins will ALWAYS have their own thoughts on how to organise and authorize their users!
William
|
|
|
|
|
Ah yes, clients, users and sysadmins. The nemesis of our existence.
It might be possible at the folder level to allow full control to network access and to have that access flow to sub-folders. That might override the local adminstrator account when it creates the file.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Can somebody help in putting 2 tree view in one window in mfc
|
|
|
|
|
You can have two invisible windows as a container each one containing a single tree control. Place both of them in one window.
or write your own owner drawn control...
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
how can i have 2 invisible window under one single window???????
|
|
|
|
|
The main window should contain a CSplitterWnd. The panes of the splitter should contain you CTreeViews.
If you vote me down, my score will only get lower
|
|
|
|
|
How can I close an document from another document ?
Is correct to call simply OnCloseDocument ? :
POSITION posDoc,pos = theApp.GetFirstDocTemplatePosition();
while(pos)
{
CDocTemplate* pDocTemplate = (CDocTemplate*)theApp.GetNextDocTemplate(pos);
posDoc = pDocTemplate->GetFirstDocPosition();
while(posDoc)
{
CDocument* pDoc = pDocTemplate->GetNextDoc(posDoc);
if(pDoc)
{
if(bSomeCondition)pDoc->OnCloseDocument();
}
}
}
|
|
|
|
|
This is unfortunately, not the correct way.
Two possible ways:
If I remember correctly CDocument is a CCmdTarget, you could post a message directly to the document:
pDoc->SendMessage(WM_COMMAND, ID_FILE_CLOSE, 0L);
This may or may not work (untested, unchecked)
Typically a document only has a single view...
As you already have a pointer to the document in question, you can use its GetFirstViewPosition() / GetNextView() functions. You could send a WM_CLOSE to each view.
If you vote me down, my score will only get lower
|
|
|
|
|
In did, I have only a view attached by document, but your code didn't function, I get follow error :
SendMessageA' : is not a member of 'CDocument'
|
|
|
|
|
While i can't tell you how to correctly do this, whenever you see a Windows member function starting with the prefix 'On', then this is an event handler, and should not be called directly. Best case it won't do what you expect, worst case it crashes your app. The purpose of event handlers is to react to events that have already occured, not trigger such an event.
|
|
|
|
|
Well, I turn problem into one simpler, but without solution for me : how is the right way to close an document from CMyApp ? I try in follow way, but I don't know if is correct :
void CMyApp::CloseAllDocuments(CDocument* pDocExcept)
{
POSITION posDoc,pos = GetFirstDocTemplatePosition();
while(pos)
{
CDocTemplate* pDocTemplate = (CDocTemplate*)GetNextDocTemplate(pos);
posDoc = pDocTemplate->GetFirstDocPosition();
while(posDoc)
{
CDocument* pDoc = pDocTemplate->GetNextDoc(posDoc);
if(pDoc != pDocExcept)
{
pDoc->OnCloseDocument();
}
}
}
}
here I want to except for closing down an specific document ...
|
|
|
|
|
I try that in follow way, witout success :
void CMyApp::CloseAllDocuments(CDocument* pDocExcept)
{
POSITION posDoc,posView,pos = GetFirstDocTemplatePosition();
while(pos)
{
CDocTemplate* pDocTemplate = (CDocTemplate*)GetNextDocTemplate(pos);
posDoc = pDocTemplate->GetFirstDocPosition();
while(posDoc)
{
CDocument* pDoc = pDocTemplate->GetNextDoc(posDoc);
if(pDoc != pDocExcept)
{
posView = pDoc->GetFirstViewPosition();
while(posView)
{
CView* pView = pDoc->GetNextView(posView); CFrameWnd* pFrame = pView->GetParentFrame();
pFrame->SendMessage(WM_CLOSE);
}
}
}
}
}
modified 23-Nov-11 2:45am.
|
|
|
|
|
As I said, I can't really tell - it's been >15 years I last coded something like that, and while not much seems to have changed, my memory does fail me here. It seems a good idea to me to try close the view associated with the document, rather than the document itself. but I wonder, do you really have multiple views associated to your documents? Your code doesn't even try to close the first view it finds. Maybe you can try that before looking for more views?
On a sidenote, why do you even need to closee your documents manually? Normally this is something the framework does for you (which may be the reason why it seems to be so badly documented). Normally you have a GUI with one or more views to one or more documents, and when you close a view (e. g. by menu, or clicking on the [x] button), that view will be closed. When the last view referencing a document is closed, that document will be closed as well. And when you close the app, it will close all views. That's all in the framework already, no need for any extra code. In fact, it might even be a bad idea to close a document manually because it may confound the framework when it tries to do likewise.
|
|
|
|
|
You are right, I should try to close view ( viewes ) to be sure that the document is close. Thank you. I will let you you know what I've done.
|
|
|
|
|
I did it, now goes well, but now I close views not documents. Obviously, I learn something here. Thank you so much !
|
|
|
|
|
Dear Friends I have two mfc application. One is a dll and the other one is a client exe application. From the exe application I am trying to load the dll and launch the mainwindow of the dll.
For that in dll.....I have the view class there in view implementation file i am declaring a view pointer, like the code below
[code]
//RevolutionProjView.cpp file
CRevolutionProjView *view;
CRevolutionProjView::CRevolutionProjView()
{
view = this;
}
// The I am creating an extern C function by name runAppli like below.
extern "C" BOOL __declspec(dllexport) runAppli(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
view->ShowWindow(SW_SHOW);
return true;
}
[/code]
Now I have exe applicatioln where I want to launch the mainwindow of the dll above is given below.
[code]
void CClientRevProjDlg::OnBnClickedButton1()
{
typedef VOID (*MYPROC)(void);
HINSTANCE hinstLib;
MYPROC ProcAdd;
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
hinstLib = LoadLibrary(L"C:\\Users\\DasmahapatraS\\Projects\\Bhagavan_Cadem\\RevolutionProj_OrthoGraphic\\debug\\RevolutionProj.dll");
if (hinstLib != NULL)
{
ProcAdd = (MYPROC) GetProcAddress(hinstLib, "runAppli");
if (fRunTimeLinkSuccess = (ProcAdd != NULL))
(ProcAdd) ();
fFreeResult = FreeLibrary(hinstLib);
}
if (! fRunTimeLinkSuccess)
printf("message via alternative method\n");
}
[/code]
With this my application mainwindow is appearing but immediately its crashing. Can anyone tell me whats going wrong. How can I launch the mainwindow of the dll ?? Please help me. Thanks Sujan
|
|
|
|
|
Your call to FreeLibrary() allows the DLL to be unloaded, at which point the code and the window will disappear. Note: please use the correct <pre> tags around your code, and indentation within it, to make it readable, like this:
CRevolutionProjView *view;
CRevolutionProjView::CRevolutionProjView()
{
view = this;
}
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
you are absolutely right Richard. thanks a lot for your help. I just removed that line and it works absolutely great. Now I am freeing it OnClose() event handler. Thanks a lot.
|
|
|
|
|
Happy to help; don't forget to mark my answer as accepted.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
What does that mean, and what is the difference between just merge sort? Here is the code I use for just merge sort. How to make it BALANCED.
void Merge(int arr[], int low, int high, int mid)
{
int i, j, k, c[50];
i = low;
j = mid + 1;
k = low;
while((i <= mid) && (j <= high))
{
if(arr[i] < arr[j])
{
c[k] = arr[i];
k++;
i++;
}
else
{
c[k] = arr[j];
k++;
j++;
}
}
while(i <= mid)
{
c[k] = arr[i];
k++;
i++;
}
while(j <= high)
{
c[k] = arr[j];
k++;
j++;
}
for(i = low; i < k; i++)
{
arr[i] = c[i];
}
UpdateData(arr, high + 1);
}
void MergeSort(int arr[], int low, int high)
{
int mid;
if(low < high)
{
mid = (low + high) / 2;
MergeSort(arr, low, mid);
MergeSort(arr, mid + 1, high);
Merge(arr, low, high, mid);
SwapsCount++;
}
}
<pre lang="c++">
|
|
|
|
|
I thought I had this right, but I'm off by around 5%. I'm not really familar with using c++ to do math.
ulProgressMax = 0x2d76c718,
it should be around 762761216
dTotal = ((float)ulProgressMax / (1024*1024) );
and I get 727423606
|
|
|
|
|
I get 727.42360687255859375 when I perform 0x2D76C718 divided by (1024 * 1024)
What's the problem?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I should of phrased my question better, my bad
I learned from experience that a customer will call me and say that's not the size of the file, and start asking all kinds of questions, so I want to get it right
The raw value before I do any math or convert it down to .2 is 762758936.00000000
I was just trying to get 762.75, but I didn't convert it correctly and got 727 something.
|
|
|
|
|
jkirkerx wrote: I learned from experience that a customer will call me and say that's not the size of the file, and start asking all kinds of questions, so I want to get it right
Keep in mind that a megabyte is 10242 bytes, not 10002. You also have to take into consideration the actual size of the file vs. the number of bytes that it consumes on disk. If your customer is looking at one and you are reporting the other, ...
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 21-Nov-11 16:58pm.
|
|
|
|
|
So my calculation is correct, but I just fell into the customer category, thus asking all kinds of questions.
Could you point me someplace where I can take the lesson?
I would like to show the customer the 767 value, and keep the other value to myself. It's just for decorative purposes.
|
|
|
|