|
i have did it. but still it gives the error
HANDLE hFile = INVALID_HANDLE_VALUE;
hFile=CreateFile ( L"c:\\FileProperty.XML" <code>
, GENERIC_READ | GENERIC_WRITE
, FILE_SHARE_READ
, NULL
, CREATE_NEW|OPEN_EXISTING <code>
, FILE_ATTRIBUTE_NORMAL
, NULL
);
if(hFile == INVALID_HANDLE_VALUE)
{
MessageBox(0,_T("File is not created"),_T("Create File"),0);
}
else
{
MessageBox(0,_T("File is created"),_T("Create File"),0);
}
|
|
|
|
|
amitmistry_petlad wrote: OPEN_EXISTING
Function will fail, if specified file does not exists.
amitmistry_petlad wrote: CREATE_NEW
Function will fail of specified file does already exists.
So use flags correctly.
|
|
|
|
|
Thanks its working now.
but i did try like c,c++.
i have read it in the ebook after your comment.
so can we not use like in c and c++ if the file exit it overwite and if not present then create automatic.
amit
|
|
|
|
|
amitmistry_petlad wrote: if the file exit it overwite and if not present then create automatic.
Use CREATE_ALWAYS then.
|
|
|
|
|
|
i have did it. but still it gives the error
HANDLE hFile = INVALID_HANDLE_VALUE;
hFile=CreateFile ( L"c:\\FileProperty.XML" <code>
, GENERIC_READ | GENERIC_WRITE
, FILE_SHARE_READ
, NULL
, CREATE_NEW|OPEN_EXISTING <code>
, FILE_ATTRIBUTE_NORMAL
, NULL
);
if(hFile == INVALID_HANDLE_VALUE)
{
MessageBox(0,_T("File is not created"),_T("Create File"),0);
}
else
{
MessageBox(0,_T("File is created"),_T("Create File"),0);
}
|
|
|
|
|
WhiteSky wrote: You must use of // not /
It is \\ and not // or /
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
yeah I think I must change position of buttons on the keyboard;P
|
|
|
|
|
Hi,
I read somewhere that its a bad idea to pass CString between threads but I wondered if it was OK if the threads were only reading the CString and not changing it.
I have a global CString initialised by the main thread at start-up but many other threads need to be able to read it while the application is running and I wonderd if this was OK.
Any help would be appreciated.
Tony
|
|
|
|
|
softwaremonkey wrote: threads were only reading
Reading should be okay. Can you guarantee that the threads will be only reading from the variable and not writing to it. Is it a const variable.
|
|
|
|
|
Thanks for the reply. I am not sure that I can make it a const variable otherwise I dont see how I could set it initially (at run time). I guess I could use a const "Get" method to return the string. That should enforce read only access.
Thanks again
|
|
|
|
|
A CString object in any form is not thread-safe.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
The same rules apply to any object shared between threads.
Reading a CString is probably safe, and probably always will be, BUT...
CString is a class, and its implementation is hidden from you. You have no way of knowing
if the underlying implementation moves the string around in memory so theoretically even read
access should be synchronized between threads.
Again, if you look at the CStringT class it's safe. The underlying implementation could change
at any time though. Probably won't, but...just something to think about before assuming all
read operations are safe on objects.
Mark
|
|
|
|
|
Hi,
I need to add animation to my splash screen. I created a dialog based application and displayed the splash screen. But how to show the animation in that splash screen..?
Thank you in advance,
Sangeetha. J
With Regards,
Sangeetha.
|
|
|
|
|
See here[^] if its helpfuls
|
|
|
|
|
Hi,
I have seen that article and based on that only i displayed the splash screen. But they have displayed the text one after another at some time interval. But i need to display some animations instead of text.. what to do..?
Thank u for the previous reply,
Sangeetha. J
With Regards,
Sangeetha.
|
|
|
|
|
Sangeetha_J wrote: But i need to display some animations instead of text..
What is the animation you are talking about? Are we expected to guess that? Is that a GIF or a Flash movie or what exactly is it?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Hi,
I need to display a GIF file.
Sangeetha. J
With Regards,
Sangeetha.
|
|
|
|
|
The following two articles are relatively simple and would be helpful to add GIF animation to your project.
CPictureExWnd[^]
CPicture[^]
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
I need to display the GIF file or any of the animation files in the Splash Screen and not over the dialog box itself.. sorry..
With Regards,
Sangeetha.
|
|
|
|
|
There is no such resource called as 'Splash Screen'. It essentially must be a window and the article shows you how to display a GIF image. Can you give me any clue of what your splash screen is? In my opinion it must be a dialog box resource, without title bar. You've either got your graphics on that dialog or you would be loading it later from your program.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Hi,
I have used the code that have been described in CSplashScreenEx : a non rectangular splash screen class with Alpha blending - By John O'Byrne.
Here the code,
CSplashScreenEx *pSplash=new CSplashScreenEx();
pSplash->Create(this,"Welcome to Caliber Infotech",0,CSS_FADE |
CSS_CENTERSCREEN | CSS_SHADOW);
pSplash->SetBitmap(IDB_SPLASH,255,0,255);
pSplash->Show();
Sleep(1500);
CAnimateCtrl* pSplashsmall = new CAnimateCtrl();
pSplashsmall -> Create(WS_VISIBLE | ACS_CENTER | ACS_TRANSPARENT, CRect(125,60,291,104), pSplash, ID_ANIMATION);
//Here the code for Opening and closing the avi files have to be inserted
pSplash->Hide();
so i am trying to use CAnimateCtrl class to accomplish the task. Now am trying to Open the avi file.
With Regards,
Sangeetha.
|
|
|
|
|
Sangeetha_J wrote: //Here the code for Opening and closing the avi files have to be inserted
avi file or a GIF? You said it was a GIF.
The class that you are using allows you to associate the splash screen with a bitmap only and not a GIF.
PS: The portion of the code you've posted has got nothing to do with your query.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Hi,
I need to display something that can be seen animated to the user. Thats why i selected CAnimateCtrl class. Since this is new to me, i didnt have any idea over, and hence i told it is GIF. Now i studied somewhat, and hence understood that metafiles, avi, and GIF all can be used. My need is, i need to display a Splash Screen with some animations. Sorry for my blabbering.
With Regards,
Sangeetha.
|
|
|
|
|
If you want to to use avi file use of CAnimateCtrl
|
|
|
|