|
OK. Not sure what to do at this point. Implementing COM for this seems an awful lot of work for such a simple task. Any good pointers where to get started?
|
|
|
|
|
That's going to depend a lot on what you know and what your requirements are.
On one hand if it works leave it be. On the other it does sound like a temporary solution so perhaps try some separate experiments with COM, ATL makes this easy, to see if you can find a replacement architecture that you're happy with.
If you want to avoid COM give Socket comms a try, there's loads of examples available. This has the added advantage that you can transparently run your application on the same or a separate machine. Either way CP is probably going to be the best place to find examples. If you've managed to write your own shared memory exchange system that works you'll have nothing to fear from either of these approaches and probably don't need advice from me.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Well, it is a commercial app, so I'd rather not do anything dangerous I have been banging my head against the limitations of Crystal Reports for the last 10 years And we do some pretty cool stuff, manipulating the innards of the reports ar runtime, using the CR apis. The New CR apis are all COM anyway so I had to learn those.
I found a good, two-part article on COM here and I am currently reading it. It might be that implementing a small COM server in my app might be worth the peace of mind here.
App and report will always be on the same machine so.. Also, COM feels quite logical as it is just a (synchronous) function call.
|
|
|
|
|
It is better that the dll has its own data, and the dll makes it own copies of the data. Preprocess the data in the App and THAN call the dll to finish the job.
Try to develop a data model which is clearly structered!! A clear structure helps you to develop good code and debug it easy.
Ask a friend/colegue for a half hour to discuss it. This is really worth it.
Greetings from Germany
|
|
|
|
|
I am discussing it, here
Problem is that there are aspects of the data model that I cannot control since I do not have access to the Crystal Reports sources. The crystal reports viewer is for all intents and purposes a black box. Only way to extend it is to create a custom DLL that gets registered with Crystal and called at runtime.
So, preprocessing in the app is really what I do, let me elaborate. The functions I need are along the lines of "workdays", input in the report is two dates. The result is not just a range, but it must take into account the employee-specific calendar.
Alternatively could I duplicate this logic in the DLL, but then again would I have to have a separate Db connection (with a separate login) for the report.
So when I call "Arbetsdagar(date,date) from within my crystal report definition, crystal calls the DLL and it is just a wrapper that calls the real function in the app.
|
|
|
|
|
Hi
I'm facing some problem in standard MFC application. In my application, I'm able to run only 3 instances of my application simultaneously.That is, I'm able to open only three login screens at the same time, but I dont want this limitaton. I'm currently working in Windows XP. However, when I ran my application in Windows NT, only 4 instances can ber run at a time. When I tried to open it fourth time in Windows XP, it gets crashed at the following line of code.
//winfrm.cpp
BOOL CFrameWnd::Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName,
DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd,
LPCTSTR lpszMenuName,
DWORD dwExStyle,
CCreateContext* pContext)
{
HMENU hMenu = NULL;
if (lpszMenuName != NULL)
{
// load in a menu that will get destroyed when window gets destroyed
HINSTANCE hInst = AfxFindResourceHandle(lpszMenuName, RT_MENU);
if ((hMenu = ::LoadMenu(hInst, lpszMenuName)) == NULL)
{
TRACE(traceAppMsg, 0, "Warning: failed to load menu for CFrameWnd.\n");
PostNcDestroy(); // perhaps delete the C++ object
return FALSE;
}}
m_strTitle = lpszWindowName; // save title for later
if (!CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle,
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
pParentWnd->GetSafeHwnd(), hMenu, (LPVOID)pContext))
{
TRACE(traceAppMsg, 0, "Warning: failed to create CFrameWnd.\n");
if (hMenu != NULL)
DestroyMenu(hMenu);
return FALSE;
}
return TRUE;
}
Hi,
Can you please suggest me how to ensure if this much objects are successfully created?
I have the following thing in my code:
//Inside ::InitInstance
if (pDocTemplate = new CMultiDocTemplate(IDR_mdiflsTYPE,
RUNTIME_CLASS(CmdiflsDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CmdiflsView) ) != NULL)
cout<<"Successful"
else
cout<<"Failure"
I have such 140 CMULTIDOCTEMPLATE (using new) objects and I got 140 message: "Successful".
Comments from another person:-
If you call the constructor so many times, without freeing, then you probably reach a maximum space of Windows handles, if the constructor loads menu and other resources. That’s why next resource-allocation functions fails. Can you confirm that you really create and keep so many objects?
Is there any better way to ensure if it is a resource allocation/ storage limitation problem? If yes. how can I overcome this?
Thanks in advance!
Chirag Kalra
|
|
|
|
|
Chirag_kalra wrote: if ((hMenu = ::LoadMenu(hInst, lpszMenuName)) == NULL)
can you tell me the error code generated at this time( put @err,hr in watch window of the msdev to get the error string)
Also after the 4th instance is crached, are you able to start other window based applications?
|
|
|
|
|
Thanks for u r response
How to put the error code...Can u explain me in detail.
and Yes I am able to start any other application except mine..
Chirag Kalra
|
|
|
|
|
Chirag_kalra wrote: How to put the error code...Can u explain me in detail.
Actually when the fourth instance is started, your application is crashing or LoadMenu just return the failure?
If it is failing, put a breakpoint in the "TRACE(traceAppMsg, 0, "Warning: failed to load menu for CFrameWnd.\n");" statement and when breakpoint hits, take the watch window in the msdev and put "@err,hr" in it. This will display any error strings if any. And let me know the result.
|
|
|
|
|
Mine application is not crashing.When I run the 4th instance, It is not able to show login screen while the other 3 login screens are visible.
When I debugged then I found the above mentioned line of code due to which it is failing.
I put @err,hr in my watch and found S_OK when I run 4th instance.
Chirag Kalra
|
|
|
|
|
Chirag_kalra wrote: @err,hr in my watch and found S_OK
|
|
|
|
|
Hello all masters
I use \\systemname\\C$ to access other systems C: drive
Then I will ask for username and password I enter right username and password
But it will popup the same username and password window
But should I do please suggest me
Thanks all superiors
|
|
|
|
|
Using the defualt share represented by C$ is not recommended. It also does not work on a lot of pre WinXP systems. If you want to access this C drive as a share I recommend sharing it explicitly by creating a new share. You can then set the permissions exactly as they should be and you will get access.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
thanks sir
please suggest me other way to do this if anyother
actually this is project work and i have tried a lot
but not succedded please tell me
thanks
|
|
|
|
|
and one more thing sir
i dont use other system and both systems has windows XP
|
|
|
|
|
If you are using the correct user name and password but don't have access to change the configuration of the other system then you are probably out of luck, it is misconfigured or is set up to block you out. The solution is administrative rather than programming. You will need access to or reconfiguration of the other system. Good luck.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
thanks for ur corporation sir
|
|
|
|
|
p_ wrote: \\systemname\\C$
are you typing it like this ?
it should be either \\UNCName\C$ or if within a string in your code :
"\\\\UNCName\\C$"
|
|
|
|
|
Hi all,
I don't know how far my question is obvious to you.
Say I have few functions, and they return different types of values. I want to use them inside an other single function. How should I do that. Any clue.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Could you show an example ( not required to use correct syntax )
Because i don't really understand your question, sorry
|
|
|
|
|
I hope and may I give a wrong explanation. I'll try to give an example. Here it is.
Say I have following functions.
<br />
void functionOne(int x, int y)<br />
{<br />
}<br />
<br />
void functionTwo()<br />
{<br />
}<br />
Now what I want to do is, use those calculated values inside another function for another process.
<br />
void mainCal(int i, int j, double k)<br />
{<br />
}<br />
I think now my question is clear to you
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hmm. Since this is a C++ forum I am going to assume you are using C++. Here's one way of doing it:
void functionOne( int x, int y, int& a, int& b )
{
}
void functionTwo( double& dd )
{
}
void mainCal( int i, int j, double k )
{
functionOne( 1, 2, i, j );
functionTwo( k );
} The key thing to note here is that a , b and dd are passed by reference to functionOne and functionTwo .
-- modified at 4:34 Monday 12th November, 2007
Fixed typo where only 2 params where supplied to functionOne when it expects 4.
|
|
|
|
|
That's make sense to me, thanks.
But I have one question. I want to use x, y and dd inside the mainCal(). here,
gleat wrote: void functionOne( int x, int y, int& a, int& b )
{
// do some work and initialize "a" and "b"
}
you have use two reference, and that's clear to me. Then I want to call mainCal() there and send x and y. So what you have done here,
gleat wrote: void mainCal( int i, int j, double k )
{
functionOne( i, j );
functionTwo( k );
}
is not clear for me....
I appreciate your help all the time...
Eranga
|
|
|
|
|
Sorry. My bad! I assumed that x and y were inputs to functionOne and then forgot to supply those parameters when calling it! If you do not have any other input arguments you can drop those, i.e., you could something like this:
void functionOne( int& a, int& b )
{
}
void functionTwo( double& dd )
{
}
void mainCal( int i, int j, double k )
{
functionOne( i, j );
functionTwo( k );
}
|
|
|
|
|
But pal, I've confusing on this also
gleat wrote: functionOne( i, j );
Can't I call the mainCal() inside the functionOne() as, mainCal(a, b)
I appreciate your help all the time...
Eranga
|
|
|
|
|