|
Hi,
Three questions in all.
1. How can I explicitly use a *.dll file without manually move it under my *.exe file's folder?
2. As my VC++6.0 installed on a Chinese version OS, codes in IDE is Fixedsys, I want use Verdana instead, but no such option in the down list of font. tell me how to achieve this.
3. I try to load classes in a *.dll file, while what's wrong here.
--------------------Configuration: HydroExe - Win32 Debug--------------------
Linking...
HydroExeDlg.obj : error LNK2005: "unsigned int tid" (?tid@@3IA) already defined in HydroExe.obj
HydroExeDlg.obj : error LNK2005: "class CSerialComm SerialComm" (?SerialComm@@3VCSerialComm@@A) already defined in HydroExe.obj
HydroExeDlg.obj : error LNK2005: "class CDecoder Decoder" (?Decoder@@3VCDecoder@@A) already defined in HydroExe.obj
Debug/HydroExe.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
HydroExe.exe - 3 error(s), 1 warning(s)
------------------------------------------------------------------------------
Thank u in advance!
Extreme programming. Do the No.1
|
|
|
|
|
stevenson wrote:
1. How can I explicitly use a *.dll file without manually move it under my *.exe file's folder?
Well, if you put it somewhere in your PATH , Windows will find it. However, it is highly frowned upon to put things in system directories (Like C:\Windows\System or C:\Winnt\System32.)
stevenson wrote:
3. I try to load classes in a *.dll file, while what's wrong here.
Hmmm. Are you defining the class as an Export from your DLL? Is this MFC? If so, you can qualify your class (in the header) with:
class AFX_EXT_CLASS CSerialComm
If not, you can #define your own export macro (add MYPROJ_EXPORTS to your Preprocessor settings in your build settings):
#ifdef MYPROJ_EXPORTS
#define MY_EXPORT __declspec(dllexport)
#else
#define MY_EXPORT __declspec(dllimport)
#endif
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|
|
i want to display Character(like u) in an edit box of hwnd h with the help of postmessage method.
can any body tell its correct parameters.
because i just know where to put my hwnd.
but i dont know what to put in place of these parameters.
1- UINT Msg, // message
2- WPARAM wParam, // first message parameter
3- LPARAM lParam // second message parameter
BOOL PostMessage(
HWND hWnd, // handle to destination window
UINT Msg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
r00d0034@yahoo.com
|
|
|
|
|
::SendMessage(hTestWnd, WM_CHAR, (WPARAM) 'u', (LPARAM) 0);
I don't see why PostMessage would be any different.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
when PostMessage returns, there is no guarantee the message is processed. With SendMessage, when the function returns, the message has been processed
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
I understand what postmessage does, but what I was saying is that while I've not done it with PostMessage, I see no reason why it should not work. Is there such a reason ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
i see all of ur replies are just making noising.
u sure u know SendMessage?
don't reply in this way, otherwise u go away.
includeh10
|
|
|
|
|
includeh10 wrote:
i see all of ur replies are just making noising.
I don't know what you mean. The SendMessage answer that I gave is from a program I wrote yesterday for the sole purpose of answering this question for someone else. It works, and it answers the question.
includeh10 wrote:
u sure u know SendMessage?
Yes, I went to school with him. What the hell is your problem ?
includeh10 wrote:
don't reply in this way, otherwise u go away.
I have no idea what is wrong with you, but I suggest you
a. learn the English language - u is not a word
b. pull your head in, and
c. get stuffed.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Christian is saying that PostMessage() should work as well as SendMessage() .
I think you need to stop sniping at him. I've seen your other posts in this forum, and you seem to spend a lot more time criticising the people who reply to the posts than you do replying yourself.
Software Zen: delete this;
|
|
|
|
|
I am really getting frustrated with this, so I finally decided to ask. If I leave the code highlighted red in, the application gets stuck in an infinite loop (I think), however if I take it out the application bombs. Does anyone have any suggestions/what might I be missing here? Thanks in advance.
int records::InsertNode(char m_last_name[], char m_first_name[], long m_ssan)
{
ListNode *NewNode, *NodePtr, *PreviousNode;
NewNode = new ListNode;
strcpy(NewNode->last_name, m_last_name);
strcpy(NewNode->first_name, m_first_name);
NewNode->ssan = m_ssan;
if (!Head)
{
Head = NewNode;
NewNode->Next = NULL;
}
else
{
NodePtr = Head;
<font color="red">PreviousNode = NodePtr;</font>
while (NodePtr != NULL && NodePtr->ssan < m_ssan)
{
PreviousNode = NodePtr;
NodePtr = NodePtr->Next;
}
PreviousNode->Next = NewNode;
NewNode->Next = NodePtr;
}
return 0;
}
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
The problem is that if the second entry needs to become the new head, PreviousNode is still pointing to the next node and not the head.
I would initialize PN to NULL and then after the loop check if PN == NULL. If so, then treat as an insert at the head. Otherwise, treat normally.
Head Insert:
PN->Next really is NodePtr->Next. When you set that to NewNode and NewNode references NodePtr, you get your loop.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thanks Tim, I understood the top part, and while trying to implement it I think I #!*@ it up. This is what I added, is that what you are talking about (this still pukes)?
NodePtr = Head;
PreviousNode = NULL;
while (NodePtr != NULL && NodePtr->ssan < m_ssan)
{
PreviousNode = NodePtr;
NodePtr = NodePtr->Next;
}
if(PreviousNode== NULL)
{
PreviousNode = NewNode;
NewNode->Next = NodePtr;
}
else
{
PreviousNode->Next = NewNode;
NewNode->Next = NodePtr;
}
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
Unsure about Tim's answer yet.
but
if (!Head)
{
Head = NewNode;
NewNode->Next = NULL;
}
Why isn't PreviousNode given a default value here ?
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining.
Said by Roger Wright about me.
|
|
|
|
|
Colin Davies wrote:
if (!Head){ Head = NewNode; NewNode->Next = NULL;}
Why isn't PreviousNode given a default value here ?
PreviousNode isn't used if the Head isn't set yet, NewNode becomes the Head and then returns. Or did I miss something?
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
Hello!
Change your line in red to read:
<br />
PreviousNode = NULL;<br />
Then, below the while loop, add this code:
if(PreviousNode != NULL)
{
PreviousNode->Next = NewNode;
NewNode->Next = NodePtr;
}
else
{
NewNode->Next = NodePtr;
Head = NewNode;
}
I think this should fix your problem, because, right now, your application does not take into account the condition that the m_ssan being passed to the function is the lowest value in the list.
I didn't give this a try yet, but let me know if it works.
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
Thanks Alexander, I just tried that however it is still puking. I am not sure why as this looks like it makes sense.
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
Try to trace what you are doing!
If the statement "while (NodePtr != NULL && NodePtr->ssan < m_ssan)" is false ( NodePtr->ssan >= m_ssan )than PreviousNode is not set.
if m_ssan is a new maximum you only break if NotePtr->Next gets somewhere Null.
|
|
|
|
|
Hi all. I'm trying to create a simple stack template class. Yes, I can hear your remarks about just using the STL, but I have my reasons. Anyway, I'm simply trying to allocate memory to grow the stack array, but keep getting the same runtime error:
Unhandled exception at 0x0046a470 in StackTest.exe: 0xC0000005: Access violation reading location 0x00000000.
The call stack currently looks like this:
StackTest.exe!strlen() Line 78 Asm
StackTest.exe!exception::exception(const exception & that={...}) + 0x31 C++
StackTest.exe!std::bad_alloc::bad_alloc(const std::bad_alloc & __that={...}) + 0x13 C++
StackTest.exe!std::_Nomemory() Line 8 + 0xd C++
StackTest.exe!operator new(unsigned int size=240) Line 15 C++
StackTest.exe!operator new[](unsigned int count=240) Line 7 + 0x9 C++
StackTest.exe!CStack<int,30>::resize(unsigned int nNewSize=60) Line 75 + 0xc C++
StackTest.exe!CStack<int,30>::push(int & tData=8) Line 26 C++
StackTest.exe!main() Line 33 C++
StackTest.exe!mainCRTStartup() Line 259 + 0x19 C
kernel32.dll!GetCurrentDirectoryW() + 0x44
I assume from this information that there isn't enough memory available to make the allocation, but this is only the second new call that I make from the start of the program. Also, I'm only trying to allocate 240 bytes of data. Here's the code for the resize() function:
template < typename T, int INCREMENT ><br />
void CStack< T, INCREMENT >::resize( size_t nNewSize )<br />
{<BLOCKQUOTE>
if ( nNewSize == m_nCapacity )<br />
return;<br />
else if ( nNewSize < INCREMENT )<br />
nNewSize = INCREMENT;<br />
<br />
T *pNewStack;
size_t nMinSize;
<br />
nMinSize = nNewSize < m_nCapacity ? nNewSize : m_nCapacity;<br />
<br />
pNewStack = new T[ nNewSize ];<br />
<br />
memmove( pNewStack, m_pStack, nMinSize*sizeof(T) );<br />
<br />
delete [] m_pStack;<br />
<br />
m_pStack = pNewStack;</BLOCKQUOTE>}
Class Variables:
m_nCapacity = 30
m_nSize = 30
INCREMENT = 30
I appreciate any insite that anyone can provide. Thanks!
-Michael Anderson- 完成の円
|
|
|
|
|
|
I would doubt that you are out of memory unless you have a leak. You might be over running an allocated memory region and thus trashing the memory manager.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
hello,
is there a simple way, how different dialogues can be linked in a program?
lucky
|
|
|
|
|
Linked how ? Talk to one another ? I presume they are modeless ? They can just hold pointers to each other, provided by the host window. If that's not what you want, explain further what you're trying to do, so we can help.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
They can just hold pointers to each other
this i still have, when the first dialog is linked with the second dialog, everything is fine, but when the first is linked with the second and third dialog, the program is terminated.
what´s wrong?
lucky
|
|
|
|
|
Why do you have three dialogs up ?
Lucky2002 wrote:
what´s wrong?
1. It's probable that a pointer you're passing around is becoming invalid for some reason.
2. You haven't posted any code, which makes it hard to do more than guess.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
I believe that the first point is my problem.I think, I must give a value to the pointers (if they be produced). But how? (I´m sorry, but I have the code not here)
lucky
|
|
|
|
|