|
Handle the WM_KEYDOWN event and check if its the tab key.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
uday kiran janaswamy wrote: ...how can i detect that the Control have moved to the Third Control.
Any Ideas with GetFocus(...) Api,
if (GetFocus() == GetDlgItem(hDlg, IDD_THIRD_CONTROL))
...
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi David,
I am very Much Thankfull to give a great idea, Thanks a Lot.
Uday kiran
|
|
|
|
|
Hello,
I wanted to start learning WIN32API. Now before that could anyone pls recommend me a good C book. I am familiar with basics of C. If I read a C++ book, would that make a difference?
Thank you
|
|
|
|
|
All new programs should be written using C++, so you should learn it first. You should learn C just to be able to read other people's code.
It is better to learn C++ first without learning Windows programming. Then when you are familiar with C++ learn Windows programming.
|
|
|
|
|
|
I don't need to start.
Perhaps you meant to reply to Revant Jain, the person asking the question.
|
|
|
|
|
Sam Hobbs wrote:
t is better to learn C++ first without learning Windows programming. Then when you are familiar with C++ learn Windows programming.
good!
<div class='ForumSig'>"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you </div>
|
|
|
|
|
I want to know its my problem or no,did you change your sig ?
|
|
|
|
|
Forget to turn HTML oN ... how are you HAMID.. sorry belated hAPPY EID
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Thanks after two hard weeks today is holiday with a cloudy weather,by the way How are you? tommarow is holiday for you
|
|
|
|
|
|
Hi all,
I am using pure c++ functions in visual studio 2005 to create a window which behaves similar to a dialog.
I have the handle to this window. Does anyone know how to load an image to this window? the image can be either a gif/bmp format???
Sunil
Sunil
|
|
|
|
|
if you're just reading BMP, you can use LoadImage.
for GIF, you'll have to use one of the many imaging toolkits that are available. (or GDI+, if you can use that in your app)
|
|
|
|
|
You can use of CImage class
|
|
|
|
|
Here is the following code part of a COM object (in Visual C++ 6.0)
<br />
CFile filXML;<br />
CFileException e;<br />
if ( !filXML.Open(strFile,CFile::modeCreate | CFile::modeWrite | CFile::typeBinary,&e ) )<br />
{<br />
TCHAR lpError[256];<br />
e.GetErrorMessage(lpError,255);<br />
CString strError;<br />
strError.Format(_T("Cannot create file '%s' Cause:%d OS error:%ld Error:'%s'"),strFile,e.m_cause,e.m_lOsError,lpError);<br />
<br />
if ( pstrError != NULL )<br />
{<br />
if ( (*pstrError) != NULL )<br />
SysFreeString(*pstrError);<br />
*pstrError = strError.AllocSysString();<br />
}<br />
<br />
*pnResult = ERR_CANNOT_CREATE_FILE;<br />
return S_OK;<br />
}<br />
<br />
This has always worked. On one installation (called by an ASP.net application) CFile::Open returns false except I get 0 for the cause and -1 for the OS error. The file name seems fine (asp.net can create a file of that name)
Any idea why?
|
|
|
|
|
This is just guess.
If its asp.net web service , it runs under user account(I cant remember its name right now), which has minimum access. May be, that user account has not access permission to file in question.
|
|
|
|
|
This is not a web service. And we have granted full write authorisation to every one on the directory which is being written onto. And we can write to it from asp.net. And if CFile:Open fails we should have something in m_Cause. And I am going mad
|
|
|
|
|
CFile::Open uses CreateFile internally, to create file on disk. This function fails in two scenario, first one is obviously failure of CreateFile API, second one is if there is problem with file path( too long ,etc.).
It uses _AfxFullPath2 for converting relative path to absolute path. Failure of this function may also be reason.
If you debug CFile::Open , these are three places from where, function is retuning FALSE .
I'm assuming, in your case, execution doesn't reach till CreateFile , as you are not getting useful information from exception object.
|
|
|
|
|
I have indeed looked at the source for CFile :: Open in the MFC (for VC98) but I do not get these 3 places where FALSE can be returned. Only 1 and after the CreateFile...
Thanks for your help but I still do not know where to look next.
|
|
|
|
|
Ooops ! I looked at VS2005. Seeing your post, I looked in to VC 6.
Did you mentioned earlier that, exception object doesn't tell you anything ?
|
|
|
|
|
It may be you are missing a share flag. An open mode and share flag (at least 1 of each) are
required.
try
if ( !filXML.Open(strFile, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary | CFile::shareDenyWrite, &e ) )
{
...
|
|
|
|
|
I have a question about typecasting incompatible types. I have two handles to objects, the handle class is a template class that functions as a smartpointer implementation.
Handle<A> ahandle(new B);
Handle<B> bhandle;
What I want is to cast from Handle<A> to Handle<B>. B derives from A and as such I can cast between them. The only problem is, I can't cast the handles directly.
I have come up with a solution involving some dirty hacking, but I am unsure if this is going to work and what it will do at runtime.
void* blankhandle = (void*)&ahandle;
Handle<B> bhandle = *(reinterpret_cast<Handle<B> >(blankhandle));
Hope anyone can shed some light on this.
WM.
What about weapons of mass-construction?
"You can always try to smash it with a wrench to fix that. It might actually work" - WillemM
|
|
|
|
|
WillemM wrote: B derives from A and as such I can cast between them
If this is truly the case then you should have no problem casting between them.
Therefore, you can use the safer dynamic_cast operator to perform the cast.
void* blankhandle = (void*)&ahandle;
Handle<B> *pBHandle = dynamic_cast<Handle<B>*>(blankhandle);
if (pBHandle)
{
Handle<B> bhandle = *pBHandle;
...
} Note I checked the return from dynamic_cast. If the object wasn't created as a B type handle
then it would fail as it should.
>
|
|
|
|
|
Cool, thanks for the information, then that trick should solve my problem quite nicely.
WM.
What about weapons of mass-construction?
"You can always try to smash it with a wrench to fix that. It might actually work" - WillemM
|
|
|
|