|
You are using undefined behavior, that is why it doesn't work.
Calling a member function through a null pointer is invalid,
so the fact that two different invalid behaviors are different
is a minor matter of compiler specific details.
To put it another way, both pieces of code are not valid C++,
and consequently the discussion of different behaviors is irrelevant,
Visual Studio 8.0 could give you completely different results (in
fact a good C++ lint program would detect this error and report it
to you.)
If it is your goal to call a class defined function without a
specific instance of the object you need to use a static member
function, viz:
class c { public: static void a(); };
main()
{
c::a();
}
|
|
|
|
|
hello,
here is a prob.
suppose i will print a document. the printer spoller collects all the datas & my program in WIN32 can trap all the datas in the spoller.
here i m getting total no of pages in one document for a particular print job.but i want the following...
1. suppose i will give 2 copies (more than 2 copies) in the
print dialog and put sufficient paper in tray than it is not giving the total no of pages to be printed. WHY /???
2. if any one knows how to calculate the total no of pages printed for a job (with single copy as well as multiple copies) than please help in this regards....
here i m taking ENUMPRINTERS & ENUMJOBS APIs for all the information .
i m getting all the spoller information in ENUMJOBS.except the no of pages ....i m testing in samsung ML-4600 PCL 6 printer.
is the page count is printer specific ? i dont think so ...
otherwise no apis should have a data like pagecount...or so..
if any one knows please try to solve this prob 7 quickly inform me ...
if any information is required from my side ,,,i will help...
regards
skpanda
|
|
|
|
|
Hi all,
i've added an item to the 'File' meun of outlook.
i can set the property 'ShortcutText' to be something like "Ctrl+Shift+M".
if i do that, i see this string near the menu item, when i open the file menu.
problem is when i press 'Ctrl+Shift+M' combination nothing happens?
what should i do?
thanks
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hai guts.,
I had an problem while indexing an mdb file with dao connection
int CTruckRecord::OpenFiles()
{
try
{
//open the database
Dccdb.Open("\\ibp-naga\\naga\\dbs\\dccclient.mdb");
//open the individual table
TruckTbl.Open("TruckRecord");
//to retrive records from the database table, you should open it
CDaoRecordset::Open(&TruckTbl);
//to set current index for table type record sets,
SetCurrentIndex("TRK_NDX");
}
catch( CDaoException* e )
{
//an exception object for DAO classes which will report error occured
//and delete it afterwards immediately. These are member functions of
//the CException class, the parent class for CDaoException
e->ReportError();
e->Delete();
return FALSE;
}
return TRUE;
}
While executing the above code. The exception handling catch an error at the line
SetCurrentIndex("TRK_NDX");
Display the error as below:
"TRK_NDX@ isn't an index in this table. look in the indexes collection of the tabledef to determine the valid index names"
Any one could say wat this line mention.
Thanx in advance.
bye.,
Shanmuga Sundar.V
|
|
|
|
|
i am student at graduate level and i have a need of projects ideas in clips (A.I).
|
|
|
|
|
A.I?
Stock trading systems,
Power switches
Router links status info
CPU branch predictions
MxN queues (M people in N lines at the register)
Traffic control sytems.
|
|
|
|
|
Do anyone know how to link a Visual C++ program to a interface which is created by Visual basic 6?
i use visual C++ to create a random letter, then i need it to be able to output in my visual basic 6's interface..
|
|
|
|
|
You could always man that massive gun named COM and aim it at your problem...
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Write your VC app as dynamic link library (DLL)
and export the function u want.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
when i compiled some program,
the output in debug show :
"You are not using the latest Platform SDK header/library "
"files. This may prevent the project from building correctly."
failed to compile it.
and the origin code is:
#ifndef WT_EXECUTEINPERSISTENTIOTHREAD
#pragma message("You are not using the latest Platform SDK header/library ")
#pragma message("files. This may prevent the project from buildingcorrectly.")
#endif
could u tell me how to solve my problem and explain what it's in?
Thank u!
Hello World!
|
|
|
|
|
|
How can I retrieve the content of MFC Active Document Server?
I create my own editor using rich textbox. The editor is also an Activex container.
I can insert one Active Document Server in the rtf documnet. After saving the file as rtf format. I can not retrieve the content of rtf file for conversion to other format.
Can any one help on this regard..
Thanks in advance.
|
|
|
|
|
How can I retrieve the content of MFC Active Document Server?
I create my own editor using rich textbox. The editor is also an Activex container.
I can insert one Active Document Server in the rtf documnet. After saving the file as rtf format. I can not retrieve the content of rtf file for conversion to other format.
Can any one help on this regard..
Thanks in advance.
|
|
|
|
|
I am exporting a function something like show below:
extern "C" DllExport const char* ActivatePlot(CString szPlot);
When I call this function from another DLL or module, the application crashes while returning from the function "ActivatePlot".
From the call-stack I found that the control is in the destructor of CString object and is trying to free the memory using FreeStore().
Can you explain whether we can use CString object in a DllExport functions? And if not, why?
|
|
|
|
|
CString uses dynamic memory allocation to store its strings. When you pass a CString object about, if it needs to re-allocate at any point, it will make use of the current heap manager to allocate the memory. If your doing this in MFC with the MFC library as a shared DLL, you should only have the one heap manager. If your not, then you will find that you are trying to de-allocate an allocation from one heap manager with an allocation from the other - which is probably the problem here. In such cases as this, can you not just pass in the szPlot as a const char * pointer? You need to avoid passing about objects that will do this.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Hi Everybody,
I have a class which is being derived from CDialog class.
class CEventDialog : public CDialog {
private:
CString m_sEventDesc;
int m_iHours;
int m_iMin;
// Other implementation has been removed from the class.
};
The deifination for DoDataExchange is as follows:
void CEventDialog::DoDataExchange(CDataExchange* pDX) {
CDialog::DoDataExchange(pDX);
DDX_Text(pDX,IDC_ADDSTRHR,this->m_iHours);
DDV_MinMaxInt(pDX,this->m_iHours,1,24);
DDX_Text(pDX,IDC_EDITDESC,this->m_sEventDesc);
DDV_MaxChars(pDX,this->m_sEventDesc,20);
DDX_Text(pDX,IDC_ADDSTRMIN,this->m_iMin);
DDV_MinMaxInt(pDX,this->m_iMin,1,59);
}
The problem which i am facing is that if i enter an invalid value for iMin data variable , the DDV_MinMaxInt function displays a message box without any message in it. How should i display the used defined message in the Message Nox which is being created by DDV_MinMaxInt function?
Regards
Dinesh
|
|
|
|
|
Have you stepped into DDV_MinMaxInt() to see why it is failing to retrieve the text?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I did that :
DDV_MinMaxInt internally calls _AfxFailMinMaxWithFormat function
AFX_STATIC void AFXAPI _AfxFailMinMaxWithFormat(CDataExchange* pDX,
long minVal, long maxVal, LPCTSTR lpszFormat, UINT nIDPrompt)
{
ASSERT(lpszFormat != NULL);
if (!pDX->m_bSaveAndValidate)
{
TRACE0("Warning: initial dialog data is out of range.\n");
return; // don't stop now
}
TCHAR szMin[32];
TCHAR szMax[32];
wsprintf(szMin, lpszFormat, minVal);
wsprintf(szMax, lpszFormat, maxVal);
CString prompt;
AfxFormatString2(prompt, nIDPrompt, szMin, szMax);
AfxMessageBox(prompt, MB_ICONEXCLAMATION, nIDPrompt);
prompt.Empty(); // exception prep
pDX->Fail();
}
The prompt variable comes out to be empty. Do I have to explicitly create a String Resource and pass that resource in one of these functions ?
Regards
Dinesh
|
|
|
|
|
So what is the value of CEventDialog::iMin , minVal , and maxVal at this point?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Hello,
You can try the following in the OnInitDialog:
CEdit* pEditControl = (CEdit*)GetDlgItem(IDC_EDIT1);
if(pEditControl)
{
pEditControl->SetLimitText(6) ;
}
Hope this works..
Regards,
Maheshwar.
|
|
|
|
|
Does STL string support unicode, if so how do i use it.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
You need to use wstring.
Mike
|
|
|
|
|
std::string is a typedef for std::basic_string<char>
The typedef for wchat_t is called std::wstring.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
I am trying to get process status information(cpu time, mem usage, etc) on all processes running on my Win XP system using C.
I have elevated the privilege of the current process to SE_DEBUG_NAME, but I get ERROR_ACCES_DENIED when I call OpenProcessToken() for the the following processes:
alg.exe
svchost.exe
svchost.exe
Task Manager reports that the user names for these processes are LOCAL SERVICE, LOCAL SERVICE, and NETWORK SERVICE respectively.
My goal is to extract the user sid from the process token so that I can display the user name like Task Manager does.
My program works for all other processes (except "idle").
1) What do I have to do to access the tokens for these processes?
It seems as if my current process is denied access to the process
token if the user name is either LOCAL SERVICE or NETWORK SERVICE.
2) How do I extract the same info for the idle process?
Thanks in advance
Daniel
|
|
|
|
|
hi,
have a dialog based application in which i would like to capture the OnKetDown event...but inspite of mapping it thru the Class Wizard ...it doesnt seem to work... what is the reason.....
Satadru.
|
|
|
|