|
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.
|
|
|
|
|
Hi,
refer CFileFind class. use this recursively for find files in the sub directories. sample code is in msdn.
Have A Nice Day!
Murali.M
|
|
|
|
|
Hi,
Iam new to VC++, Is there any body tell me how to capture screen and save it in .Avi.
Santosh K
|
|
|
|
|
for capturing screen imgae use
GetDesktopWindow() this will return u the handle of desktop window
then using you can get the DC of your desktop
like this
HWND Desktophwnd = GetDesktopWindow();
CWnd wnd;
wnd.Attach(Desktophwnd) ;
then query for desktop DC
CDC desktopDC = wnd.GetDC();
now using bitmap funtions of CDC class u can actually get the screen bitmap
and then for saving it into AVi u have to create Video stream and can save easily ur images in AVI file
// for creating AVI u can use library vfw32.lib
using AVI function of this libray you can create ur own AVI file by writing
AUDIO/VIDEO data in it.
like
0 AVIFileInit // for initializing AVI library
1 AVIFileOpen // for creating AVI File
2 AVIStreamCreate / for creating Audio/ video stream
3 AVIStreamWrite //for writing audio video data
5 AVIFileClose // for closing ur file
4 AVIFileExit / un initializing the library
For capturing every movement and action taking place on desktop u have to write ur whole image capturing code and saving code in a worker thread.
Regards
Abhishek Srivastava
Software Engineer (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
in the same way, is there a simple method to capture image from an avi (or mpeg, divx, etc) at a certain position, and in 'hide' mode (i.e. no screen drawing, no screen capture..). I try that with DirectX in a worker thread, but there is a crash because of bad COM initialization or release...
Thanks for ideas...
Thierry
|
|
|
|
|
Implement of asynchoronous TCP client socket(winsock2) I made the following steps to do this:
1. Create socket with help socket function
2. Select window for which generate notify message WSAAsyncSelect
3. Call connect function for this socket
Trouble: When I send data from other host(or loopback), notifycations doesn't deliver to window, but if after connect call insert recv then statement application is work, but it isn't in asyncronous mode it is clear.
Question: Is it possible to implement asyncronous(asynchronous receive) windows client socket and what I must do for this?
|
|
|
|
|
Hi,
yes you can!
I did it this way (it's a server, but it should help you):
.
.
.
SOCKET datasocket;
SOCKET listensocket;
listensocket = ::socket(AF_INET, SOCK_STREAM, 0);
if(listensocket == INVALID_SOCKET) throw runtime_error("server socket failed");
// importent port for non-blocking
unsigned long blockmode = 1; // see ioctlsocket call
if((ioctlsocket(listensocket, FIONBIO, &blockmode) == SOCKET_ERROR))
throw runtime_error("server set socket to non-blocking failed");
struct sockaddr_in local, from;
local.sin_family = AF_INET;
local.sin_addr.s_addr = INADDR_ANY;
local.sin_port = htons(clientConnectionOptions.port);
int rc;
rc = ::bind(listensocket,(struct sockaddr*)&local,sizeof(local));
if(rc != 0) throw runtime_error("server bind failed");
rc = ::listen(listensocket,2);
if(rc != 0) throw runtime_error("server listen failed");
while(!endServer)
{
int fromlen = sizeof(from);
datasocket = ::accept(listensocket, (struct sockaddr*)&from, &fromlen);
if(datasocket == SOCKET_ERROR)
{
if(WSAGetLastError() != WSAEWOULDBLOCK)
{
throw runtime_error("accept in service module failed");
}
Sleep(100);
continue;
}
if (datasocket == INVALID_SOCKET) break;// throw runtime_error("accept failed");
//datasocket is open and ready to send/recv data
.
.
.
|
|
|
|
|
Hi,
i am using thread for make httprequest for some urls timeout is occured and throwing CInternetException on that case thread is exit with 0. how to solve the problem. any one help to me. thanks in advance.
Have A Nice Day!
Murali.M
|
|
|
|
|
|
hello all,
i have "accidently" "misplaced" my license key for visual assist .net v7.1
can anyone help me?
|
|
|
|