|
Many thanks for your responce.
Sweep
|
|
|
|
|
Hi...
I wrote the following function code to perform Unicode conversion ,it works fine when I specify the string I want to convert as it shows but if I need to make it a variable ,it gives me error:
----------------------------------------------------------
void CTestDlg::OnCobe(CString x)
{
wchar_t* wsz = L"ABC";
// wchar_t* wsz = L x; --> This is give me an error
CString c,cc,x;
cc="";
for (int i=0;i <9 ;i++)
{
c.Format("%04X",wsz[i]);
if (c == "0020")
c=" ";
cc=cc+c;
}
MessageBox(cc);
}
----------------------------------------------
I tried to wrote in different way but each time I get the same error ,I searched on the internet almost all ensamples uses this form " " ...
if anyone know how to do that I will be very grateful ...
|
|
|
|
|
Try this
USES_CONVERSION;<br />
<br />
CString strTTT;<br />
wchar_t *llp = T2W(strTTT);
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
it gives me error in these 3 lines .. is there any lib need to defined ?
|
|
|
|
|
You will need
#include "atlconv.h"
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
thanx alote ... it is working now with the lib ...
thanx again for the help >>>
|
|
|
|
|
If you define _UNICODE the internal CString buffer
is already unicode data, which you can get using
GetBuffer().
If _UNICODE is not defined, you can convert the
buffer using MultiByteToWideChar.
Hope this helps!
Due Regards
Mahendra
|
|
|
|
|
|
i thought that also .. but the problem is still not fixed
|
|
|
|
|
I have a program and in InitInstance i call a dialog in which i specify a file name for creating a new file and then i create this file calling CWinApp::FileNew.I need to know this file name in My doc class, more exactly in OnNewDocument.How can I do this? I desperately need help.F1!!!!!!!!My time is very short.
|
|
|
|
|
you should be available to get it through ((CYourMainAppClassNameHere*)AfxGetApp())->your_dialog_variable_name.string_variable, and you should update string variable on every change of file name
hope it helps at least a little
|
|
|
|
|
How can i update string variable on every change of file name?
Thanks a lot.
|
|
|
|
|
Edit box in which you enter the string should have an property function OnEdit or OnChange, which is called everytime when string is changed. Override this function and inside it call UpdateData(); which should update string variable to its current status.
|
|
|
|
|
1) After you get the file name from the Dialog create the
file using CFile or whatever.
2) In your (added) OnNewDocument function call
SetPathName("<the_path_you_got_in_1>");
e.g.
BOOL CMyDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
SetPathName("c:\\temp\\a.txt"); // c:\temp\a.txt should exist!
return TRUE;
}
This will not display a Save Dialog when you select "Save"
from the File menu. If I have not misunderstood your question
this should help!
Due Regards
Mahendra
|
|
|
|
|
the other responses are correct. my understanding of your statement is you are unable to access the file name from the My Doc class. one way to do this would be
declare a variable in your CMyWinApp class and copy the value of the path into it
now you can access this variable from your doc class by using.
(CMyWinApp*)AfxGetApp()->variable
|
|
|
|
|
So you are naming the file before the app starts as opposed to when it (or the document) ends? Is there a design reason for this, or am I missing something? Normally in an SDI or MDI application, the name of the file is selected when the document is closing (i.e., if IsModified() returns non-zero).
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Yes,this is what my boss is asking.
|
|
|
|
|
I am trying to link a static lib (*.lib) build on C compiler through nmake. It give me some funny errors duing linkage time.
Do I need to call extern "C" for each of the function that I need to use?
Or any remedies or reference for this.
thank you.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
problem has been solved. It appears to be a file version problem.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Anthony_Yio wrote:
I am trying to link a static lib (*.lib) build on C compiler through nmake. It give me some funny errors duing linkage time.
What where the errors?
Michael
CP Blog [^]
|
|
|
|
|
Sorry friend, it appear to be a file version problem of mine.
Thanks you anyway.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Thanx.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
How about monitoring clipboard?
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Tried that but you get events only when someone is trying to put some data into the clipboard and not when someone is reading it.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
How about
WM_DRAWCLIPBOARD
handler?
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|