|
I *think* the API to unlock a file is called 'SetFileAttributes', but I doubt that will work here. If the system has the file open, there isn't anything you can do about it.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I need a folder / file search dialog - I am aware of CFileDialog, but this won't return folder paths, only file paths. Is there any other class which will give me this combined function ? (The folder search is often used in installation programs, so I guess something standard must exist)
Doug
|
|
|
|
|
Guys,
I've developed an application in VC++. It is a simple application, a sort of a dictionary. It searches the meaning of a word typed by a user from a text file. Ofcourse i distribute the text file with this application, otherwise it'll be of no use
I've provided the internet update facility in the application i.e the user of application can run an upgrade program that checks the new enteries in the dictionary on the internet, and download the new words added. This should be noted that the entire text file is not downloaded again. Only the new words added are downloaded and then they are just appended in the existing text file.
The text is arranged in text file with some syntax, so that my application program correctly recognizes words and their meanings.
Here is the problem, if a user of my application manually open and edit the file and disturb its syntax, then ofcourse program will not work. So, i do not want to distribute a plain text file to user. Instead i want to provide user a dll, in which this data must be present.
As such is it possible for me to append dll data as what i am doing in case of text file?? If yes, than how do i make such dll and how i represent data in that dll whether char array or what??? Is there any other alternative solution you suggest for my problem ????
|
|
|
|
|
Shamoon wrote:
Here is the problem, if a user of my application manually open and edit the file and disturb its syntax, then ofcourse program will not work. So, i do not want to distribute a plain text file to user. Instead i want to provide user a dll, in which this data must be present.
In my ipnion,I think the easiest solution is to rename your ***.txt as ***.dll.I mean,user may think the file is a dll file,but it is a text file actually.
Shamoon wrote:
As such is it possible for me to append dll data as what i am doing in case of text file?? If yes, than how do i make such dll and how i represent data in that dll whether char array or what??? Is there any other alternative solution you suggest for my problem ????
My answer is that you can program to change the True Dll file resource to complete your thoughts.
But I strongly suggest you to use my solution,I had use it in many many many project.It's my top secret )
I am I,Who is who,I am who,Who am I
|
|
|
|
|
Hi
I have been looking for a sample code for global hooks. Those I have seen seem to all be called from a MFC application and not a standard C++ using API. I thought I had it down at one stage but the dll I wrote only seemed to catch calls to itself and the calling process. Any help would be appreciated.
|
|
|
|
|
I would like my MDI application to always display open files with "courier" font.
I assume i need to change the font in Appview::OnCreate.
I am having trouble understanding how to do this. Could someone point me in the right direction?
Thanks
Kevin
|
|
|
|
|
I figured it out
|
|
|
|
|
I have never had to fully support UNICODE in my code before but I am making an effort to insure that all future code I write will work with it anyway.
I think I understand TCHAR, LPCTSTR, LPTSTR and all the _tcsxxx functions. BUT, I have a questions which I haven't been able to find an adequate answer to.
Many functions and classes use sizes in BYTEs when working with data. Examples include memcmp, memcpy, the _open, _write, _read file support functions, etc.
What is the correct way of working with these functions and UNICODE strings. My first thought is to write a macro or inline function like this:
#define _tcsbytelen(text) (_tcslen(text)*sizeof(TCHAR))
and use this whenever working with functions where BYTE length is needed. Is there a more correct way of doing this that I have overlooked?
Thanks,
Matt Gullett
PS. MFC is not an option and whatever solution I find must work with or without STL too.
|
|
|
|
|
Matt Gullett wrote:
_tcslen(text)*sizeof(TCHAR)
That is correct in some cases, such as writing the string to a file. However if you are copying the whole string including the null terminator (such as with memcpy) you need to add 1 to the length:
(1 + _tcslen(text))*sizeof(TCHAR)
--Mike--
Thing #9 to say when mad at work: "Therapy is expensive. Popping bubble plastic is cheap. You choose."
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Thanks for the response. (Love your articles)
Is 1 enough in these situations or should I really be using sizeof(TCHAR)?
Is the NULL terminator for UNICODE strings just 1 byte? Surely not?
|
|
|
|
|
Matt Gullett wrote:
(Love your articles)
Thanks
Matt Gullett wrote:
Is 1 enough in these situations or should I really be using sizeof(TCHAR)?
What you have is right. In the code I gave earlier, you aren't adding 1, you're adding 1*sizeof(TCHAR) , which is 2 in Unicode builds. The terminating zero in a Unicode string is 2 bytes, the same size as the other characters.
So if you have the Unicode string L"Bob" , the byte length is (1+_tcslen(L"Bob"))*sizeof(TCHAR) => (1+3)*2 => 8
--Mike--
Thing #9 to say when mad at work: "Therapy is expensive. Popping bubble plastic is cheap. You choose."
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
to use unicode string, u should forget words "NULL terminator".
there is no such terminator in a general unicode string.
includeh10
|
|
|
|
|
Hi all,
I have a very trivial question regarding float format.
I have the following two statements.
int a = 3.145;
printf ("%f\n", a);
As a result of printf I get 0.0000 why?
I was expecting 3.0000
Any help in this regards
best regards
/rsasalm
|
|
|
|
|
because if you tell printf that you are giving it a double (%f) then you have to give it a double. it can't perform the cast from int to double for you, because the "..." argument list mechanism that printf uses is not type-safe or even type-aware.
try printf("%f\n", (double)a);
-c
There's one easy way to prove the effectiveness of 'letting the market decide' when it comes to environmental protection. It's spelt 'S-U-V'.
--Holgate, from Plastic
|
|
|
|
|
There is no type-checking done on the extra printf() parameters. If you have %f in the format string, it's up to you to actually pass a float variable there. Since you are passing an int , all bets are off.
--Mike--
Thing #9 to say when mad at work: "Therapy is expensive. Popping bubble plastic is cheap. You choose."
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I want to implement a SMTP Gateway that scans e-mails before allowing them to enter the mail server.Does anybody know how is this implemented??
Do I hook on port 25 or Do I make a Mail realy or what??
|
|
|
|
|
i visit the site for around 3 monthes, the site becames worse and worse in the period.
see these questions and replies now, no better than funny.
if keep going in this way, the site will die soon.
includeh10
|
|
|
|
|
i don't see how the owner of the site has much control over the kinds of questions that people ask..
-c
There's one easy way to prove the effectiveness of 'letting the market decide' when it comes to environmental protection. It's spelt 'S-U-V'.
--Holgate, from Plastic
|
|
|
|
|
Two things,
There is no such thing as dumb question, providing the people have done a little bit of investigating first before asking the question.
Secondly, the question forums are only a small part of the CP experience, it is the wealth of articles and information available that make CP stand out from the rest of the crowd.
I bet you are one of the glass is half empty brigade
Michael
Fat bottomed girls
You make the rockin' world go round -- Queen
|
|
|
|
|
I visit the site everyday, I LIKE IT!
I know of no other place to find such a wealth of information.
Kevin
|
|
|
|
|
includeh10 wrote:
if keep going in this way, the site will die soon.
Here's a way to improve the site - leave. I do harbour concerns that CP is getting cliquey, but a bigger problem seems to be the influx of morons who want us to do their homework and don't want to do any work or participate in the site.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
bigger problem seems to be the influx of morons
Christian, may be it's time to check out your glasses, as you are seeing morons everywhere....;P
|
|
|
|
|
.S.Rod. wrote:
Christian, may be it's time to check out your glasses, as you are seeing morons everywhere....
*grin* you may have a point. I'm feeling a little worn out at the moment, work has just been boring, home projects seem to have stalled. But life is better today, I've been moved to the ASP.NET project. I'm stoked.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Please, i have no idea how to do it. Libjpeg is so complicated to use that iam having a troubles with it for over 2hours, imagesource library is not freeware, but i have made it.. i dont have any other idea. please i just need to convert a bmp file to jpg file, with the most short code. not even a library,just a quick code that will be able to do this, or some example of project that uses the jpeglib with compiled lib files ;(( God.., please guys, help me..
|
|
|
|
|
http://www.smalleranimals.com/jpegfile.htm
there is only one MFC usage in it and it's a CString that you can easily replace with const char *.
-c
There's one easy way to prove the effectiveness of 'letting the market decide' when it comes to environmental protection. It's spelt 'S-U-V'.
--Holgate, from Plastic
|
|
|
|
|