|
i want to paint falling down snow flowers on the screen,how to?
thanks
|
|
|
|
|
I would attempt to find a bitmap image of a snow flake first. Then I would look at some of the sample code for drawing transparent bitmaps. Check the Bitmaps and Palettes section of this site.
|
|
|
|
|
|
Hi.
I have a question about deleting a few. Here is a scenario. The program first asks the user to enter the name of a file to take to.
ostream outFile;
outFile.open(userchoice, ios::out);
With ofstream, I found that it will create the file if it cannot find it. I tried implementing "nocreate," but VC++ 6 gave me an error that there is not such function "ios::nocreate."
Anyways, the program would create the file if it cannot find it and the file would be empty or 0 byte size. Afterward, the program calculates specific data (not worth mentioning) and outputs data to the outpuf *if applicatable*. So sometimes the program writes nothing and I would a 0 byte file under the name that the user originally entered.
I would like to know if there is a way to delete a file. So in the case above, there would be a line of code to delete the file if applicable.
Thanks,
Kuphryn
|
|
|
|
|
remove
It is just a simple old C routine.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Thanks.
ofstream x;
x.open(file, ios::out);
s.remove(file); // Is this a valid syntax?
Kuphryn
|
|
|
|
|
No, it is not.
You can use :
remove(file);
or
DeleteFile(file);
if you prefer to use the Win32 API directly.
FWIW, remove() calls DeleteFile() but remove is portable.
|
|
|
|
|
remove("file") works well.
There is one weird issue. the remove() function works even when I do not include "cstdio." This is also true for a few other functions. Why? Note I do not use "namespace std." Is VC++ compiler including some libraries automatically?
Kuphryn
|
|
|
|
|
remove() is a C function prototyped in stdio.h or io.h. You can also use _unlink().
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
I have an application that requires it's own private TTF font. The font is installed using a call to AddFontResource followed by a Font change broadcast message.
The font is available for most things with the exception of Adobe PDF generator and a number of printer drivers. Epson 1290 driver is fine, as is the old LaserJet II. The newer ones don't work under Win98. Everything works fine under Win2000.
Does anyone have any ideas about a workaround that does not involve installing the font permanently.
Happy programming!!
|
|
|
|
|
maybe you should try to find an alternative printer driver under win98. if you use the printer driver that came with win98 try an original printer driver of the manufacturer and vice versa.
i had several problems with some special printer drivers, and they have been solved with printer drivers from third parties, but i can't predict anything.
have a nice one
bernhard
"There are three roads to ruin: women, gambling and technicians. The most pleasant is with women, the quickest is with gambling, but the surest is with technicians." Georges Pompidou
|
|
|
|
|
Found the problem
In the call to CreateFont you specify the font type and because font is a decorative font I set the FF_DECORATIVE. Changing it FF_DONTCARE fixed the problem.
Happy programming!!
|
|
|
|
|
Hi, Does anyone know how I can unlink the relationship between an MFC application and its document file extension?
MFC Wizard is very convient in creating a project from scratch and automatically linking its document file extension to the application, but I can't find a way to undo this extension assocation. Any computer that has my MFC program installed automatically associates the document files with the program, and I do not want this happening.
Is there a setting in my project to disable that? How can I prevent the program from launching when a user clicks on a document icon?
Thanks for your help in advance!
|
|
|
|
|
In your main .cpp file (where InitInstance is located), search for RegisterShellFileTypes(TRUE) : that's the function that does the registry associations. If the harm is already done and you want to delete the registry changes, take a look at a .reg file that the MFC wizard created and left on your project directory. There you'll find the offending key values that you'll have to remove with regedit. Good luck
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
It's working like you said. Thank you.
|
|
|
|
|
I am using an fstream to keep a debug log (text based). It works fine except that it wipes the file and starts again whenever I reload the program. How do I make it move to the end of the file and continue writing. Heres the creation code if it is of any use:
fstream stream;
stream.open("c:\\system.log", ios::out);
Any help would be much appreciated,
James Bird
spider907@hotmail.com
James Bird - birdjames@bigfoot.com
|
|
|
|
|
Use ios::out|ios::app .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you very much.
James Bird - birdjames@bigfoot.com
|
|
|
|
|
Hi guys,
One of the application I am working on at the moment needs to modify web-pages in order to insert custom OnLoad (or Window.OnLoad) Event-handlers.
My first shot was to do it solely by manually parsing the source of the web-page (i.e. load the HTML in memory and strtok() like mad...
Although this works fine in most cases it is not satisfying as some pages use JavaScript to dynamically modify the <Body> of the Document and it becomes increasingly difficult to modify the actual <Body> Tag.
After reading about MSHTML I've figured this should be a more elegant way of doing it. Unfortunately, documentation is very poor on the subject and it is not as easy as I thought it would be...
Anyway, here's my problem:
I can get hold of the Body Tag as a pointer to a IHTMLBodyElement. I can then Call get_onload() with a VT_DISPATCH variable that receives (says MSDN) "the IDispatch interface of an object with a default method that is invoked when the event occurs"
That's great but what I want to do is
1) Check if this Event-handler is my custom script
2) If it's not, replace it by my custom Event-handler.
I guess, my first question is What type of Object is this (or what can I QueryInterface() to) ?
And of course, most importantly, can I change it ?
Thanks a lot in advance,
Cheers
Pierre Heler-Caruel
|
|
|
|
|
Anyone know how to test if the checkbox in a datetime picker control on a dialog box is checked or not?
I tried something like :
if(m_dtpDelivered.IsDlgButtonChecked(0) == BST_UNCHECKED) but I don't know the id of the checkbox, as the control owns it.
Thanks,
Giles
|
|
|
|
|
I don't have the answer, but I'd suggest using Spy++ to determine the ID of the checkbox if that's all you need.
Regards,
Alvaro
|
|
|
|
|
Use DTM_GETSYSTEMTIME. If it returns GDT_NONE, then the checkbox was unchecked.
--Mike--
My really out-of-date homepage
"Not our fault we are intellectually superior to the rest of the office." -- Paul Watson in the Lounge, 12/12/2001
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Has anyone used wininet successfully to write large amounts of data...in my case...a servlet I've used the following code...
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
pServer = session.GetHttpConnection(szServerName, nPort);
CString strData = "data from a file to send to the server";
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST, szServletUrl);
pFile->SendRequestEx(strData.GetLength());
pFile->WriteString(strData);
pFile->EndRequest();
// need to get response...
I crash & burn on EndRequest()!
Thanks,
ed
'Love is an obsessive delusion that is cured by marriage.' Dr. Karl Bowman
|
|
|
|
|
Hello, the codegurus around the world.;)
Maybe, directly using WinInet API is easier to write this kind of codes.
I think that you need whil loop (or do - while loop) to check the status
of pFile->SendRequestEx(strData.GetLength()), maybe.
This is mainly because WinInet uses Syncrous(?) - like the blocking socket -
and the result of pFile->SendRequestEx(...) will not come back soon.
But, if we use Asnyrous WinInet, we get the result soon.
You also need the error checking for the main function.
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|
|
Masaaki Onishi wrote:
directly using WinInet API is easier to write this kind of codes
I found a few examples on msdn after posting this. It appears that you are correct. Also looping on write may help. After going through this and seeing the numerous other questions posted that weren't answered, I may have to abstract this out and post an article.
Thanks,
ed
'Love is an obsessive delusion that is cured by marriage.' Dr. Karl Bowman
|
|
|
|