|
Thank you !
Where exactly need I to add _stdcall ?
Manny thanks
|
|
|
|
|
I declared the function in my dll so :
extern "C" __declspec(dllexport) BOOL _stdcall func(int num);
and now the Delphi client program can not connect to it at all !
What can I to do ??? Please help !!!
|
|
|
|
|
Exported __stdcall functions have their names mangled. That's probably why Delphi program 'can't connect'.
I have zero experience with Delphi - are you using LoadLibrary/GetProcAddress before calling function from DLL? Or Delphi does this for you?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
hi,
i have a loop and in it it connects to a http site with CInternetConnection, but the dialog does not update util it has finished doing everything, i overcame this by addeing some CDialog::RedrawWindow(); in, but still its doesn't process any clicks on buttons or anything, it just redraws the window with my updated status, so is there a way to fix this? delphi has a processMessages() proceduce, is there something simular in MFC VC++ ?
thanks for any hepl you can provide.
p.s great site
muz.
|
|
|
|
|
use a worker thread
Read Joe Newcomer's article on worker threads
that should get you started
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Take a look at PeekMessage();
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
How can I make a flat window, I mean there is no separate line between the menu and tool bar,
Thank you
|
|
|
|
|
I have three classes the are dependant on each other
ex:
#include "First.h"
class First {
Second* psecond;
public:
First();
~First();
void AttachSecond(Second* second);
};
#include "Third.h"
class Second {
Third* pthird;
public:
Second();
~Second();
void AttachThird(Third* third);
};
#include "First.h"
class Third {
First* pfirst;
public:
Third();
~Third();
void AttachFirst(First* First);
};
When I do the includes for each class, VC gives me
undeclared identifier errors on any reference to the included class.
Any Ideas or is it too cryptic?
Stephen Caldwell
Blackfission, CEO
http://bf.steffc.yi.org:81
|
|
|
|
|
What I would do is use forward declarations. In each class' header I would do the old :
class CSecond;
or
class CThird;
or whatever class is referenced in that header. I would not include the other class header there. I would put the includes of the other headers in the source code module of the class that needs it.
|
|
|
|
|
It worked. Thank you.
Stephen Caldwell
Blackfission, CEO
http://bf.steffc.yi.org:81
|
|
|
|
|
Hmmm - that first include should be #include "second.h", but maybe thats a typo.
Have you tried using forward declarations instead? If you are only using pointers to the classes, this should work:
class Second;
class First {
Second* psecond;
public:
First();
~First();
void AttachSecond(Second* second);
};
|
|
|
|
|
I don't quite understand the example, but I'll assume you have three different .h files, each .h with one class.
based on what I said, It seems that your first class should include the second class header, like this:
/*instead of: #include "First.h" */
#include "Second.h"
class First {
...
...
...
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Dear smart programmers:
Could someone help me. I have ListCtrl of 8 colums and I need put checkboxes in Col4, Col5 and Col8. Thank you in advance,
Mats
|
|
|
|
|
Use LVS_EX_SUBITEMIMAGES extended style, create an image list containing checked and unchecked boxes. If you want users to switch between checked/unchecked states with the mouse, you'll have to handle WM_LBUTTONDOWN as well. CListCtrl::HitTest will check if click was inside subitem image.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
1. how can create items in CListCtrl with different font color for each item?
2. how can i add a Progress Bar to a status bar?
thanks a lot
|
|
|
|
|
For 1., I think you'll want to look at subclassing your own CListCtrl, setting the 'Owner draw fixed' style in the resorce editor. Then you can override the CListCtrl::DrawItem method and use ::SetTextColor and ::SetBkColor to change the colors on a per item basis. (Er, assuming you are using DrawText(lpDrawItemStruct->hDC, ...))
There should be lots of articles here on the site with more info on this type of stuff.
|
|
|
|
|
(1) - If all that you need is different colors, use custom draw (not owner-draw). There's an article about that right here on CodeProject, in the ListCtrl section.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi, my application terminated itself suddenly without any error messages even in VC debug enviroment. Sometimes it cause the PC restarted.
How to find the bug and solve this problem?
The platform is Windows 2000 Professional. And it is developed with Visual C++ 6.0 and Visual Basic 6.0. The user interface is developed with VB. And a dll is with VC.
Thanks
|
|
|
|
|
Faulty memory, this can cause spontanouse reboots and programs crashing with oany apparent reason.
|
|
|
|
|
This can happen with a simple stack 'overrun'.
Lets say you have a function with a char buf[20]; declaration. Then, you copy more than 20 chars to that array - you will overwrite other stack data - possibly the return address of the function - with just such highly unpredictable results.
|
|
|
|
|
I'd guess stack overrun too - its fairly easy to do, and can happen if you pass bad values to some windows functions.
Step through your program when you get to the 'bad' area (or use logging, with a flush after each write to your log file) and check carefully around the last thing you did.
Check for mismatched parameters on your Calls to the DLLs - its a risk area.
--Mark Terrano
www.ensemblestudios.com
(Creators of the Age of Empires series)
|
|
|
|
|
Hey Guys
Heres a problem for you guys, I have a shell extension i have written and i have a function that calls another function. When the called function returns it will crash explorer, but if i have an AfxMessageBox pop up in the called function then it doesn't crash explorer and the shell extension works fine. Does anyone have any idea whats going on or is it a WinXP bug.
Peter
|
|
|
|
|
Okay a quick amendment. It doesn't have to be an AfxMessageBox a MessageBox called in the called function stops it crashing as well. I must say this problem has completely confused me.
Oh by the way this works fine in ME,98 and 2K
Peter
|
|
|
|
|
I have a class that I am creating for general purpose Sockets class since I am not using MFC in my project. One of my functions on the server end is a called thread that has the accept() in it.
<br />
long ListenThread()<br />
{<br />
m_dwThreadCount++;<br />
m_bActive = true;<br />
<br />
while (m_bActive)<br />
{<br />
if ((m_sockListener = accept(m_socket, NULL, NULL)) == INVALID_SOCKET)<br />
{<br />
ATLTRACE("Error accepting client.\n");<br />
m_dwError = 1;<br />
}<br />
else {<br />
ATLTRACE("Connection accepted.\n");<br />
}<br />
}<br />
<br />
m_dwThreadCount--;<br />
<br />
return 0;<br />
}<br />
Anytime there is a connection accept() stops blocking and I do some work then based on m_bActive the loop starts again. Later in my code I have a function that sets m_bActive to false and trys to shutdown and close the socket. Since I have added the shutdown() with the closesocket(), accept() will stop blocking. A problem arises when I create the thread multiple times. Eventually something doesn't come back. Is there another way to get accept() to come back so I can gracefully terminate the thread and the object?
Thanks,
Clint
|
|
|
|
|
Try faking a connection on the local loopback (in your code, connect to 127.0.0.1 on the listening port). That should kick the accept into awareness, and you can take from there.
Kudos to Pr3zB0y and Tr0yB0y at DS for this one.
|
|
|
|