|
Did you try google[^] ? There's a lot of similar questions...
Check also MSDN[^] (although it might be a bit different).
|
|
|
|
|
I suspect it's because free() and malloc() are already defined in libc.lib...
|
|
|
|
|
Hi,
i have got the following questin:
I have a SDI Project with a RichTextControl and an editbox in the toolbar.
I want to pass the value in the editboc(user input) to a funktion in the document.cpp.
I want to load some data in the document and then i want to update te view with this datas.
I know how to update the view with datas coming fram the document, but i don't know the right way to pass a value from the editbox in my toolbar to the document !!!???
Here is some code :
BOOL NEW_cToolBar::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && VK_RETURN == pMsg->wParam)
{
return TRUE;
}
else if (pMsg->message == WM_KEYUP && VK_RETURN == pMsg->wParam)
{
CString chrBuf;
m_Ctrl_EDIT.GetWindowText(chrBuf);
return TRUE;
}
return false;
}
void CApplicationView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CTheReaderDoc *pDoc = GetDocument ();
CRichEditCtrl &rCtrl = GetRichEditCtrl();
rCtrl.SetWindowText (pDoc->m_cstrAusgabe);
rCtrl.SetFont(pDoc->m_ptrFont);
rCtrl.SetModify(TRUE);
}
Or is it better to pass the Value directly to the View without using a document ?
And when yes, how can I do that ?
Please help me !
Many thanx
Croc
|
|
|
|
|
You have loads of ways to do this, really, depending on your application.
What it looks like you should do is have a function in your document, eg:?
BOOL CMyDoc::UpdateSomeTextField (CString s)
{
if ( !some validation here )
return FALSE;
m_KeepString = s;
UpdateAllViews (NULL);
return TRUE;
}
and in your PreTranslateMessage function, call this member function. This will decouple your document from the toolbar, and remove the view from the equation.
Also, CFrameWnd has a function GetActiveDocument which will be a bit safer for you - and may make it easier when you move to an MDI model (if you choose).
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Hi Mr.Clarke,
thank you very much for your reply.
I added this to the document.h:
.
.
.
.
public:
CString m_KeepString;
public:
BOOL bUpdatetextField(CString);
And this in the document.cpp:
BOOL CDocumentDoc::bUpdatetextField(CString s)
{
m_KeepString = s;
UpdateAllViews(NULL);
return TRUE;
}
But how can I call the bUpdatetextFiled from my toolbar :
BOOL New_cToolBar::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && VK_RETURN == pMsg->wParam)
{
return TRUE;
}
else if (pMsg->message == WM_KEYUP && VK_RETURN == pMsg->wParam)
{
????????? function call ???????????
return TRUE;
}
return false;
}
Many many thx
best regards croc
|
|
|
|
|
Hi ;
is there really no hope
best regards
CrocodileBuck
|
|
|
|
|
Err, some of us go home, and have a life...
Try:
CMainFrame *pMF = STATIC_DOWNCAST(CMainFrame, AfxGetMainFrame ());
CMyDoc *pDoc = STATIC_DOWNCAST(CMyDoc, pMF->GetActiveDocument ());
pDoc->UpdateMyField (s);
And check the debugger as you go, as this is from memory.
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Hi Mr.Clarke,
>> Err, some of us go home, and have a life...
L*O*L yeah that's absolutely corect
Many, many, many thanx, now it will work ...
Thanx for your great help
very best regards
Croc
P.S.: Instead of AfxGetMainFrame() i have to use AfxGetMainWnd()
|
|
|
|
|
I have written a program that enumetares a USB devices connected to a PC and obtains all the interface strings. I am using SetupDI APIs
I compile the program on PC1 and everything works fine.
When I copy the executable of my program [along with all files in release dir] to a different PC, say PC2 and execute it, the program does not return any USB interface strings.
But when I compile my program on the PC2 and run it, I get all the USB interface strings
Why does this happen?
The configurations of both the PCs are same.
|
|
|
|
|
|
How so, Mike? It sounds as though the second machine indeed has Visual Studio on it.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Just a wild guess, I really had no concrete ideas from reading his post. Should I not have done that?
led mike
|
|
|
|
|
More often than not, the answer to "Why won't my VC++ application run on a machine other than the one it was compiled on?" is either the reason you stated, or the application was mistakingly compiled in debug mode. However, he indicated that both machines had VS installed. I'm still baffled.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: he indicated that both machines had VS installed.
Not all installations of VS are equal, for example a Platform SDK difference. No reason to be baffled given the lack of information we have, this thread calls for a
led mike
|
|
|
|
|
led mike wrote: Not all installations of VS are equal, for example a Platform SDK difference.
But didn't the code compile fine on both machines? If the code was using something specific to the SDK or the DDK, and one of the machines did not have that, I would expect a compile error, not a run-time error.
led mike wrote: ...given the lack of information we have...
Agreed.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Dear all
I have a set up for a multithread application that works with Sound Card and it uses Socket Connection. this set up works perfectly on a computer with these specifications:
motherboard: ASUS P4P800-MX Model
Processor: Intel Celeron CPU 2.53GHz
Memory: 512 MB , GEL brand
Hard Disk: 80GB Maxtor , IDE
Sound Card: Creative Sound Blaster 24 bit
but when mentioned setup run on another computer , this application occur many different exceptions e.g. some times some Icones hide or access violation.
second computer specifications:
Motherboard: ASUS P5GC-MX/1333 Model
processor: Intel Pentium D 2.8GHz Dual-Core Processor
Memory: 512 MB , Kingstone brand
Hard Disk: 80GB Maxtor, SATA
Sound Card: Creative Sound Blaster 24 bit
I was changed OS, RAM ,Motherboard BIOS , Power supply, Sound Card and used another VGA ... but the problems remain.
the application wrote with Delphi7 .
any body have suggestion?
|
|
|
|
|
e_yp wrote: the application wrote with Delphi7
C++ forum != delphi forum.
I know little about delphi, but I assume it will be heavily dependent on the delphi libraries being the same.
Can you compile / link your program statically, so that all the dephi stuff and your code end up in a big exe?
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Iain Clarke wrote: Can you compile / link your program statically, so that all the dephi stuff and your code end up in a big exe?
That's the default setting (or used to be).
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
I suspect the problem is in your threading code, and that you're not seeing it because you are running on a single core and the multi-threading is not being "exercised" in the same way that it is on a true SMP system like the Core Duo. More importantly few people are going to be able to help you here because your code is in Delphi, not C++, and not alot of people here are very familiar with it. Check out the Borland forums, and do some serious code review on your multi threaded code.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Hi All,
I need your help guys. I'm trying to implement a custom list box that will only have images, the images are 50 x 62 pixes 32bit. The thing is that, all the images that I want to display are all stored on single bitmap. This bitmap is quite large, has about 300 of the images and the bitmap file is loaded during the run time. I have the bitmap already loaded in memory and I use other elements from the bitmap file to draw on the screen. I know the coordinates of each image on the bitmap that I would like to load into my List box. I'm just not sure how create an Imagelist and display it in the List box.
Any help would be much appreciated!
Thank You!
|
|
|
|
|
JG53_Jaguar wrote: and I use other elements from the bitmap file to draw on the screen.
I have never done that but I would believe using that same approach you can create an image object for each one and add it to an image list.
led mike
|
|
|
|
|
that's what I have been thinking as well...might have to create a small bitmap and just dump one image into it at the time and then add it to the list before moving on to next one...
|
|
|
|
|
Why you dont use of CListCtrl?
|
|
|
|
|
I don't see CListCtrl being any different, the challenge is assigning the specific regions of the bitmap and assign it to each element in the ImageList that's the challenge for me...
modified on Tuesday, April 15, 2008 10:49 AM
|
|
|
|
|
JG53_Jaguar wrote: I don't see CListCtrl being any different
Correct, it's not.
led mike
|
|
|
|