|
Alvaro, Thanks for your response.
I have the following situation:
Testing existence for \\Serv1\Vol1\Dir1\File1 is finished in few milli seconds if the server 'Serv1' is up and running.
But, if somebody is shutting down the Serv1 and my program tests for the existence of a file on Serv1 at the same time, it takes huge time for the 'check existence' code to return.
Under such situations, I wonder, if there is a kind of 'Asynchronous file existence checking' code which would just return immediately and fire a 'kind' of 'done' event later!!
|
|
|
|
|
Well, in that case then you need to spawn a separate thread to check the existence and somehow report back to the main thread what the result is.
Regards,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
I do not know, if it will work, but if you would try it and let us know, please:
There is function FindFirstChangeNotification() to monitor changes within file system. If you could try to monitor all posible changes, then probably you might get some results as you require.
Martin
|
|
|
|
|
how can i make a carray global.
i have tried adding it in a header but it does not like my definion.
i have tried making it extern but it again does not like my definion.
it works great within the dialog it is created in. i am using it to hold report data.
thank you.
this is how i have it created.
*******************************************
in h file
*******************************************
typedef struct{
CString a;
CString b;
CString c;
} MYCARRAYSTRUCT;
********************************************
in cpp file
********************************************
*************created global for the cpp
MYCARRAYSTRUCT mycarraystruct;
CArray<mycarraystruct,mycarraystruct> mycarray;
*************my funtion
do{
........
mycarraystruct.a = m_pSet->firstfield;
mycarraystruct.b = m_pSet->secondfield;
.....................
m_pSet->MoveNext();
}while.............
|
|
|
|
|
Put it as a public member variable of your application class.
Martin
|
|
|
|
|
that is another part of my problem. the external function that i want to use it in is another class.
|
|
|
|
|
Declare your struct just before your application class.
Declare your array as:
public:
CArray <MYCARRAYSTRUCT, MYCARRAYSTRUCT &> m_mycarray;
in your appilication class. Write function like:
CYourApp *GetApp()
{
return (CYourApp *)AfxGetApp();
}
Declare your function (where you want use m_mycarray) as
<return type> YourFunction(CArray <MYCARRAYSTRUCT, MYCARRAYSTRUCT &> & m_mycarray)
And then you can use it as:
YourFunction(GetApp()->m_mycarray);
Is it possible?
Martin
|
|
|
|
|
You must define the extern declaration on the top of the .cpp file... otherwise your cpp doesnot know about the the structure you defined globally
do it now..!
Trace The Bugs...
|
|
|
|
|
yes i did that, but i found my problem.
very stupid
in my new class i forgot to add
#include <afxtempl.h>
|
|
|
|
|
If your application is called MyDialog
Add the following structure right after the line:
#include "resource.h"
in the file MyDialog.h (Not MyDialogDlg.h):
///////////////////////////
typedef struct
{
CString a;
CString b;
CString c;
} MYCARRAYSTRUCT;
//////////////////////////
Right after the declaration of MyDialogApp() a little further down in the .h file, Add the line:
///////////////////////////
MYCARRAYSTRUCT mm_Global;
///////////////////////////
Now in your dialog's (it is now global).
Add the following line into any subroutine
///////////////////////////////////////////////////////////////////////////
MYCARRAYSTRUCT *m_GData = &( ( MyDialogApp * ) AfxGetApp() ) -> mm_Global;
///////////////////////////////////////////////////////////////////////////
The above line sets up a pointer to the global mm_Global. Now you can refer to the variables as pointer extensions ('->'). Best of all, VS's autocompletion will give you a list of variables in the structure, and if you put a comment ('//') after each declaration, it will show them in the autocompletion as well.
Be careful if you have a timer event, that you are not clobbering work. I've chased this problem from time to time.
Woo Hoo!
That's it
I hope this helps
Doug
Doug Joseph (Engineering Guy)
|
|
|
|
|
I have a dialog window with a few drop down list. When I select one it updates a var that the other drop downs use. The problem is that when I use the other drop downs after this var gets set it doesn't show the latest
ex. if it increments a var the other boxes are one behind.
How do I get the boxes to jive?
|
|
|
|
|
you might need a manual UpdateData(TRUE).
|
|
|
|
|
Had the update in already, tried two! Didn't help.
Thanks
|
|
|
|
|
Hi, I've got the following bit of code...
CString cs;
cs.Format(_T("mailto:?subject=VectorWriter files&file=\"%s\""), ftis->szSrc);
ShellExecute(lp->m_hWnd, NULL, cs, NULL, NULL, SW_SHOWNORMAL);
I want to send a file via email, "file" generates and error, does anybody know the correct switch to use?
I can't find any documentation for at all!
Many thanks,
Alan Dugdall
|
|
|
|
|
First of all you havent specified the email address. Then secondly, you can't send attachments this way.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
mailto protocol
It appears that mailto: does not support file attachments.
Like it or not, I'm right.
|
|
|
|
|
|
There's a MAPI wrapper here at CP that i'm particularly fond of; it does attachments nicely.
CMapi v1.01 - A MAPI Implementation
---Shog9---
From now on we can call C# and MC++ "The square wheel languages" -- Jack Handy, The Lounge
|
|
|
|
|
I create a MFC dialog-based application supporting automation,
add new ATL object as an interface (ITestInterface),
attempt to execute this:
CComPtr<itestinterface> pMan;
if (pMan.CoCreateInstance(__uuidof(TestInterface))!=S_OK) // fails here!
{
AfxMessageBox("Error");
return;
}
and get a failure.
Do you know what's wrong?
rechi
|
|
|
|
|
you should save the return code from CoCreateInstance, and use the Error Lookup utility to find out what the code means.
-c
The ants are my friends. They're blowing in the wind.
|
|
|
|
|
Right! The class was not registered.
But now i get a new instance of the application every time i use a new ptr to the interface. It acts like server and i don't see why it doesn't use itself as the server.
rechi
|
|
|
|
|
Not quite sure what you mean, but if you mean what I think you mean try
DECLARE_CLASSFACTORY_SINGLETON(CYourClass)
Like it or not, I'm right.
|
|
|
|
|
I did. Has no effect. Thanx anyway!
rechi
|
|
|
|
|
It sounds like it IS a server. If you want to only have one copy of the .exe running with multiple connections you have to specify it in the registration.
hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
/*REGCLS_MULTIPLEUSE*/REGCLS_MULTI_SEPARATE | REGCLS_SUSPENDED);
I thought REGCLS_MULTILEUSE (which is the wizards default) caused the app to be resused for each instance of its components. In fact, the correct option is REGCLS_MULTI_SEPARATE.
Good luck,
Bill
|
|
|
|
|
Yes, it is the server.
And no, it's not the correct option, because it keeps creating a new instance.
I think i'm gonna put the interfaces in some separated dll.
For your effort, thanx!
rechi
|
|
|
|