|
Hello,
if you can obtain something like 10.2.33.4 and 10.4.22.0(actually same number of characters, 00.00.00.00) then you can strip the dots out and compare the numbers directly. if the number is higher than it is more recent.
Bekir.
|
|
|
|
|
SWDevil wrote: CString string1 = 10.2.33.4
CString string2 = 10.4.22
Parse the array of characters and
Make string =10.02.33.04 & string2 = 10.04.22.00
and then compare the two.
Hope it helps
Spread wat u Know!
|
|
|
|
|
Hi all.
If you can tell me some class in C++ (NOT MFC) thet can read data file.
(Example: .xls; .dbf; . . . . . )
|
|
|
|
|
Look at ADO. Using ADO I think you will be able to read .xls , .txt , .mdb ,..... files.
|
|
|
|
|
hi
i need to write an application using VS2005 that runs both on desktop and on wince device. can anyone help me out with this? i am setting the project for two configurations but am getting a linking error when compiling for WinCE configuration.
thanks
|
|
|
|
|
WinCE has numerous limitations. With WinCe, you do not have all the APIs that you have for Windows. What is the linker error?
|
|
|
|
|
Hi All
How can i get the Address of an Member function in Regular DLL using
GetProcAddress();
I would be fine if i get an article for using an member function of an class in an dll.
And what is the purpose of .def file and how to create it.
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
See Here
The .def file is a Module-definition (.def) file that provides the linker information no exports, attributes, and other information about the program to be linked. A .def file is most useful when building a DLL.(.def) file is useful when you are not using the __declspec(dllexport) keyword to export the functions from the DLL.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
He wants to get the address of a member function. This link isn't much help in this regard as it doesn't address issues such a name mangling which are required to get it to work.
Steve
|
|
|
|
|
Yeah Steve. Thanks for ur words. I do realize it.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Ya that link shwos how to access global function.
I would like to access the member function's addtess from an dll.
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
HMODULE hMod = LoadLibrary(_T("C:\\YourDLL.dll"));<br />
<br />
if (hMod > (HINSTANCE)HINSTANCE_ERROR)<br />
{<br />
FARPROC lpDllEntryPoint = GetProcAddress(hMod, "YourFunction");<br />
if (lpDllEntryPoint != NULL)<br />
{<br />
(*lpDllEntryPoint)();<br />
}<br />
FreeLibrary(hMod);<br />
}
Regards,
Paresh,
|
|
|
|
|
He wants to call member functions. Because of name mangling getting the name of the function is not trivial. For example, on MSVC6 the mangled name of the function void CMyClass::MyFunction() is “?MyFunction@CMyClass@@QAEXXZ”. Name mangling is also compiler specific.
Steve
|
|
|
|
|
Thanks.
If we look at the MSDN help for GetProcAddress it says "The GetProcAddress function retrieves the address of an exported function or variable from the specified dynamic-link library (DLL)." Hence, we cannot use GetProcAddress in this scenario.
Regards,
Paresh.
|
|
|
|
|
It is possible, just a little messy.
Steve
|
|
|
|
|
Please let me know if you find a way.
Regards,
Paresh.
|
|
|
|
|
First you have to find the mangled name of the function you want to import. Probably the easiest way to do this is generate a linker error. For example:
class CMyClass
{
public:
void MyFunction();
};
void main()
{
CMyClass mc;
mc.MyFunction();
}
Since the function CMyClass::MyFunction is not defined (it is declared) the linker produces the following error message:
“error LNK2001: unresolved external symbol "public: void __thiscall CMyClass::MyFunction(void)" (?MyFunction@CMyClass@@QAEXXZ)”
I have underlined the mangled name.
Use this name when calling GetProcAddress
Assume the following typedef:
typedef void (CMyClass::*PMyFunction)();
Then our code would look like this:
FARPROC pRaw = GetProcAddress(hModule, "?MyFunction@CMyClass@@QAEXXZ");
PMyFunction pFun;
*(FARPROC*)&pFun = p;
CMyClass mc;
(mc.*pFun)();
All in all it's a bad design and should not be contemplated; the whole think stinks of hack. Use COM instead.
Steve
|
|
|
|
|
|
|
Or can put the following code in DLL to create object for the class MyClass in Client Application
extern "C" __declspec(dllexport) MyClass* CreateObjectofMyClass()
{
return new MyClass();
}
extern "C" __declspec(dllexport) MyClass* DeleteObjectofMyClass(MyClass *a)
{
delete a;
}
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
This will not help as it stands. The DLL contains the class’s functions and the EXE (what loads the DLL and wants to call into it) will contain the class definition only (no function definitions). You still need the addresses of the functions of the class in the DLL; you’ve only got the address of the class itself. You can get around this by using virtual functions however.
Steve
|
|
|
|
|
Please refer this[^].
Please also have a look at this[^].
Regards,
Paresh.
|
|
|
|
|
This works for me in Visual Studio 2008 / C++ for a static member function of a class, if there's only one class in the DLL:
* Define the class .h and .cpp files in the usual way. __declspec(dllexport) seems neither necessary nor helpful. For example:
class MyClass
{
public:
static int func (int argc, char * argv []);
};
* Create a .def file for the DLL project: Project | Add New Item... | Module-Definition File (.def)
* In the .def file, export the name(s) of the static member function(s) that you want to find through GetProcAddress(). For example:
LIBRARY "DLLProjectName"
EXPORTS func
* Note that the .def file doesn't declare any MyClass:: scope. I get linker "undefined symbol" errors if I try to include the class scope. I get linker ambiguity errors if there are multiple definitions of func in the library, even if they're at different class or namespace scopes.
* Set the project properties to use the .def file: Project | Properties | Linker | Input | Module Definition File
* In the program that will use this library, load the DLL with LoadLibrary(). Note that the DLL file name needs to be passed as a wchar_t* (not just char*).
* Get the function pointer with GetProcAddress with the un-scoped name you put in the .def file:
HINSTANCE lib = LoadLibrary (...);
typedef int (* FuncT) (int, char * []);
FuncT func = FuncT (GetProcAddress (lib, "func"));
func (argc, argv);
* I don't know why this works without a class scope on func, or why it fails if I try to include the scope.
* The .def file seems to handle the C++ name decoration issues; it's not necessary to know the decorated name.
* I couldn't get this to work with only __declspec(dllexport) and no .def file.
* With the .def file, __declspec(dllexport) doesn't seem to make any difference.
* I haven't yet tried to create an instance of the class and invoke it's non-static functions from the loading program (outside of the DLL itself). I guess that's next on the agenda. Maybe I'll need
to __declspec(dllexport) the class for that ...
|
|
|
|
|
Hi,
I have defined handlers for WM_LBUTTONDOWN and WM_LBUTTONUP. The routines do receive control when pressing/releasing the button, EXCEPT if the mouse is over a static control - and I want to gain control exactly in that situation. In fact, the handlers don't receive the control if the mouse is over any control on the main window, only if the mouse is over an area of the main window, where there is no control.
I can process the CLICKED event for that control, but that's not what I need.
This particular control does not have any message handler. The documentation states
If the mouse is not captured, the message is posted to the window beneath the cursor
but ON_WM_LBUTTONDOWN and LBUTTONUP don't accept a specification of the control. How can I catch this event related to a specific control?
|
|
|
|
|
You can subclass your control. Suppose you have a static control on which you want to handle the notifications for WM_LBUTTONDOWN and WM_LBUTTONUP. Derive a class from CStatic( say you name the derived class as CExStatic). Create a member variable for the static control and change CStatic to CExStatic.( Add the header file CExStatic.) You can implement the notifications and handle the behavior in the derived class.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|