|
Here is answer if somebody whant in:
void CtestView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
int cxPage = pDC->GetDeviceCaps(HORZRES);
int cyPage = pDC->GetDeviceCaps(VERTRES);
Graphics g(pDC->m_hDC);
g.SetPageUnit(UnitInch);
g.DrawImage(m_pBitmap, 0, 0, cxPage/g.GetDpiX() , cyPage/g.GetDpiX() );
}
|
|
|
|
|
Hi,
In a thread function exception is occured. exception in CInternetException. while throwing exception the thread is terminated with value 0. any one help to me.
Thanks in Advance.
Have A Nice Day!
Murali.M
|
|
|
|
|
Hello!
Try using catch(...) statement to prevent system exception handling.
UINT MyThreadFunc(LPVOID pArg)
{
try {
// code which cause an exception
}
catch(...)
{
// empty or your own handling code
}
}
|
|
|
|
|
<br />
<br />
CMyClass::OnExecute()<br />
{<br />
AfxBeginThread(myThreadCaller,NULL)<br />
}<br />
<br />
UINT myThreadCaller(LPVOID p)<br />
{<br />
try<br />
{<br />
ActualFunctionThatThrowsException();<br />
}<br />
catch(..)<br />
{<br />
}<br />
}<br />
ActualFunctionThatThrowsException()<br />
{<br />
}<br />
greatest thing is to do wot others think you cant suhredayan@omniquad.com
|
|
|
|
|
Can anyone help me find what's wrong with operator() overload pls?
#include <iostream>
using namespace std;
class A
{
public:
int value;
A(int a) : value(a) {}
operator int()
{
return value;
}
void operator ++ () // prefix
{
value = value+1;
}
};
int main()
{
A a1(27);
++a1; // this works fine...
// the following does not...MSVC6 tells me "error C2064: term does not evaluate to a function"
cout << "value:" << a1() << endl;
return 0;
}
Any ideas?! Many thanks...!
Chris
|
|
|
|
|
yeah there is one idea ...
try this
cout<<"value:"<< a1.operator int()<< endl ;
> in place of ur line cout << "value:" << a1() << endl;
actually u have overloaded int() operator
Abhishek Srivastava
Software Engineer (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
I see...but how do I overload the () operator if i need to use it like this in my code:
cout << "value: " << a1() << endl;
Chris
|
|
|
|
|
operator()()
Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin
Awasu 1.2 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
|
for that purpose overload your () operator like this
// overloading () operator
int operator()()
{
return value;
}
now u can access that bracket operator
like a1()
i hope ur prob is solved now
regards
Abhishek
Abhishek Srivastava
Software Engineer (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
Solved to perfection...many thanks!
Chris
|
|
|
|
|
Christopher Spiteri wrote:
class A
{
public:
int value;
operator int()
{
return value;
}
};
Since there's only one value type operator, int, in your class A, cout will take it implicitly.
So you can write it like this:
cout << "value:" << a1 << endl;
And, operator int() is for something like this:
cout << "value:" << (int)a1 << endl;
Overloading () would be this way:
A& operator ()()
{
cout << "In operator ()\n";
return *this;
} Therefore, in main, you can write this:
int main()
{
A a1(27);
++a1;
a1();
return 0;
}
Maxwell Chen
|
|
|
|
|
I see...this was very clear - thanks a lot mate!
Chris
|
|
|
|
|
Hi guys
I need to process audio(Wave) files to remove silence at both ends or delete file if total silence.
How to remove leading and trailing silence from
an audio file of Wave format...! If there is any ready made class to be used in VC++ please give me url or advice me the way how to do it...!
Thanks in advance
Srinivas
Srinivasa Rao Madala
MIC Electronics Limited
A4,Electronic Complex
ECIL Post
Hyderabad
India
msrao@mic.co.in
|
|
|
|
|
I have already an dialog which is sizeable. Now i have a problem with this dialog. The dialog contains a ListControl. Now i want to set the size of the ListControl in proportion to the dialog when i use the maximize button.
Can anyone help me with this problem?
p.s.: it would be fine when you can explain it to me under MFC and no ATL because i don`t undersand this.
greets
J.J.
|
|
|
|
|
Use your WM_SIZE method and look at MoveWindow to resize the control based on the size of the Window you are in. You may want to capture the size of your dialog at the start of your program so you can compare the sizes.
BD
|
|
|
|
|
How about somthing like this?
[code]
// Resize the list control contained in the view to
// fill the entire view when the view's window is
// resized. CMyView is a CView derived class.
void CMyDlg::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// Resize list to fill the whole view.
if(nType == SIZE_MAXIMIZED)
m_List.MoveWindow (0, 0, cx, cy);
}
[/code]
|
|
|
|
|
Thank you for help!
Maybe you can help me by an other problem!?
I want to get and set the position/size of a ListControl do you know how dose it work?
Thank´s
J.J.
|
|
|
|
|
GetWindowRect or GetClientRect
And
MoveWindow Or SetWindowPos
|
|
|
|
|
Hi,
thak´s a lot for your help!
Now it is working fine.
J.J.
|
|
|
|
|
I´m loading various vb and mfc written Controls in a Rollout Container "http://www.codeproject.com/wtl/wtlrolldownctrl.asp[^]".
The problem is, every time I hit a button in a control the application crashes completely. The strange thing is that sliders, radio buttons etc. work properly.
The workaround I found out for this problem is to use the MS Form CommandButtons instead of the default buttens. With them my application works just fine, but I want to understand the reason for this strange behaviour.
So I would be very grateful about any helping idea...
|
|
|
|
|
Im having trouble getting the GetComputerNameEx() function to compile.
I have Visual C++ 6.0 on Windows 2000 Pro with Platform SDK installed. <windows.h> header is included and in Options -> Directories I have added the path C:\PROGRAM\MICROSOFT SDK\INCLUDE in the first position for include files and C:\PROGRAM\MICROSOFT SDK\LIB for library files. I thought this was all you needed to do ... but I still get error C2065: 'GetComputerNameEx' : undeclared identifier
Any ideas ?
Thanks in advance !
/ daniel
|
|
|
|
|
You need to set the symbol _WIN32_WINNT to 0x0500 or greater, to specifically target Win2000 or XP. If you don't do this, the declarations in winbase.h are #if'd out.
Of course, this also means your app cannot run on WinNT or Win9x/ME, unless you delayload the appropriate DLL and then test OS version at runtime.
Steve S
|
|
|
|
|
How to get "password policy requirement" for local computer, not for domain?
Can anybody help?
|
|
|
|
|
I want to start a program Using CreateProcess().What shld I pass so that compiler will search the whole computer for that executable.
|
|
|
|