|
Thanks Joao
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Your welcome
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
Thanks a lot! It helped.
And thank you everyone for the help. It is really pleasant when people help you.
Alexander
|
|
|
|
|
Try GetModuleFileName
Best regards,
Alexandru Savescu
|
|
|
|
|
A friend of mine introduced me to this "trick" with the watch window. When watching an HRESULT, you can format the result to something that makes a little more sense.
Here's an example... If I have a variable HRESULT hr; and if I put hr,hr in the watch window it formats the value of hr into text.
So if the hr = 0 the watch window would read "S_OK".
Does anyone know of other cool watch window tricks like this?
TIA
Mark Donkers
A witty saying proves nothing.
-- Voltaire
|
|
|
|
|
You mean something like here:
http://msdn.microsoft.com/library/en-us/vcug98/html/_asug_symbols_for_watch_variables.asp?frame=true
don't you?
And except that, you can use for example ERR, to show last error, instead of calling GetLastError().
Martin
|
|
|
|
|
Martin,
This is perfect! Thanks a million
Mark Donkers
A witty saying proves nothing.
-- Voltaire
|
|
|
|
|
I get the following error "First-chance exception in iss.exe (KERNEL32.DLL): 0xC0000005: Access Violation." with the code below at the statement mlist.GetColumn(i, &lvc);. Could anyone tell me why, I tried a lot of things but I cannot find a cause? Below is the code:
void CAdjustHeaderColumns::SaveColumnHeadingDefaultInfo(CString mCName, CListCtrlEx &mlist)
{
CRegKey reg;
CString g_registry;
g_registry.Format("%s%s", REG_ROOTDIR, COLDIR);
CNewHeaderCtrl* pHeader = (CNewHeaderCtrl*) mlist.GetDlgItem(0);
ASSERT(pHeader);
ASSERT(mlist);
int nMaxHLen = 100;
int mCount = mlist.GetColumnCount();
CString Caption;
CString mNum;
CString mWidth;
CString mCaption;
CString mPrevCaption;
mPrevCaption = "InitialStartUp";
LV_COLUMN lvc;
// Get the Column Info and fill the HDITEM structure
HDITEM HdItem;
HdItem.mask = HDI_TEXT;
HdItem.pszText = Caption.GetBuffer(nMaxHLen);
HdItem.cchTextMax = nMaxHLen;
// Save the default column information to the registry
for (int i = 0; i < mCount; i++)
{
mNum.Format("%d", i);
pHeader->GetItem(i, &HdItem);
mlist.GetColumn(i, &lvc); <--- error occurs here
mWidth.Format("%d", mlist.GetColumnWidth(i) );
m_dpos.Format("%sHDP%d", mCName, i);
m_dwdth.Format("%sHDW%d", mCName, i);
m_dtext.Format("%sHDT%d", mCName, i);
mCaption.Format("%s", Caption);
if (mCaption == mPrevCaption)
mCaption += "2";
if (reg.Open(HKEY_CURRENT_USER, g_registry) == ERROR_SUCCESS)
{
reg.Write(m_dpos, mNum);
reg.Write(m_dwdth, mWidth);
reg.Write(m_dtext, mCaption);
mPrevCaption = mCaption;
}
}
Caption.ReleaseBuffer();
}
Thank-you
Sincerely,
RAH
|
|
|
|
|
Seems you're not setting lvc.mask to any sensible value.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That was the problem. Thank-you very much. I reviewed this code several times and it never occurred to me about the mask. I would never have found this without your help.
Thank-you
Sincerely,
RAH
|
|
|
|
|
I have set up an application made of two CFormView based Forms.
I took as an example the Enroll Database Sample provided with Visual Studio.Net.
In the firs form the user can query the Database, the records are displayed in a ListControl.
After I want that when the user doubleclick a record in the list, or press a Button "Select", in the second form he can edit and update the record selected.
The second form consists of an edit control for each field in the database.
So when the user select a record in the first form, I query the database, I put with CEdit.SetWindowText() each field in the edit controls in the second form, and if the user make any change in the second form, I Update the database.
THE PROBLEM IS:
I have two different classes CFirsForm and CSecondForm.
In the OnBnSelectClick() in the First class how I call the member variables contained in the second class m_edit1, m_edit2, etc.
The code should look like:
CDataForm *pData;
pData = new CDataForm;
pData->m_editAddress.SetWindowText("st James Street");
delete pData;
But I get a Debug Assertion Failed, winocc.cpp Line:247.
What's wrong?
Sorry my incompetence.
"Nelle cose del mondo non e' il sapere ma il volere che puo'."
|
|
|
|
|
laphijia wrote:
CDataForm *pData;
pData = new CDataForm;
pData->m_editAddress.SetWindowText("st James Street");
delete pData;
Aren't you deleteing the form too soon?
And when exactly does the error occur?
Best regards,
Alexandru Savescu
|
|
|
|
|
void CFirstForm::OnBnClickedBtnSelect()
{
// TODO: Add your control notification handler code here
CDataForm *pData;
pData = new CDataForm;
pData->GetLocalData(50);
delete pData;
}
Even if I don't delete the pointer it's just the same.
The error happens when I click the SelectButton in the FirstForm.
When I click the Select Button, it should modify the text in the edit controls in the SecondForm.
How can I achieve this?
I tried also to add a function that in the CSecondForm class, that modifies the controls, and call it, passing the parameters in the void CFirstForm::OnBnClickedBtnSelect(), but I receive the error non-static function callin a static function or viceversa.
"Nelle cose del mondo non e' il sapere ma il volere che puo'."
|
|
|
|
|
pData = new CDataForm;
pData->m_editAddress.SetWindowText("st James Street"); Altough pData is constructed when you call m_editAddress.SetWindowText on it, its underlying window does not yet exist. Try calling pData->Create(...) first.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
Altough pData is constructed when you call m_editAddress.SetWindowText on it, its underlying window does not yet exist. Try calling pData->Create(...) first.
What does this means?
How I call the Create() function, there is a tutorial or can you help me?
"Nelle cose del mondo non e' il sapere ma il volere che puo'."
|
|
|
|
|
Hello,
I have defined a pointer to a function that returns int and receives 3 doubles like this:
<pre>
typedef int ( *fptr)(double tp, double etc, double atd);
</pre>
And I have declared one function of the type above named f1.
I want to hold a map of CString and pointers to functions so I declared like this:
map <CString, fptr> MyMap;
MyMap.insert (pair <CString, fptr> ("aaa", f1); // error here
and the error is
pair<class CString,int (__cdecl*)(double,double,double)>::pair<class CString,int (__cdecl*)(double,double,double)>' : none of the 2 overloads can convert parameter 2 from type 'int (doub
le,double,double)'
Best regards,
Alexandru Savescu
|
|
|
|
|
try : MyMap.insert (pair ("aaa", &f1));
-c
Cheap oil. It's worth it!
|
|
|
|
|
Thanks it worked.
It was obvious!
Best regards,
Alexandru Savescu
|
|
|
|
|
Hi,
I'm doing something similar, but i don't have luck
<br />
typedef bool (*func)(CClient *, CPacketBase *);<br />
typedef std::map<long, func> CHandlerMap;<br />
and I declared a function called
<br />
bool CPacketHandler::prcLogin(CClient *pclt, CPacketBase *pak)<br />
{<br />
....<br />
return true;<br />
}<br />
I tried to insert the function into the map like:
<br />
m_HandlerMap.insert(CHandlerMap::value_type(1001, &prcLogin));<br />
The error I got is :
error C2276: '&' : illegal operation on bound member function expression
Error executing cl.exe.
|
|
|
|
|
The member function has to be static.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I tried, but still the same.
|
|
|
|
|
Alexpro wrote:
MyMap.insert (pair ("aaa", f1); // error here
and the error is
Be more type specific than pair(..)
Use this statement-
MyMap.insert(MyMap.value_type("aaa",f1));
HTH
Vivek
|
|
|
|
|
hi, i have a CEdit control and I want to change the default scrollbars colour. i also do not want it to have the Winxp style on windows xp, but do not know how to do this.
My control is binded to a class called ECEdit, which is derived from CEdit, I want to put the code for he scrollbar in ECEdit.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
Someone could advise a good math or 3D book , considering that my math is weak (I didn't give a damn on college) .
It have to prepare me to do full blow 3d programming and learning first the basics then the more advanced math concepts.
Anyone had read these this books ? Are they good ?
Mathematics for 3D Game Programming & Computer Graphics
3D Graphics Programming: Games and Beyond
Thanks
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
I have read 3D Graphics Programming: Games and Beyond, but i don't think that i really got anything usefull from it.
I also read the much too tiny chapter on 3D in the "black art of Java Game Programming", and it actually gives a better overall description to get you started (and it has an OOP view as opposed to the other book which uses C).
But what really helped was the tutorials in basic vector math that my girlfriend paced me through, and these links:
http://chortle.ccsu.ctstateu.edu/vectorLessons/vectorIndex.html
and
http://members.tripod.com/gamecode/tut/
The first link is the best tutorial on math that i ever saw besides my girlfriends tutorial (and you can't have her, she's MINE!).
The second link points to some implementation guides that are only helpfull when you understand the basics.
Some books tell you that "it really isn't nescessary to understand the math behind this, just use the formulas in good health", don't buy it!.
When you understand the math your'e seeing it all so much clear.
"It could have been worse, it could have been ME!"
|
|
|
|
|