|
Google '3ds model loader'. L u n a t i c F r i n g e
|
|
|
|
|
The enter key is not recognized at all, I tried the following:
LRESULT MyWeBrowser::PostMessage( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bParsed )
{
switch( uMsg ) {
case WM_KEYDOWN:
{
if (wParam == VK_RETURN) {
MessageBoxW(this->m_Hwnd,L"hello",L"hello",MB_OK);
}
}
break;
}
}
But it doesn't work, any help?
|
|
|
|
|
this stuff is better handled in PreTranslateMessage. Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hello all,
I am working on my homework and I am having issues. When I added a third box to the equation, the total volume in bytes went from 24bytes down to 8bytes. This is not right, when adding another box to my program it should increase in size. But all I had to do was add a third box and calculate the Length, Width, and Height of the third added box. Then calculate the total volume for all three boxes.
Sounds very simple but after adding my third box and changing the code a little bit, I am having issues. I do not understand why it is not adding the two boxVolume1 + boxVolume3 together and then displaying it.
The source is listed below. Thank you all to can contribute to pointing out why this program is not working correctly.
#include <iomanip>
#include <iostream>
using std::cout;
using std::endl;
class CBox
{
public:
double m_Length;
double m_Width;
double m_Height;
};
int main()
{
CBox box1;
CBox box2;
CBox box3;
double boxVolume1 = 0.0;
double boxVolume3 = 0.0;
double volumetotal = 0.0;
box1.m_Height = 18.0;
box1.m_Length = 78.0;
box1.m_Width = 24.0;
box2.m_Height = box1.m_Height - 10;
box2.m_Length = box1.m_Length/2.0;
box2.m_Width = 0.25*box1.m_Length;
box3.m_Height = 108.0;
box3.m_Length = 32.0;
box3.m_Width = 18.0;
boxVolume1 = box1.m_Height*box1.m_Length*box1.m_Width;
boxVolume3 = box3.m_Height*box3.m_Length*box3.m_Width;
cout << endl
<< "Volume of box1 = " << boxVolume1;
cout << endl
<< "Volume of box3 = " << boxVolume3;
cout << endl
<< "box2 has sides which total "
<< box2.m_Height+ box2.m_Length+ box2.m_Width
<< " inches.";
volumetotal = boxVolume1+boxVolume3;
cout << volumetotal;
cout << endl
<< "A CBox object occupies "
<< sizeof volumetotal << " bytes.";
cout <<endl;
return 0;
}
|
|
|
|
|
rbwest86 wrote: sizeof volumetotal
sizeof volumetotal is always 8 whatever value it contains (in the range allowed for double s, of course, see [^]).
Adding values to volumetotal cannot change its size in memory (it changes just the bit pattern in memory).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: is always 8 a constant, often 8
FTFY
The good old Data General machines had 36-bit words holding five 7-bit bytes plus a flag bit, so they would store a double in slightly more than 10 bytes. Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Klingon developers aren't allowed to talk with someone who thinks there are 7 bits bytes. If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Klingon developers aren't allowed to talk with someone who thinks there are 7 bits bytes.
If that is true, you've just proven yourself not to be a Klingon developer. Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
thank you everyone. I figured out what the problem was.
Thank you all again.
|
|
|
|
|
I want to realize the toolbars and windows as follows:
but I only get this result now:
how to do it?
anyone can tell me the answer?
Thanks a lot!
|
|
|
|
|
|
Thank you!
I download the VC2008FeaturePack.exe(322M),but can't install.
I use the chinese version, the System Requirements says:
"Support for systems with non-English versions of Visual Studio 2008 installed will be available in Visual Studio 2008 Service Pack 1. "
So I download the VS2008SP1CHSX1512981.iso(898M), It's too big to install. It need 6G disk space to install. but I have only 4G in my C: disk
Other BBS friends advice me to use:
1. Xtreme Toolkit Pro
2. WTL
3. DirectUI
I don't know these, but I'll try all above.
This is it. Anyone else has other advices?
|
|
|
|
|
Hiya,
I want to basically perform a bulk copy to a SQL server remotely via VC++ client.
Just dont know what library to pull in,maybe sqlncli.msi and use the sqlncli.dll (sql 2008 native client).
I wanted to build an MFC application to use this dll. I'm not sure if this is what I want and how to use
it. Guidance is needed on this and a steady hand.
Much appreciated if somebody can shed some light on how to do this in VC++?
Thanks,
garyc
|
|
|
|
|
Sql native client should do, install it and look for examples.
OLEDB and ODBC providers are good as well, look here http://msdn.microsoft.com/en-us/library/ms130809.aspx
|
|
|
|
|
Hi everyone.
I've got a code snippet which looks like this
CInternetSession session(_T("MyAgent"));
CHttpConnection *pConn = NULL;
pConn = session.GetHttpConnection(_T("www.google.com"),
(INTERNET_PORT)INTERNET_DEFAULT_HTTP_PORT); // function in wininet.dll
......
delete pConn;
The last delete operator works fine. The problem is that it shouldn't, because the exe from which I call wininet.dll function is linked with CRT statically, so the delete operator should look for pConn in it's CRT's run time heap and shouldn't find it. Please share any ideas.
Thanks in advance.
|
|
|
|
|
here's the source for CInternetSession::GetHttpConnection:
CHttpConnection* CInternetSession::GetHttpConnection(LPCTSTR pstrServer,
DWORD dwFlags, INTERNET_PORT nPort ,
LPCTSTR pstrUserName , LPCTSTR pstrPassword )
{
ASSERT(AfxIsValidString(pstrServer));
ASSERT((dwFlags & INTERNET_FLAG_ASYNC) == 0);
CHttpConnection* pReturn = new CHttpConnection(this, pstrServer,
dwFlags, nPort, pstrUserName, pstrPassword, m_dwContext);
return pReturn;
}
it's allocated on the caller's heap, not in WinInet.DLL
that's in VC6's MFC\SRC\Inet.cpp
|
|
|
|
|
Tnank you very much for your reply, but please take a look at this text whick I took from Jeffrey Richter's "Windows via C++"
VOID EXEFunc() {
PVOID pv = DLLFunc();
// Access the storage pointed to by pv...
// Assumes that pv is in EXE's C/C++ run-time heap
free(pv);
}
PVOID DLLFunc() {
// Allocate block from DLL's C/C++ run-time heap
return(malloc(100));
}
So, what do you think? Does the preceding code work correctly? Is the block allocated by the DLL's function freed by the EXE's function? The answer is: maybe. The code shown does not give you enough information. If both the EXE and the DLL link to the DLL C/C++ run-time library, the code works just fine. However, if one or both of the modules link to the static C/C++ run-time library, the call to free fails. I have seen developers write code similar to this too many times, and it has burned them all...
|
|
|
|
|
the code i posted above is the code that you are calling. the object you are deleting is allocated by your app's CRT.
the DLL/EXE CRT allocation issue is not relevant here.
|
|
|
|
|
Thank you for your reply, please take a look at my reply to Richard in the next thread.
|
|
|
|
|
naro24 wrote: so the delete operator should look for pConn in it's CRT's run time heap
Library functions do not have their own heap. The heap is allocated at run time and shared by the exe file and all library functions.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Tnank you very much for your reply, but please take a look at this text whick I took from Jeffrey Richter's "Windows via C++"
VOID EXEFunc() {
PVOID pv = DLLFunc();
// Access the storage pointed to by pv...
// Assumes that pv is in EXE's C/C++ run-time heap
free(pv);
}
PVOID DLLFunc() {
// Allocate block from DLL's C/C++ run-time heap
return(malloc(100));
}
So, what do you think? Does the preceding code work correctly? Is the block allocated by the DLL's function freed by the EXE's function? The answer is: maybe. The code shown does not give you enough information. If both the EXE and the DLL link to the DLL C/C++ run-time library, the code works just fine. However, if one or both of the modules link to the static C/C++ run-time library, the call to free fails. I have seen developers write code similar to this too many times, and it has burned them all...
|
|
|
|
|
naro24 wrote: Is the block allocated by the DLL's function freed by the EXE's function? The answer is: maybe.
Actually the answer is "Yes". As I said earlier there is only one heap within a running application. Whether the actual code is part of the EXE or part of the DLL is irrelevant, the OS maps both parts into the same address space and they all share the same data area within that address space. If this was not so then 99% of commercial applications would not work correctly.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Thanks for your reply, but let me to disagree with you.
Richard MacCutchan wrote: As I said earlier there is only one heap within a running application.
An application can actually create and use as many heaps as needed using HeapCreate,HeapAlloc,HeapFree and other APIs.
Richard MacCutchan wrote: Actually the answer is "Yes"
The answer is not always "Yes". I tested the following code in vs2005
int main()
{
int* a = fnHeapTestLib();
std::cout<<*a<<std::endl;
delete="" a;
="" std::cout<<*a<<std::endl;
="" return="" 0;=""
}
heaptestlib_api="" int*="" fnheaptestlib(void)
{
="" p="new" int;
="" *p="42;
" p;
}
i="" built="" in="" release="" version="" using="" 4="" different="" configurations,="" and="" here="" are="" the="" results
1)both="" exe="" dll="" linked="" to="" crt="" dynamically
="" works="" fine
2)exe="" is="" statically,="" fine(="" very="" strange="" fact="" )
3)exe="" dynamically,="" statically
="" fails(shows="" same="" value="" after="" before="" delete,="" debug="" raises="" assertion)
4)both="" assertion)
i="" can't="" explain="" this="" behavior,="" but="" makes="" obvious="" that="" allocation="" issue="" relevant="" here.
<blockquote="" class="FQ">Richard MacCutchan wrote: If this was not so then 99% of commercial applications would not work correctly.
May be 99% of commercial applications and their DLLs link to CRT dynamically.
Regards
|
|
|
|
|
naro24 wrote: delete fails(shows the same value after and before delete, in debug version raises assertion)
The delete operation does not clear the contents of the memory, so testing the contents before and after is not a valid test. When a block is deleted its header is merely marked to show it is available for reallocation within the running program. As to your comments about HeapCreate() etc, if they work as you believe then I am certain that many commercial programs would be failing on a regular basis. Take a look at the documentation for these functions.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Could you please make this small test in vs2005 or vs2008
1)Make an exe and dll using the code in my previous post
2)Make both projects link to CRT statically
3)Build both in debug mode
As you claim everything must work properly, but you'll see an assertion on delete operator. Can you explain why?
|
|
|
|