|
Zdeslav Vojkovic wrote: 3. any class/type can be exception tpye, but maybe you would like to have look at the 'exception' class, which is a base class for all exeption classes in standard c++ library
To avoid confusion since he is coming from a Java background: In C++ the class does not have to derive from Exception to be thrown. Any type can by thrown.
Jared Parsons
jaredp@beanseed.org
http://jaredparsons.blogspot.com/[^]
|
|
|
|
|
Britley wrote: I started using try/catch(...) in C++, but not sure what all can be done in the catch block.
1. Anything that is holy, practically.
Britley wrote: 1. What does the elipsis (...) mean?
(...) Catch any exception that occurs
Britley :->wrote: What else can be put here?
A known exception type can be put here which has to be caught. Eg: catch(CFileException Cfe)
Britley wrote: If so, how do you define an exception class? Is there an interface that we should implement?
There are a bunch of exceptions. You will not need to implement any interface. You can use any existing exception.
Britley wrote: 4. When we have the elipsis(...) how do you get the details of the exception?
There is one API call known as GetLastError for this purpose
Britley wrote: 5. Are there simple examples anywhere that demonstrate exceptions in C++ for Java programmers
<br />
TRY<br />
{<br />
CDatabase DB;<br />
CRecordset Rc;<br />
CString szSql = "SELECT * FROM MYTABLE WHERE AGE = 20"<br />
DB.ExecuteSql(szSql);<br />
}CATCH(CDatabaseException CDbe){ AfxMessageBox(CDBE->m_error));}<br />
I believe above things are right. I a newbie too, but have worked on a database module. I am sure you will get a bunch of replies and guidance.
Aljechin Alexander
|
|
|
|
|
Aljechin wrote: Eg: catch(CFileException Cfe)
it is a bad practice to catch exceptions by value (except for integral types)
Aljechin wrote: There is one API call known as GetLastError for this purpose
it will not return details of exception. it is a Win API to retrieve last Win32 error for the current thread.
also, microsoft specific TRY/CATCH should be avoided, and standard try/catch used instead, for reasons stated here[^]
|
|
|
|
|
Hi guies,
I am new to VC++.
I have to write a code which contain connect method and which connect's
to server.
Anyone can give me that procedure,Pl'z.(which contains connect method).
yuwraj
|
|
|
|
|
http://www.codeproject.com/internet/winsockintro02.asp
never say die
|
|
|
|
|
it would help if you could be more specific in your questions, what kind of server, etc.
if you are talking about connecting through sockets, have a look at this[^] article. also, try google, it should return thousands of hits on this topic
|
|
|
|
|
|
Yuwraj wrote: I have to write a code which contain connect method and which connect's
to server.
How about NetUseAdd() or WNetAddConnection2() ?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Hi,
I want to findout whether notepad.exe is running in taskmanager or not. if i create a process to open notepad.exe then i can find process id and close it, but i am not opening notepad.exe through process.
pls help me, waiting 4 ur reply
bye
trinadh
|
|
|
|
|
Here is an example...
#include <windows.h>
#include <stdio.h>
#include "psapi.h"
void PrintProcessNameAndID( DWORD processID )
{
char szProcessName[MAX_PATH] = "unknown";
HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |
PROCESS_VM_READ,
FALSE, processID );
if (NULL != hProcess )
{
HMODULE hMod;
DWORD cbNeeded;
if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod),
&cbNeeded) )
{
GetModuleBaseName( hProcess, hMod, szProcessName,
sizeof(szProcessName) );
}
else return;
}
else return;
printf( "%s (Process ID: %u)\n", szProcessName, processID );
CloseHandle( hProcess );
}
void main( )
{
DWORD aProcesses[1024], cbNeeded, cProcesses;
unsigned int i;
if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) )
return;
cProcesses = cbNeeded / sizeof(DWORD);
for ( i = 0; i < cProcesses; i++ )
PrintProcessNameAndID( aProcesses[i] );
}
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
thanks for giving me reply,
i try this code if i get any doubt i get back to u.
bye
trinadh
|
|
|
|
|
Thanks to MSDN
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
|
Error:Cannot open include file: 'psapi.h':
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
|
For header files other than my own, I use angle brackets <> instead of quotes. In any case, does the file exist on your machine?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
My program needs to be synchronised with my data server.
I must do it into my program, in VC++ 6 (not in .NET).
I can not find any function in msdn which do it.
I've another solution,;) instead of synchronising, I need to get the system time of the server. But I can not found any function to do this.
Does someone has already realize it ?
Firejano
|
|
|
|
|
First off, what kind of data are you synchronising?
Instead of depending on the time of the server, can you not depend on the time of the content/file that you are trying to synchronise ?
-Prakash
|
|
|
|
|
I try to synchronise my computer system time, with server one.
Firejano
|
|
|
|
|
|
thanks,
with the msdos command "net time /SET /YES \\my_server" you can synvhronise computer system time with the server one
Tchao
Firejano
|
|
|
|
|
I have a task that to capture the printing spool file (might be EMF file),
I want to install my application to monitor all the printers' jobs and get all the EMF Files . Cound anyone give me the suggestions or code snippet?
How to capature all the EMF files?
Thanks
|
|
|
|
|
|
thanks very much,how can you find these useful information?
|
|
|
|
|
having the memory of an elephant (and looking like one) helps - a couple of years back I was looking for a Print Monitor, and while these werent the references I had in mind (I think in the original reference I had, 'GhostScript' figured prominently) just doing a google on "c++ print monitor" or "c++ printmon" found these ones for you ..
'g'
|
|
|
|