|
shals169 wrote:
ResetContents() didn't work .The error was that
'ResetContents' : is not a member of 'CListBox'
But your correction of the code that I had erred in worked .Thanks
Sorry there,
That should have been ResetContent()
My mistake
Here's the link to the class members for CListBox at MSDN
Cheers,
Andy
|
|
|
|
|
When should you use :: when calling certain methods;
e.g. for closing handles in a MFC application (OK Button)
::UnmapViewOfFile(m_pMsg);
::CloseHandle(m_hMap);
CloseHandle (m_hIDUMutex);
This also applies to other methods; e.g. timers
CBDialog::OnTimer(nIDEvent);
where CBDialog is my dialog class.
Are they any rules? For example should I use the following for closing the Mutex handle?
::CloseHandle (m_hIDUMutex); // Control Mutex
|
|
|
|
|
Hi,
:: is the scope resolution operator, so ultimately there is no difference between
::UnmapViewOfFile(m_pMsg) and
UnmapViewOfFile(m_pMsg)
unless you had a function called UnmapViewOfFile() in the same scope as you are calling it.
Here's the link to MSDN for you.
Hope this helps,
Andy
|
|
|
|
|
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
|
|
|
|