|
It really depends on what framework or tools that you are using to develop your application.
If you are using MFC, then you are in luck, you can simply set the registry key that your app will store all of its settings in, then call WriteProfileString and GetProfileString from your CWinApp object to manage your settings.
If you are using any other tools there are most likely methods to help ease the trouble of saving your settings. Depending if you want to save them in an ini file you can use WritePrivateProfileString. Of If you want to save your settings in the registry you will need to open a registry key and create new settings.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Does the following function work, if UNICODE is defined and when UNICODE is not defined?
I think that the line if (c != ' ') could be a problem!
Does this line works correct in both systems (UNICODE and non UNICODE)?
(This function should remove all spaces in a string!)
const CString CSerialize::WithoutSpaces(const CString str)
{
CString strTemp;
ASSERT(strTemp.IsEmpty());
for (int n = 0; n < str.GetLength(); n++)
{
TCHAR c = str.GetAt(n);
if (c != ' ')
{
strTemp += CString(c);
}
}
return strTemp;
}
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
the ' ' will translate to a char that contains a space or 0x20, which is 32 in decimal. In order for this to work properly in Unicode, you will need to cast your ' ' to a TCHAR, which will give you this 0x0020. Here is an example:
<br />
if (c != (TCHAR)' ')<br />
{<br />
...<br />
This will basically expand the single BYTE char to a double BYTE wchar_t which is what the TCHAR is declared as when the UNICODE macro is set.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
My first guess would be to change (c != ' ') to (c != _T(' ')) so the space is treated as a wchar_t in Unicode builds.
--Mike--
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
|
|
|
|
|
You probably have a paradox where the DLL depends on the executables lib file to link properly, however the executables lib file has not yet been created because it depends on teh DLL being compiled first. If this is the problem, then I would remove the DLLs reference to the EXE until it compiles, with the exported lib file, then add the references back in and recompile the DLL.
Another thing that you could do is change your code in the DLL to call GetProcAddress for your executable and create a function pointer to the MyFunc procedure. They you would not have to worry about the linking at all.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Read in the MSDN.
I use than a def file, it helps to export "undecorated names".
|
|
|
|
|
Hi !!!
I have to display, in the 'help' menu of my App, a PDF document. I did a quick search on the Web and at www.adobe.com, hoping to find an ActiveX which would do that, but I didn't find it !
Does anyone know if the ActiveX I'm hoping to find exists ? Or if there is another way to display PDF documents ?
Thank you for your help !
Jerome
|
|
|
|
|
As I understand it, the PDF viewer is ActiveX, but only Internet Explorer can use it. I overcame this problem by using the IE ActiveX in the app and then loading the PDF file using IE.
|
|
|
|
|
|
hi friend
this kind of task solved by my collegue. please send your problem to him. his mail id is gopi@emazines.com
|
|
|
|
|
I have a CString member and want to save this member as ASCII in a file.
The problem is, that under my WinCE system the CString member is UNICODE and so each character in the member are 2 byte long.
So, how can I convert the CString member into a ASCII member (char*) and write this with the WriteFile API to a file?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
If CE has _bstr_t , then use that to convert:
_bstr_t bstr = (LPCTSTR) your_CString;<br />
LPCSTR psz = (LPCSTR) bstr;
Or if you don't have that class, use WideCharToMultiByte() .
--Mike--
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
|
|
|
|
|
Hi Michael! Thanks for your answer!
Can I also use the ATL macro T2CA ???
I don't like to use the WideCharToMultiByte() API, because when I compile the file under a NON UNICODE system I have to remove the API function.
So I would prefer a function (macro) that works on both systems (UNICODE and non UNICODE).
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Daniel S. wrote:
Can I also use the ATL macro T2CA ???
Ah yes, that's another way to do it.
--Mike--
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 Michael!
I also want to congratulate you to your tutorials about strings!
Thanks!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Hi Michael!
Can you take a look on Works under UNICODE ???
Thanks!!!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Hi Mike!
I have a question to you about the T2CA() macro! Please help!
Is it possible that the T2CA() macro deletes some characters (like ü,ä,ö,...) during the conversion?
I have a UNICODE string (CString) "Büro" (a german word) and converts it to a ANSI string to save it to a file.
The problem is that I get the following string: "Bro"
It looks like that the macro deletes the "ü" .
How does tI fix that problem? How does I convert the UNICODE to ANSI the right way, so that it doesn't deletes some characters?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Hi,
What's the equivalent of JAVA's "URLEncoder.encode" in VC++?
or is there an alternate way of encoding to be compatable with Java's "URLDecoder.decode"?
Many Thanks,
John
|
|
|
|
|
Write one! it's not hard.
1. replace any occurance of space " " with "+".
2. any character that is not A-Z a-z 0-9 - . _ is replaced with the token %XX where XX is the string hex representation of the ascii character it replaces.
Signature space for rent. Apply by email to....
|
|
|
|
|
Hi,
I've written a code which replaces characters in a string with their respective URLEncode (i.e a " " will be replaced by "+" etc..).
However the code crashes at execution.
Please help!!
Here's the code extract;
Code:
------------------------------------------------------------------------------
for(j=0;j
|
|
|
|
|
hi, I find myself easy to fall in trouble with callback functions, and want get a pan view of it, any source is appreciated.
Thanks in advance.
Extreme programming. Do the No.1
|
|
|
|
|
PCL drivers does not return scale data in the proper dmScale field of DEVMODE when I used DocumentProperties() function of MS VC++. Instead it stores the scale data in the extra bytes at the end of DEVMODE using the dmDriverExtra field. How can I get that data out for my use ? I want to display it in a separate text box in different dialog box.
Sanjay Mishra
|
|
|
|
|
hi,
I start a thread in a class' constructor and end it in the class' destructor.
This thread has a message queue which works as a headquarter to control the class' members.
My problem is, in the switch-case body, any call of members is not permitted.
My question is,
How to let the call permitted,
and any altinative is appreciated.
Thanks alot.
Extreme programming. Do the No.1
|
|
|
|
|
|
The problem (I guess) is that the thread function is a static member function of the class. Basically, you're missing information of the this parameter in the thread execution. To workaround this, pass this as the lpParameter of the thread: to make things neater, you can resort to a stub thread function that forwards to a non-static function, just like this:
class CYourClass
{
CYourClass()
{
...
CreateThread(NULL,0,thread_stub,this,0,&dwThreadId);
...
}
static DWORD WINAPI thread_stub(LPVOID arg)
{
CYourClass * p=static_cast<CYourClass *>(arg);
return p->thread();
}
DWORD thread()
{
}
...
};
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|