|
How have to declare function in regular dll in purpose to match for another language as Delphi ???
Currently It declared in my VC dll so :
==============================================================
extern "C" __declspec(dllexport) BOOL func(int n)
{
return true;
}
===============================================================
and it performs illegal action in runinig from delphi program.
I tried to add : _stdcall so:
==============================================================
extern "C" __declspec(dllexport) BOOL _stdcall func(int n)
==============================================================
and the connection from delphi dont success at all.
Please help !!!
|
|
|
|
|
Try to fill .def file with exports.
|
|
|
|
|
Have you checked the expected size of the returned type in your Delphi declararion ?
The function you have written [ BOOL func(int n) ] takes a 32-bit value as a parameter, and returns a 32 bit value as a result - BOOL is a typedef for 'int', and therefore takes up 4 bytes, not 1 byte like 'bool'.
If this is not the problem, the first thing you need to do is determine whether the crash is on the way into tyour function, or on the way out. Add some 'tracing' code (MessageBox, perhaps) to your function as the first and the last lines of the function, and see if the crash happens before or after your function code. Or just use the debugger to watch the DLL! If it's on the way out, then the problem is probably the calling convention - the stack is not being cleared properly.
-----------------------------
"I leave no turn un-stoned." - John Simmons, Nov 6 2001
-----------------------------
|
|
|
|
|
1. extern "C" __declspec(dllexport) int func(int num)
{ AfxMessageBox("You are in my dll "); return num;}
----------------------------------------------------------------------
In vc client program = excellent !
In Delphi = performs the function and at out it gives the error message :
"access violation at address"
=======================================================================
2. extern "C" __declspec(dllexport) int _stdcall func(int num)
----------------------------------------------------------------------
In vc client program = excellent !
In Delphi = Not successed to connect to the dll function at all.
=======================================================================
3.
I saw a declaration of function of dll that created in c and succesed in delphi client program and it seems so:
int far PASCAL _export func(int num)
------------------------------------------
I tried it and I gets warning C4236: nonstandard extension used : '_export' is an obsolete keyword, see documentation for __declspec(dllexport)int far PASCAL _export func(int num)and It not works of course
What is the sulation ???
|
|
|
|
|
Hi,
I like to open a CFileDialog in detail view with files sorted according to their age (latest on top, oldest at the end).
How could I do that ?
Any help is appreciated.
BTW: I already use the CFileDialog but I want to the files appear sorted according to their age.
Regards
Ulrich Straub
|
|
|
|
|
Hi,
I'm a novice MFC programmer and am trying to give myself a crash course by programming a simple web application. Basically, I'm trying to create a program to extract information from web pages. I've accomplished this by using the MS web browser control and MSHTML.
I'm really downloading web pages in the background so there's no need for me to download the included images. I know it's possible to turn off image downloading in the WB control, but the only explanations I've found on the MSDN site are very unclear. They discuss modifying IDispatch::Invoke to handle DISPID_AMBIENT_DLCONTROL.
Can anyone out there help explain how to do this a little more clearly? My current project has a CWebbrowser class being used by a Dialog box and I don't see where I'm supposed to make these IDispatch modifications.
|
|
|
|
|
Sirs,
do you have information, eventually links of how this key works?
HKEY_CURRENT_USER\Software\Microsoft\Protected Storage System Provider\
Thanks in advance.
Bunburry
It is only by not paying one's bills that one can hope to live in the memory of the commercial classes. (O.Wilde)
|
|
|
|
|
I have a class called CToolBarTab which is derived from CTabCtrl. The idea is that you 'attach' it to a dialogbar, and it stretches to fit it. how can i do this? i tried calling GetClientRect on the dialogbar passed in my Create function, but it didn't work...
thanks in advance!
Dave Kerr
focus_business@hotmail.com
www.geocities.com/twocrazynerds/home.htm
|
|
|
|
|
I was wondering the correct way to tell if a dialog has focus or not. Anyone have a sample if statement handy?
|
|
|
|
|
use CWnd::GetFocus
It returns the CWnd* of the window that has focus
If you are not using MFC try using a combination of GetForegroundWindow and GetFocus [both are API calls]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Dialogs usually do not have the focus. Focus belongs to the controls on the dialog - edits, buttons, etc.
Why do you need to know this?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I writed regular dll in vc++ for delphi.
It works in vc client program but in delphi it performs illegal ... and shut down when it trys to send parameter to the function.
the function declared in the dll so :
extern "C" __declspec(dllexport) int Reg1(int pc)
====================================================
Please help !!!!
|
|
|
|
|
You probably need to add __stdcall to the prototype. Right now I'm using a Delphi DLL from C and the exported functions use the __stdcall convention, so it's probably the same going the other way (C used in Delphi).
--Mike--
http://home.inreach.com/mdunn/
#include "witty_sig.h"
your with and
|
|
|
|
|
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.
|
|
|
|