|
Hello,
I'd like to create a simple exe file with evc++, that when run, will Delete a certain folder / file in the ppc root directory. Can someone help me with this?
Would also like for it to work on both 2330 and WM5 devices.
Thank you in advance!
ZapMe1
|
|
|
|
|
use DeleteFile() API or SHFileOperation Function, both are supported under windows ce.
Good Luck,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Thank you for the fast reply, Mohammad. I actually would like to delete a subfolder that will contain 1-3 files.
I'm sorry, I'm very new at this. Can you please give me an example?
Thank you!
ZapMe1
|
|
|
|
|
lets assume that ur subfolder is named '\\MyFolder':
WIN32_FIND_DATA fd;<br />
CString MyFolder =_T("\\MyFolder\\");<br />
HANDLE hFile = FindFirstFile(MyFolder +_T("*.*")), &fd);<br />
while(hFile != INVALID_HANDLE_VALUE)<br />
{<br />
if(!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{<br />
DeleteFile(MyFolder + fd.cFileName);<br />
}<br />
<br />
hFile = FindNextFile(hFile, &fd);<br />
<br />
}<br />
<br />
FindClose(hFile);
I did not test the code, but it gives the idea..
Good Luck,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Thank you for that Mohammad, but not having luck getting to compile.
ZapMe1
|
|
|
|
|
Ok I know that there are a couple of ways to convert a unicode string to ascii, however I need to read from UNICODE file necessary info then convert it to ASCII and write it to a normal .log file.
I believe that when i do the following:
while(!file_in.eof()) <br />
{<br />
file_in.getline(str,2000);<br />
file_out << "\n" << str;<br />
}<br />
file_out << endl;
I know i need to do my conversion from UNICODE to ASCII within the while loop... but i believe that will cause an issue since getline() will try to do it's own conversion when reading from UNICODE file...
I believe i need to do is read in UNICODE from UNICODE file and store it within UNICODE variable. Then convert it to ASCII and then write it normally...
|
|
|
|
|
You must load the UNICODE text file into UNICODE strings:
<br />
wchar_t str[2000];
Then you need to load the UNICODE text from the file. I am not sure if the STL libraries handle this correctly...? I know they don't handle unicode filenames, but that's another topic.
After you load it, then you need to convert this to ANSI
<br />
USES_CONVERSION;<br />
file_out << "\n" << W2CA(str);<br />
Unfortunately, you'll run into a snag. The STL libraries are lame at handling unicode text in files. I take it you don't control these files -- I'd write them as UTF-8 format if I could. So much nicer...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
I wouldn't attempt doing this line by line, those conversion functions can be a real system hog sometimes. In your situation I would read the entire file into a buffer first, the convert it all in one swoop.
|
|
|
|
|
I wrote an article[^] that talks about this kind of thing.
As another poster said, the best thing would probably be to read it as binary data into a buffer and convert it from there.
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2.3 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
|
In every file in my large project, when I attempt to create a Release Version, I get the following error:
fatal error C1853: 'Release/ios.pch' is not a precompiled header file created with this compiler.
Clicking on this error goes back and points to the StdAfx.h (the first header file in every .CPP)
I searched your database but did not find this particular problem. Can anyone tell me what's going on, or tell me where to look to figure this out. BTW, the Debug version has no errors and no warnings (warnings set to level 4).
Thanks for your time.
John P.
|
|
|
|
|
Does your project have any .c files? Have you tried removing the .pch file and doing a Rebuild All?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
No, I don't have any 'C' files. I did a rebuild all and now it's complaining that it can't find include files that it could find in Debug mode? That makes a lot of Microsoft sense!
Thanks for the assistance, David. I'm going to'import' these files into the project just to make sure.
John P.
|
|
|
|
|
|
Main window of my SDI application generates a modless dialog which can be displayed and hide using menu options in parent window. this modeless dialog on certain options also generates a modal dialog, now when the modal dialog is active and i hide its parent ie modeless dialog from main sdi window only the parent modeless dialog hides whereas modal dialog remanis visible and doesnot hides. since it is child of modeless dialog it should also hide but it wont.
|
|
|
|
|
When the modeless dialog is hidden, hide the modal dialog.
There is a message ( WM_SHOWWINDOW ) that tells you a window is shown or hidden.
|
|
|
|
|
|
Hello All,
We are upgrading our server from NT to Windows 2000 or 2003. We have following components running on that server.
1) Citrix Servers.
2) Shared Memory running as Windows service.
3) Our Application.
Application is configured to run as components of Citrix servers. Our application uses IPC calls like OpenFileMapping to Windows Service in order to access shared Memory address. In NT when the Citrix client connects with anyomous user to server which was able to access the windows services which was running with different user id which contain shared memory data. But in windows 2000/2003 application is not working as similar to Windows NT. It clearly indicate it is just permission issue. Can anyone help me to resolve this issue. We are using Windows SDK functions for creating Shared Memory files.
Thanks,
Renga.
|
|
|
|
|
hi,
I want to determine the associated program with a file extension, I am targeting windows ce
I want to do this in two ways:
1. I want to know program name (for mp3: 'Windows Media Player')
2. Program path. (for mp3: 'c:\program files\...\mediaplayer.exe')
I want to use these information to create an 'open with' dialog box for windows ce.
are there any shell functions or should I read directly from the registry??
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
What about FindExecutable() or AssocQueryString() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Sorry David, but neither of these two functions is supported under windows ce!!
any other ideas?
Thanks
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Hi
I am a newbie to programming and would like to ask a question regarding the debugger. Sometimes when I step into a function the assembler comes up. Why is this? And how do I get around it quickly? I find that by stepping out many many times eventually takes me back to the code where the assembler 1st appeared. Thank you for any information.
|
|
|
|
|
Here is how in general a debugger workds: When you build your application in debug mode the executables and/or dlls (or other library files) contain a lot of extra information on top of the actual code. That information are like hyper links to the source C code. Imagine like saying "the following ten assembly commands are in that line of that cpp file". The debuger, in order to display you the source code, it needs the extra 'debug' information and access to the cpp source file.
When the debuger cannot find the source code it displays what it runs in assembly. If you are an assembly guru you might be able to debug the application with that. The usual reasons that goes to assembly are:
i. The application or parts of it are not build in debug mode. Thus, the debuger has no clue where the source is.
ii. The function you step in belongs to the compiler libraries. No company will give you the source C code of them so stepping into them means you go into assembly.
iii. You haven't informed your debuger where the C source code is. Perhaps that has to do with the project settings etc.
|
|
|
|
|
Thanks for the information on why the assembler pops up. I was also wondering on how to exit out of it? I mentioned before that I could step out many many times and eventually it will return to the src code. I was wondering if there is a quicker methods than this? Am I right in saying that you can step out and then immediately close the assembler to return to the src code?
Thanks for your time.
|
|
|
|
|
Well by pressing Shift-F11 returns to the caller. I found the usually this works.
Another trick is to use the variables debug window. The context list box contains the stack of the functions. You can see where in the code are you in any depth. Select the level that you 're interested and put a break point immediately after the current step. Then press F5 (run into cursor) to bring you there.
However, the best way is to know where not to step into. If your application is propery build in debug mode try not to step into functions that you do not recognise and especially those that they are known library functions (like printf, calloc etc.) Note that for some MFC classes/functions microsoft provides the source codeto assist you seeing the bug. You will know that by the name of the file that the debuger opens.
|
|
|
|