|
I went ahead and posted the code I use to deal with this situation. You can find it at
http://www.codeproject.com/useritems/sendcstring.asp
|
|
|
|
|
I wrote a program by dialog project , that works excellent.
Now I need to convert it to DLL.
---------------------------------------------------------
I opened project (MFCAppWizars(dll)).
I attached the recource dialog and all his class (CMainDlg).
I opened also exe project for test the dll and there I wrote:
HINSTANCE hInstance;
hInstance = LoadLaibrary("main.dll");
---------------------------------------------------------
My questions:
1. Where have I write CMainDlg::DoModal() if I want that it wiil shown immidietly when this dll will act ?
2. How can I get and return parameters ???
3. How can I acted this dll from the another exe program ???
------------------------------------------------------
PLEASE !!! HELP ME !!!
Thanks
|
|
|
|
|
Do not use LoadLibrary for this case.
In dialog class declaration (header file) put:
#ifdef DLL_BUILDING
#define DllExportImport __declspec(dllexport)
#else
#define DllExportImport __declspec(dllimport)
#endif
class DLLExportImport CMyDialog : public CDialog
...
In project settings of dll add DLL_BUILDING define
The same header, do include in exe project.
(As You can see, this time CMyDialog class will be defined as dllimport).
In link tab (project settings) of exe project, add path (relative or full) to .lib file generated during build of dll.
It will work
|
|
|
|
|
Although I dont just understood it.
Thank you!
|
|
|
|
|
Do not use LoadLibrary for this case.
Create DLL project. In this project, create header file. In this header write:
In dialog class declaration (header file) put:
#ifdef DLL_BUILDING
#define DllExportImport __declspec(dllexport)
#else
#define DllExportImport __declspec(dllimport)
#endif
class DLLExportImport CMyDialog : public CDialog
...
In project settings of dll add DLL_BUILDING define
That's all for now for dll project. Compile and forget.
Let's go back to exe project.Include the header, You have created in the dll.
The difference, is that when building dll, DLL_BUILDING macro will be defined, so DLLExplortImport will be changed by preprocessor into __declspec(dllexport). When building exe project, You won't have DLL_BUILDING defined, so __declspec(dllimport) will be used.
In link tab (project settings) of exe project, add path (relative or full) to .lib file generated during build of dll.
For more information, see msdn and search for dllexport or dllimport.
uki?
|
|
|
|
|
An so what's the point about COleDropTarget?
|
|
|
|
|
Why do you need to put it in a DLL?
|
|
|
|
|
Does "COleServerItem" have something to do with strctured storage?
Thanks.
Maer
|
|
|
|
|
Does "COleClientItem" have something to do with strctured storage?
Thanks.
Maer
|
|
|
|
|
Hi, all!!!
Does anyone know how can I catch CTRL+ALT+DEL before the system (win 2000)?
10x.
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject "
|
|
|
|
|
To be honest I don't think it's possible on Win2k...
for some of you that wished for CodeProject irc server I create a channel on DalNet called "#CodeProject"
Yea, just sad it's always empty...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
yeah I know
but if people will come and stay instad of come and go.
then this place will NOT be empty.
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject "
|
|
|
|
|
You probably have to replace som input DLL( _very_ dangerous ).
What if the user installs a servicepack?
|
|
|
|
|
I have service pake 3, and I don't really know what it means ?
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject "
|
|
|
|
|
Look at Gina in msdn.
Maybe low level keyboard hook may help: SetWindowsHookEx ??
|
|
|
|
|
Hi,
I had problem of CTRL+ALT+DEL last few days. I searched discussion board for that but didnot found proper solution. I only found that use Gina Dll inplace of microsoft's MSGina.dll. That is not proper solution. Now i solved my purpose to disable CTRL+ALT+DEL in win2000. I don't know about WinNT but it will work for it also. So i want to contribute this part to all user.
Steps are as follows :
1. Open Microsoft SDK Examples. In That Example, Open GinaStub example.
2. Find function
int
WINAPI
WlxLoggedOnSAS(
PVOID pWlxContext,
DWORD dwSasType,
PVOID pReserved
)
3. In this function remove all code written and only return like this
return WLX_SAS_ACTION_NONE;
4. So it looks like this...
int WINAPI WlxLoggedOnSAS(
PVOID pWlxContext,
DWORD dwSasType,
PVOID pReserved
)
{
return WLX_SAS_ACTION_NONE; // Return code for doing nothing ... return to desktop
}
5. Now Make dll.
6. Goto Registry by regedit.
7. goto
\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
(WindowsNT is also there. So dont confused it is | Windows(Space)NT | okay)
8. Make New string value and give data like this
name : GinaDLL
Type : REG_SZ
Data : C:\WinNT\System32\mygina.dll (path of your gina dll(suppose mygina.dll))
9. Reboot computer And your control+alter+delete not worked at all.
----------------------------------------------------------------------------------------
If You want this mygina.dll then contact me on my personal email address.
manish_ld@rediffmail.com
m_codeproject@rediffmail.com
if still not contact me then and then try : pansiniya_manish@hotmail.com
----------------------------------------------------------------------------------------
Thanx in advance.
--------------------------------------------------
Say Whatever You Know.
Helping other people is good for health.
=========
Manish
=========
---------------------------------------------------
|
|
|
|
|
Hello,
My email address is changed.
Changed email address is : manish_ld@yahoo.com.
Please mail on this address for gina.dll.
Enjoy~!!!
|
|
|
|
|
Hello,
My email address is changed.
Changed email address is : manish_ld@yahoo.com.
Please mail on this address for gina.dll.
Enjoy~!!!
|
|
|
|
|
I have this in the .h file:
typedef enum { _P1=0, _P2=15, _P3=6, _PDefault=15} PDef;
MyFunc(PDef a){...};
and when I use it .cpp file like this:
MyFunc( (PDef)1785);
is there a way I can overwrite the '(PDef)' convertion?
e.g.
(PDef)1785- will return _PDefault ?
or somthing like that
thanks
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject "
|
|
|
|
|
Nope, that's how enums work. An enum is implemented as an int. When you cast to PDef, it's up to you to make sure the number is within range of the enum.
--Mike--
http://home.inreach.com/mdunn/
You are the weakest link, GOODBYE!
|
|
|
|
|
Thanx to MSDN: MSDN Library/Technical Articles/Visual Tools/Visual C++/Detecting and Isolating Memory Leaks Using Microsoft Visual C++
I tried to detect, where i've got mem. leak.
As dedscribed, i insert
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
i my header.
but if there is #include <malloc.h> after those strings, i get
Compiling...
StdAfx.cpp
d:\program files\microsoft visual studio\vc98\include\malloc.h(105) : error C2059: syntax error : 'constant'
d:\program files\microsoft visual studio\vc98\include\malloc.h(105) : error C2733: second C linkage of overloaded function '_calloc_dbg' not allowed
d:\program files\microsoft visual studio\vc98\include\malloc.h(105) : see declaration of '_calloc_dbg'
d:\program files\microsoft visual studio\vc98\include\malloc.h(106) : error C2059: syntax error : 'constant'
d:\program files\microsoft visual studio\vc98\include\malloc.h(106) : error C2733: second C linkage of overloaded function '_free_dbg' not allowed
d:\program files\microsoft visual studio\vc98\include\malloc.h(106) : see declaration of '_free_dbg'
d:\program files\microsoft visual studio\vc98\include\malloc.h(107) : error C2059: syntax error : 'constant'
d:\program files\microsoft visual studio\vc98\include\malloc.h(107) : error C2733: second C linkage of overloaded function '_malloc_dbg' not allowed
d:\program files\microsoft visual studio\vc98\include\malloc.h(107) : see declaration of '_malloc_dbg'
d:\program files\microsoft visual studio\vc98\include\malloc.h(108) : error C2059: syntax error : 'constant'
d:\program files\microsoft visual studio\vc98\include\malloc.h(108) : error C2733: second C linkage of overloaded function '_realloc_dbg' not allowed
d:\program files\microsoft visual studio\vc98\include\malloc.h(108) : see declaration of '_realloc_dbg'
d:\program files\microsoft visual studio\vc98\include\malloc.h(116) : error C2059: syntax error : 'constant'
d:\program files\microsoft visual studio\vc98\include\malloc.h(116) : error C2733: second C linkage of overloaded function '_expand_dbg' not allowed
d:\program files\microsoft visual studio\vc98\include\malloc.h(116) : see declaration of '_expand_dbg'
d:\program files\microsoft visual studio\vc98\include\malloc.h(125) : error C2059: syntax error : 'constant'
d:\program files\microsoft visual studio\vc98\include\malloc.h(125) : error C2733: second C linkage of overloaded function '_msize_dbg' not allowed
d:\program files\microsoft visual studio\vc98\include\malloc.h(125) : see declaration of '_msize_dbg'
Error executing cl.exe.
|
|
|
|
|
|
I tried, but i get not a filename in report:
filenae:(stringnumber) : bytes, {blockcount}, memory dump, but
#FileName Error# :(stringnumber)...
|
|
|
|
|
|
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <malloc.h>
#include <crtdbg.h>
|
|
|
|