|
Being never seriously worked with MFC, but on general - do you have a message pump in your console app?
Do you keep the all dialog related stuff (including the message pump) in the one thread? - win32 controls are not very capable of handling MT issues.
|
|
|
|
|
Dear All,
I’m developing software using Microsoft Visual C++ 6.0 and having a problem with Remote Procedure Call (RPC). Since RPC is used as a tool to communicate between applications over networks as servers and clients, I have developed a real-time database server and also several client application programs. Both clients and servers communicate between each other through the RPC functions and services. At the beginning of a test period (around 17 days), all applications worked fine and performed their jobs very well but after that all client applications could not call some remote functions to the server. I have noticed that all clients were able to connect (bind) to the server and call some functions which implies that a listen process of the server was still exist. However, for some functions that could be called before (during the first 17 days) such as database reading functions, when called from those clients, the functions kept returning the error code: 1726 (The remote procedure call failed.). It didn’t provide much detail of that error. The specification of the server and 8 client PCs are as follows:
Server: Dell, Xeon 2.3 GHz with dual CPU, DDR Ram 1 GB, SCSI HDD Raid 5, OS Windows 2000 Server with Service Pack 4.
Clients: Acer, Pentium 4 - 2.0 GHz, DDR Ram 2 GB, OS Windows 2000 Professional with Service Pack 4.
Other Devices: 100 Mbps Switch.
I don’t know if there is any bug in the RPC run-time library of Service Pack 4. I have searched and found some Microsoft articles which report that RPC has some bugs when using with “the Cluster service” but they have been fixed already in the Service Pack 4 of Windows 2000. I would really appreciate if anyone could help solving my problem.
Thank you very much,
Nawanat
|
|
|
|
|
We have applications that use RPC and run for VERY long times (weeks and months).
I suspect you have some other problem - a memory leak, resoruce leak, or other in your system.
Perhaps you can run performance monitor on your software and check for memory usage, thread usage, GDI usage, etc. to track down the culprit. That error value from RPC is so generic in this instance, it is almost totally worthless information. Also, if you have many clients accessing a single database, perhaps you encountered a race condition - a competition for the database resources that could not be resolved.
|
|
|
|
|
hi, i've been programming in WinAPI for several years now, and somtimes I encounter MFC conversations with my mates, I ignored it coz I think I don't need it. However, I'm curious as if due to complexity I'm always encoutering with WinAPI, I sometimes wished I knew MFC, but someone told me that MFC s bloated. Most of my projects are very tight in terms of size, so I'm confused, they say that MFC is better, but bloated? while ofcourse WinAPI is really powerful (for me) however the downside is difficulties of implementing just a small function for a lot of codes. I thought MFC makes codes smaller? but why or how come that it is bloated? it is C++ anyway, right?
== rein lucien ==
|
|
|
|
|
The main advantage of MFC over WinAPI is that it's more productive, probably easier to see what's going on. But yes it may well be bloated for your requirements. However, there are alternatives (none of which I've used):
1. Qt and wxWindows which are cross-platform toolkits.
2. Windows Template Library (WTL). This was an unofficial release from Microsoft but is now open source. There are tutorials on this web site and it is highly rated, and it is I believe more elegant and less bloated than the ageing MFC.
Kevin
|
|
|
|
|
I think you also need to define your 'bloat to productivity' limits.
I mean, suppose I write a dialog app in pure WIN32 API and it takes me two weeks and it is 69K in size, and then I write a dialog app in MFC in two or three days and it is 120K in size, am I really worried it is 'twice as big' as the straight WIN32 application? Considering I am done in a fraction of the time and working on the next project already?
What I don't recall seeing is what MAKES an MFC app so 'bloated'? Linking in COM? ActiveX? Database? If you just have a few windows on the screen and a bit of data processing to go along with it, it is not 'horrible'. What might also make the MFC application seem bloated is all the DLL and other WIN32 API that get linked in to a 'generic' MFC program. It seems the memory footprint of an MFC app tends to be larger than a similar WIN32 application. If it were somehow more granular, the 'bloat factor' could probably be reduced. I think the WTL allows more granularity like this than the MFC libraries do.
If you are COMPELTELY hardcore, you could rebuild a special MFC library that did not have the extra stuff in it you did not need, and then link it into your program, you might end up with something smaller, but then consider the time involved in doing that conversion.
|
|
|
|
|
morning
I´d like to know how I can pass arrays as parameters to functions in VC++. (I´m a beginner to VC++, and have all the methods inside one class)
When I try, I get an error message saying that the array must specify __gc or __nogc. However, trying to declare the funtion like this:
bool function(__gc char array[]){return true;}
I get a msg saying that __gc can only be applied to an array !!
How should I declare the array in the firs place, and how should it be declared in the parameter list?
doneirik
|
|
|
|
|
Something like:
void function( char arr[] )
{
}
void main( void )
{
char arr[5] = {'h', 'e', 'l', 'l', 'o'};
function(arr);
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
dll doesn't know CString
what problems.
can i use directly CString?
i want to use CString::mid function.
mydll.cpp(198) : error C2065: 'CString' : undeclared identifier
|
|
|
|
|
vc-programmer- wrote:
can i use directly CString?
Yes, as long as you have correctly included the MFC header and library files.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
MFC header and library files
what i need MFC header and library..
#include "windows.h"
#include "afx.h"
i try above header files.
i can not access CString.
how can i do?
|
|
|
|
|
I would suggest using AppWizard to create an MFC DLL rather than trying to retrofit your DLL to use MFC.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
yes! i understand for your suggesting.
thank you so kind...
|
|
|
|
|
How to get the CWnd class pointer from HWND.
HWND is from other exe
|
|
|
|
|
|
|
CWnd *pTempWnd = CWnd::FromHandle(hWnd);
onwards and upwards...
|
|
|
|
|
How to get the CWnd class pointer from HWND.
HWND is from other exe
|
|
|
|
|
How to perform switch case in MFC (Not in dialog form)????
|
|
|
|
|
i'm quite sure you are not familiar with C++.
switch statements are C++ statements, so, any libraries like MLC (Microsoft), OWL (Borland) or any other understand switch s the same way...
the switch is a sort of if / else if /else statement...
so what is your question exactly ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
void CLawMaterialView::OnSelchangeType()
{
m_combo=(CComboBox *)GetDlgItem(IDC_TYPE);
m_eFruitVal = (eEnumeratedFruit)m_combo->GetCurSel();
switch (m_eFruitVal)
{
case 1:eRD;
m_combo1=(CComboBox *)GetDlgItem(IDC_COMBO2);
m_combo1->SetCurSel(0);
m_combo1->ResetContent();
m_combo1->AddString("White ceramic rod BA80");// I want it from databse NOT add one by one.
}
From above code, is it Add a new value after select the 1st combobox, BUT how to have a value in combobox is from database????
Plz advise!
Danny Gan
|
|
|
|
|
sorry but... i don't understand you question...
could you please reformulate much explicitely ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
The switch statement has nothing to do with MFC. It is a C construct.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I met a problem when writing a mfc regular dll. I want to export a funcion which create an object extending from CWnd. To my surprise, there occurs an error when calling the CWnd::createWindow()--return NULL as the window handle , however,it works very well if I directly add the class source in my project.
what should I do? Can anyone help me? Thanks very much!
|
|
|
|
|
You have two choices that work fairly well.
1. Call a function to display the window and all opeations are contained entirely within the DLL - this works well for dialogs, mostly.
2. Create the DLL as an MFC Extension DLL - the application loading the DLL should be an MFC application. Then you can export the entire class and use it within the application just fine.
Anything else is mixing the models MFC was designed for and will result in strange problems now and in the future.
|
|
|
|