|
Use the heap instead of the stack. Did you have a fonction using a array define on the stack like:
void myfunction(tatata)
{
DWORD data[1024]; // 1024*4 bytes allocated on the stack
DWORD *pdata = new DWORD[1024]; // 1024*4 bytes allocated on the heap
....
}
Does that help?
|
|
|
|
|
Use the debugger.
Run your program inside the debugger and before it gets to the stack overflow, open the Debug/Exceptions box and look for the "Stack Overflow" exception. Click on the "Stop always" radio button and then OK. Continue running. When the stack overflow occurs, the program will stop at the point where it's happening. That should give you a clue as to why it's happening and you can then fix it.
Good luck,
Alvaro
|
|
|
|
|
Hi there,
I'm working on webbrowser kind of application. I have a problem in open in new window part. I want to open the new link in the new frame of my mdi application. that part is done but i face the problem with popup windows. for that i need the exact dimention(height+width) of the popup window which is set in the script.
is there any way to get the exact size of the popup window?? i can get the height and widht usign get_Height and get_Width function of iwebbrowser2 interface but it doesnt give me the exact dimention all the times. in lot of popup windows it gives the wrong size.
if anybody knows the soln. pls help me out.
thanx in advance,
Paras Shah
|
|
|
|
|
I use MSWord component in my project. I create a new MSWord document with name such as "d:\temp\mydoc1.doc" from template (example mytempate.dot). This template contain a macro to insert a text into document.
It runs OK even there are some MSWord applications (instances) currently open unless "mydoc1.doc"
Please see these codes:
int ret = NO_ERR;
CString strMacroName;
CStringList argList;
strMacroName = _T("LC_WriteText");
argList.AddHead("This is a text");
ret = CallMacro(strMacroName,&argList);
........
int CExportMSWord::CallMacro(CString& strMacroName, CStringList* pArgList)
{
int bRetVal = NO_ERR;
HRESULT hr = S_OK;
ASSERT(m_pWrdDoc != NULL && m_pWrdDoc->m_lpDispatch != NULL);
OLECHAR FAR* strMacro = strMacroName.AllocSysString();
DISPID dispid;
// Error occurs here
hr = m_pWrdDoc->m_lpDispatch->GetIDsOfNames(IID_NULL, &strMacro, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
SysFreeString(strMacro);
if (FAILED(hr))
bRetVal = UNABLE_CALL_MACRO;
//Some codes....
}
Now I create a new document (mydoc2.doc) from template.dot. Initialize MSWord OK! Create new document OK.
When there is a document which was created from mytemplate.dot (mydoc1.doc) currently open, after executing CallMacro, hr = DISP_E_UNKNOWNNAME!
But if I close "mydoc1.doc", execute again, CallMacro runs OK (hr = S_OK).
Could you tell me what problem and how to fix it??
Thanks in advance
Tuy Le
|
|
|
|
|
Hi,
I'm running on a project, which reuse MS Office component, too
In fact, I still don't understand your problem, but I let you know some issues I have faced
1. The Worf instance you automated will be the same with another instance user run after your application started up, and supprise, it will be visible on screen !!!
2. In fact, Office applications is buggy when you manipulate them via automation, one of the most nasty bug I've faced is it conflict with NAV 2k
Tien,
|
|
|
|
|
Hello,
I have a problem with DLL that I can't solve. I'm working on a quite important projects, with a lot of interfaces sharing several controls.
I want to make a DLL, Project_IHM.dll, containing common parts of the interface with a CGeneric_Dlg class, inherited from CDialog_Dlg in it.
This class is exported trhough the AFX_EXT_CLASS macro.
Then, in another DLL, I create classes inheriting from CGeneric_Dlg. Everything works perfectly, except the message map. If I use
BEGIN_MESSAGE_MAP(CMyDialog_Dlg, CGeneric_Dlg),
I got the following error
unresolved external symbol "protected: static struct AFX_MSGMAP const CGeoConcept_Dlg::messageMap" (?messageMap@CGeoConcept_Dlg@@1UAFX_MSGMAP@@B)
The only way I have found is to use
BEGIN_MESSAGE_MAP(CMyDialog_Dlg, CDialog_Dlg),
and add in the message map all the message that currently exists in CGeneric_Dlg.
It works, but it is not very nice.
How can I properly export the message map of my DLL?
Stephane David
CGx
Head of aeronautical department
|
|
|
|
|
If I understand your problem correct you have one MFC extension dll from which you export CGeneric_Dlg, and another MFC extension dll where you uose CGeneric_Dlg, right? If so, this will give you problems with AFX_EXT_CLASS. It will be evaluated to __declspec(dllexport) in both dlls, also the one where you want to import CGeneric_Dlg.
The standard solution is to use your own macro, like EXPORT_CGENERIC_DLG. Define it this way:
#if defined _COMPILING_PROJECT_IHM_DLL
#define EXPORT_CGENERIC_DLG __declspec(dllexport)
#else
#define EXPORT_CGENERIC_DLG __declspec(dllimport)
#endif
class EXPORT_CGENERIC_DLG CGeneric_Dlg : public CDialog_Dlg
{
}
Put _COMPILING_PROJECT_IMH_DLL as a defined symbol in the project settings of your Project_IMH.dll project, and *dont* put it in the dll that uses CGeneric_Dlg and you should be safe home!
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
I want to develop a client-server application. In my opinion this application would consist of WinNT service and GUI client program. Please help in which way I should manage and control WinNT service program from my GUI client program and visa versa. I need not in detail explanation but show me where I can start from?
Thanks in advance
|
|
|
|
|
|
?
|
|
|
|
|
Ravi posted a link which will show you similar examples.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I see But I didn't find any answer to my question there. I need not WinNT with GUI interface, in contrary I need TWO processes. First one is a WinNT service and second one is a GUI program to manage first. Also this interacting should be double sided in order to service was be able to notify GUI program about its state. Sorry if I can mistake but I've really find not answer in topic being advised. Sorry again if I am silly At such case give me exact link please.
Thanks (and sorry) in advance
|
|
|
|
|
Hello Morozov
Well I havent had to write such an application so far. In fact I have never ever written an NT service.
But I might have to, soon.
I'd suggest this, perhaps it's a silly suggestion.
Have an admin port. Say you keep port 20000 open and the GUI client can connect to this port and send commands to the server [runnin as an NT service]. An advantage would be, now your service can be remotely controlled.
You can require authentication for connecting to this port thus making it kinda secure
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
G'Day Morozov
I used this article to get me started when I had to do the very same thing.
http://www.codeproject.com/system/cntservice.asp.
Ended up creating an NT service and a Dialog Application to control the service, modify parameters etc. The above article was a huge help - thanks PJ Naughter
|
|
|
|
|
If you make your service a COM server (which the ATL Wizard can generate), you can then get your client program to interact with the service via COM. I have used this method when both the client and server apps reside on the same machine.
Michael
|
|
|
|
|
|
I use a prog on my own computer called AOL Instant Logger to log all of my AIM messages (not the AOL prog, the AIM prog, just to avoid confusion...). Anyway, does anyone know how one would write a program such as this? I'm not sure how to make one get the data from the AIM application. Any tips would be appreciated.
~Cam (BinaryUprising.com)
|
|
|
|
|
double& Matrix::operator() (unsigned row, unsigned col)
{
if (row >= rows_ ¦¦ col >= cols_)
throw BadIndex("Matrix subscript out of bounds");
return data_[cols_*row + col];
}
double Matrix::operator() (unsigned row, unsigned col) const
{
if (row >= rows_ ¦¦ col >= cols_)
throw BadIndex("const Matrix subscript out of bounds");
return data_[cols_*row + col];
}
what differnce double& and double?
why their implement is same?
can you tell me ?thank in indvance!
|
|
|
|
|
Passing by reference means that any changes to the variable in the function effect the variable that was passed into the function, just like a pointer. Unlike a pointer, a reference is a value, not a memory address.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Ooops - I just saw where the reference is. Yes, because this variable remains in scope, it means that the variable you get back IS the variable in the array, not just the value of that variable.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
The difference is that the first version has a non-const this pointer, so the returned value is a reference to an array value. That means you can change the contents of the Matrix, such as:
void f ( Matrix& m )
{
m(2,5) = 3.14;
} But in the second, this is const, thus the return value cannot reference the object. So this code is illegal:
void g ( const Matrix& m )
{
m(4,1) = 42;
}
--Mike--
http://home.inreach.com/mdunn/
Help! Help! I'm being repressed!!
your with and
Sonork - 100.10414 AcidHelm
|
|
|
|
|
One function accepts an address of another as a parameter, I want to use a member-function of a class as the parameter, but I have this error: cannot convert parameter 1 from 'void (void)' to 'int (__cdecl *)(void)'
There's an example (MVSC++6) (Compilation gives the error)
typedef void(*fntFunc)();
class CMy
{
public:
CMy(){};
~CMy(){};
void Func();
};
void CMy::Func(){}
void CallIt(fntFunc fn)
{
fn();
}
int main(int argc, char* argv[])
{
CMy my;
CallIt(my.Func);
}
Thanks a lot. http://sjcomp.virtualave.net
|
|
|
|
|
Two issues here:- Your
Func method has to be static if you want to pass it on as a regular function pointer. Check Mike Dunn's C++ FAQ for details.
- Once you hace declared your method static, you can set its calling convention like this:
class CMy{
...
static void __cdecl Func();
};
Hope this helps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín is right.
A standard solution to this common problem is to have 2 static items: (1) a pointer to a CMy object and (2) a function of the type you expect to pass as a parameter, eg:
static CMy* pMy = NULL;
static void StaticFunc()
{
if (pMy != NULL) {
pMy->Func();
}
} Then, have a CMy object set the static pMy to "this" before you pass StaticFunc() to CallIt(), eg:
CMy my;
pMy = &my;
CallIt (&StaticFunc);
Hope this helps.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
I'm probably stating the obvious here, but my solution is slightly different from Joaquin's in that CMy's member function doesn't have to be static.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|