|
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
|
|
|
|
|
Name a few books and good websites to learn 3D programming in visual C++
|
|
|
|
|
It depends on which API you want to use:
if you want to use OpenGL: http://nehe.gamedev.net
book: OpenGL game programming
if you're gonna use DirectX: http://nexe.gamedev.net
i dunno any book
or r ye gonna program 3d without an API? hey anythings possible....
Kuniva
|
|
|
|
|
Hello expert C++ programmers...
I am not an expert anymore.. (or have I ever been?)
Well I program java now, but I need to do a program in C++
I have the stupidest question. I want to know how to make an array, and I have forgotten how. Could anyone plz show me.
I want to declare an array of character arrays.
char myArray[xx][xx];
but... I want to do it dynamically
something like: char myArray** = new char[xx][xx];
but that didnt work, and i cannot figure out how to do it. who better to ask than experts!?
|
|
|
|
|
Tror du är från sverige va??
Du gör så här:
// deklarera en variabel dynamiskt så här:
char* myArray = new char[4]; // 4 eller så många du vill
// sedan töm minnet
delete [] myArray;
If you didn't was a SWEDISH guy:
Declare an array dyn like this:
char* myArray = new char[4]; // 4 or how many elements you want
and then free it like this:
delete[] myArray;
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
Rickard Andersson wrote:
Declare an array dyn like this:
char* myArray = new char[4]; // 4 or how many elements you want
and then free it like this:
delete[] myArray;
Yes, I am swedish
That array is no problem to declare. The problem I have is to dynamically delcare and array of arrays. That means I want to declare an array of pointers to a array-pointer.
Declared NOT DYNAMIC, char myArray[10][20];
This will get me an array with 10 arrays each 20 long. The question is how to do it with the new operator.
>> char* myArray = new char[4]; // 4 or how many elements you want
you can declare this char myArray[4];
or char myArray[] = " ";
I am not interested in a singel array of whatever. A twodimensional array dynamically declared.
I hope I have clarified a bit
Happy Christmas, and thanks for your help
// Robert
|
|
|
|
|
char **a = new char*[20];<br><br />
for(i=0;i<=19;i++)<br />
a[i]= new char[10];
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|