|
Where exactly do we use function-style casts?
|
|
|
|
|
Regards,
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Or writing a book?
This episode brought to you by the number 5
|
|
|
|
|
Would you like to be a chief editor
|
|
|
|
|
As long as it doesn't require any actual work!
This episode brought to you by the number 5
|
|
|
|
|
check this[^]...
dumb boys never change i see...
|
|
|
|
|
toxcct wrote: dumb boys...
I see no reason to resort to name-calling. If you don't agree with his practices, simply press the "ignore" button.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
http://www.warpspeed.com.au/cgi-bin/inf2html.cmd?..%5Chtml%5Cbook%5CIBMVACPP%5CCPPLNG.INF+184
Though no example but made clear points of how function-style cast behaves in C++.
|
|
|
|
|
Hi : D.
I'm running XP SP2 and Visual C++ 6 SP 6. I'm very curious about why this behavior occurs. If I call this function while I'm debugging, it works!
ExitWindowsEx(EWX_POWEROFF, 0);
But if I run the debug-built or even release-built executables from my hard disk, it does't work! Why!? This is very strange. From the debbuger, the computer starts shut down procedure, but otherwise, no way.
Thank you...
|
|
|
|
|
Hm. Found my own answer in the meantime. Apparently, the VC++ IDE has administrator privileges. If you're a little program like me, check this out:
http://msdn2.microsoft.com/en-us/library/aa376868.aspx (see SE_SHUTDOWN_NAME)
http://msdn2.microsoft.com/en-us/library/aa375202.aspx
...and for a nice example...
http://msdn2.microsoft.com/en-us/library/aa376871.aspx
|
|
|
|
|
Privileges, mon ami, privileges (I suppose...)!
MSDN [^] states
To shut down or restart the system, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege. For more information, see Running with Special Privileges.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
We replied in the same time : D.
Thank you anyway! Appreciated.
|
|
|
|
|
You hadn't to read the OP.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi!
I m working on a database project in which i use CDaoDatabase class of MFC
to create the connection with a Access .mdb file by using its open()
function. and then use CDaoQueryDef class to save the query in the database.
It works well when I run my program first time for a database but if I
select the another or same Access .mdb file without closing the exe of my project it give error in its open
function. the error msg is somthing like this-> Unhandled exception in
myProject.exe(DAO360.DLL):0xc0000005:Access violation.
Pls help me to solve this problem as early as possible.
Ansh
|
|
|
|
|
Maybe try wrapping methods that can throw exceptions in try/catch blocks.
Then you can get detailed error info.
try
{
...try database open
}
catch (CDaoException *e)
{
... examine exception/error info here
e->Delete();
}
*EDIT* Besides checking for exceptions - are the string pointers you pass to Open() valid?<br />
(Thanks Steve!)
Mark
-- modified at 1:41 Friday 6th July, 2007
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
It looks like the exception was an access violation and so your code will not catch it.
Steve
|
|
|
|
|
Thanks
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
i use try wrapping method bt it unale to track the error.
Acctually wn i debug my program and track all steps then i watch that wn the open function of CDaoDatabase class is called like this->
void CDaoDatabase::Open(LPCTSTR lpszName, BOOL bExclusive,
BOOL bReadOnly, LPCTSTR lpszConnect)
{
----
----
DAO_CHECK(m_pWorkspace->m_pDAOWorkspace->OpenDatabase(
V_BSTR(&var),
COleVariant((long)bExclusive, VT_BOOL),
COleVariant((long)bReadOnly, VT_BOOL),
COleVariant(lpszConnect, VT_BSTRT),
&m_pDAODatabase));
}
and wn the function DAO_CHECK is called it through the exceptions.
Ansh
|
|
|
|
|
What are the values and contents of lpszName and lpszConnect?
Mark
This episode brought to you by the number 5
|
|
|
|
|
lpszName the path of the mdb file is displayed and the lpszConnect stores 0.
Ansh
|
|
|
|
|
aaaan wrote: and the lpszConnect stores 0
I'm not sure a NULL pointer is allowed there.
Instead of 0, try passing _T("")
Mark
This episode brought to you by the number 5
|
|
|
|
|
I have a buffer of LPBYTE type. How can I generate JPEG file from this bufer?
Mainly I need the information that must be written to the JPEG file.
|
|
|
|
|
What is the format of the data in your buffer? If it's already a JPG file you simply need to write out its contents. If it's not already a JPG you'll need to convert it. You haven't given enough information for more detailed instructions.
Steve
|
|
|
|
|
I have no JPEG image. I want to create a new JPEG image.
I have a buffer containing core data.
/// Code
LPBYTE m_pPhotoBuffer;
m_pPhotoBuffer = new BYTE[height*width*3];
memcpy(m_pPhotoBuffer,(LPBYTE)lParam, height*width*3);
////
Now I have a camera recieved data in m_pPhotoBuffer.
I want to create a fresh JPEG file from this data.
|
|
|
|
|