|
#define CHECK1(x, args) if (!(x)) { printf(args); }
BTW, i have a question. why do you want to do such a thing ? to print only in debug ?
if so, you could do a better design, like this :
#if defined(DEBUG) ||defined(_DEBUG)
#define DBG_PRINT printf
#else
#define int DBG_PRINT(const char*, ...) { return 0; }
#endif
this way, you can place some DBG_PRINT("whatever"); in you code ; it will be executed only in debug mode compilation.
-- modified at 5:38 Tuesday 25th July, 2006
|
|
|
|
|
#define CHECK1(x, args) if (!(x)) { printf(args); }
How do I pass multiple arguments, e.g. I want printf("%i %i", a, b);
#if defined(DEBUG) ||defined(_DEBUG)
#define DBG_PRINT printf
#else
#define int DBG_PRINT(const char*, ...) { return 0; }
#endif
This does not compile under VC6:->
ARSALAN MALIK
|
|
|
|
|
Arsalan Malik wrote: This does not compile under VC6
yes i made a mistake. remove the #define leading on the #else case...
|
|
|
|
|
|
Michael Dunn wrote: VC 6 doesn't support that feature
What about VC 7 ?
nave
|
|
|
|
|
controlling parallel port in windows xp sp2,how can i input/output data from/to parallel port?
i had used inpout32.dll from beyondlogic.com but it is not success.help me!
|
|
|
|
|
See Here[^] maybe it is some helpful to you
|
|
|
|
|
Dear Sirs;
How can I change the backgroung color Of FormView ?
I learn My self
|
|
|
|
|
overide the WM_CTLCOLOR message. and write the following code there
HBRUSH CTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
if( nCtlColor == CTLCOLOR_DLG)<br />
{<br />
return (HBRUSH)::GetStockObject( BLACK_BRUSH );<br />
} <br />
<br />
return hbr;<br />
}
nave
|
|
|
|
|
Thanks for your suggestion, It's work.
But how can I have My owner color( like yellow)?
|
|
|
|
|
mikobi wrote: But how can I have My owner color( like yellow)?
like this
HBRUSH CTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if( nCtlColor == CTLCOLOR_DLG)
{
static CBrush MyBrush;
if( !MyBrush.m_hObject )
{
MyBrush.CreateSolidBrush( RGB(RGB(255,255,0)));
}
return MyBrush;
}
return hbr;
}
it better if u change MyBrush as member varaiable of that class
nave
|
|
|
|
|
WM_ERASEBKGND or WM_PAINT or WM_CTLCOLOR
whitesky
|
|
|
|
|
i am tryng to move a rectangle placed in CStatic object, the CStatic object is in a child window of the application.every time i move (on LButton Up)the rect it goes out of the CStatic object and goes to the corner of the client screen. I want it to remain within that CStatic object(rectangle)but it just flies out please help me. currently i m moving it with the help of SetWindowPos();
Should i get the coordinates of the CStatic object, then what???
|
|
|
|
|
give the SWP_NOSIZE flag while caling SetWindowPos(..). The width and height will be maintained if u metion that one.
nave
|
|
|
|
|
You can use also from MoveWindow for move
|
|
|
|
|
hi,
my application do not use any activeX ocx( and written on vs 6.0 mfc), and I wish to make an installer package.
So, which files I have to include within this package ??
thanks.
meTin.eRGoktas
|
|
|
|
|
if ur application was made in release mode, U need to give only the exe.
Copy the exe to another commputer and use Dependency walker to find any other dlls wanted.
nave
|
|
|
|
|
|
Can anybody help me
#sankar#
|
|
|
|
|
if you search in codeproject you can find your answer because i saw your answer in codeproject,but im sorry idont know its name
whitesky
|
|
|
|
|
Hi,
Is that possible to get a pointer of a class at the runtime and of course to have access to it's memeber variables ?
I need this to access the member as well as the methods of the class from a callback function.
using the following method does not seems to work :
callback.m_pDlg = (CLiveUpdateConnectionDlg*) RUNTIME_CLASS( CLiveUpdateConnectionDlg );
callback.m_pDlg->PrintMessage();
Regards,
George
sdancer75
|
|
|
|
|
You need to have an instance of the class to be able to have its address. In your example, RUNTIME_CLASS is used to get informations about the class (and not a specific instance !) of the class. It returns a structure containing info about your class (its name, the size, ...)
There should be another way to get the object you try to access. If you could describe the situation you have more in detail, that could help a lot.
|
|
|
|
|
Thanks for your answer.
I am trying to get the OnProgress status using URLDownloadToFile. For this, I need a callback for the IBindStatusCallback interface. So, I created a thread AfxBeginThread ( downloadFile, this, THREAD_PRIORITY_NORMAL, 0, 0) that just calls the WorkerThreadProc.
UINT downloadFile(void* pv)
{
CWebUpdate* pDlg = (CWebUpdate*) pv;
pDlg->WorkerThreadProc();
return 0;
}
void CWebUpdate::WorkerThreadProc()
{
CCallback callback;
//callback.m_pDlg = ((CLiveUpdateApp*)AfxGetApp())->pTargetDlg;
callback.m_pDlg = (CLiveUpdateConnectionDlg*) RUNTIME_CLASS(CLiveUpdateConnectionDlg);
dloadResult = URLDownloadToFile(NULL, remoteFile, localFile, NULL, &callback);
//at this point the program fails to call the OnProgressUpdate which is located to a
specific Dialog.
}
The &callback is the IBindStatusCallback which calls the the Specific Dialog (which i need the instance address) to update the progress bar.
Regards,
sdancer75
|
|
|
|
|
Hi all,
Where can i get MFC interview questions and answers...
Manju
|
|
|
|
|
Here's one
What is MFC?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|