|
Thats easy: you can register your com-dll by using
this source code inside your client, maye inside your
InitInstance. For this reason you have to copy the dll
into the same dir as the .exe file.
by the way: regsvr32.exe will do nothing else !
BOOL CMyApp::RegisterVtrLibrary()
{
HINSTANCE ComLib;
FARPROC lpfnDLLProc;
BOOL bRet = FALSE;
VTRLib = LoadLibrary("MyComDLL.dll");
if (VTRLib)
{
lpfnDLLProc = GetProcAddress (ComLib, "DllRegisterServer");
(*lpfnDLLProc) (); //DllRegisterServer();
FreeLibrary(ComLib);
bRet=TRUE;
}
return bRet;
}
|
|
|
|
|
in that way I got errors on the line :
VTRLib = LoadLibrary("Debug\\UdiDNM.dll");
as below:
---------------------------------------------------
Compiling...
MyAtl.cpp
MyAtl.cpp(106) : error C2065: 'VTRLib' : undeclared identifier
MyAtl.cpp(106) : error C2440: '=' : cannot convert from 'struct HINSTANCE__ *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe.
MyAtl.dll - 2 error(s), 0 warning(s)
|
|
|
|
|
Well, I forgot to change the name of this variable. SORRY
BOOL CMyApp::RegisterComLibrary()
{
HINSTANCE ComLib;
FARPROC lpfnDLLProc;
BOOL bRet = FALSE;
ComLib = LoadLibrary("MyComDLL.dll");
if (VTRLib)
{
lpfnDLLProc = GetProcAddress (ComLib, "DllRegisterServer");
(*lpfnDLLProc) (); //DllRegisterServer();
FreeLibrary(ComLib);
bRet=TRUE;
}
return bRet;
}
|
|
|
|
|
Is that code give the option that the dll will not must register in registry ?
What the means "DllRegisterServer" ?
Thank you very much !!!
|
|
|
|
|
Yes, this is the code for that purpose.
"DllRegisterServer" is a function/method exported in every COM-Dll.
You will need this call to register the DLL into the registry.
If you do not exactly know, what I mean, just send me the name of
the DLL an the name of the client project, or even the dll an the project
itself, an I will generate a prodecure for you, if you like.
Marc
Marc.Holenz@mascott.de
|
|
|
|
|
I have to come up with a topic for my C++ final and was woondering if anyone had any suggestions for some topics?
|
|
|
|
|
mostly people do something networking-related
like proxy servers and stuff like that
you can add NAT features
and SSL tunneling etc...
Nish
|
|
|
|
|
I want to implement a data import form like Access.
How to do it.
Please help me.
thanks.
|
|
|
|
|
I must admit I'm not overly familiar with Access, I only use it to verify my ADO code is working. What data import form, and what do you want it to actually do for you, or do you only want help with the GUI part of it ?
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
I want to get lots data item from a control like Access.
Then I get the info from it to create a TCP msg for sending.
I don't want to use a Database,only to get info with a friendly way.;P
|
|
|
|
|
So you're actually asking a GUI question ? Could you direct me how to find the form you're talking about in Access 2000, so I can see what you want ?
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
I think he prolly means that he has some form elements like text boxes, combos etc.which he wants to fill up using data from a database
or perhaps he wants a DBGrid control
Nish
|
|
|
|
|
Can any one tell me how to write a plug in for Microsoft Outlook and other mail applications in vc?
Ur help will be highly appreciated.
|
|
|
|
|
In VC:
typedef struct tagDataSet{
UINT Row;
UINT Col;
LPCTSTR Tips;
double Data;
} *LPDATASET;
UINT WINAPI GraphToBitmap(LPDATASET lparDataSet[DATASIZE],LPBMPFILE lpFile,LPDATAPARAM lpDataParam,LPGRAPHPARAM lpGraphParam);
In VB:
Private Type LPDATASET
Row As Long
Col As Long
Tips As String
Data As Double
End Type
Private Declare Function GraphToBitmap Lib "XGraph.dll" (fdata As LPDATASET, tfile As LPBMPFILE, tdata As LPDATAPARAM, tchart As LPGRAPHPARAM) As Long
...
If GraphToBitmap(fdata(1), tfile, tdata, tchart) = 0 Then Debug.Print "OK"
...
But at this line error in vc
CString sBuff;
sBuff.Format("%d", lparDataSet[0]->Data);
MessageBox(NULL,sBuff,"",MB_OK);
sBuff.Format("%d", lparDataSet[1]->Data);
MessageBox(NULL,sBuff,"",MB_OK);
How to do?
thanks
\\\|///
\\ - - //
( o o )
+--------------------oOOo-(_)-oOOo--------------+
| |
| URL : http://GhostStudio.yeah.net |
| OICQ : 7420909 email:MornLee@21cn.com |
| CyberGhost |
| Oooo |
+--------------------oooO---( )---------------+
( ) ) /
|
|
|
|
|
I am thinking of various options for the interface to a new program I am starting.
One option I am considering is a Photoshop-like interface, with a toolbar, and various control and param windows, as well as a docking window on the side or something. the difference is that there would be no 'document', just the control windows. The current version of this application simply throws windows around the desktop, and opens new ones on a whim. each window is significantly different.
My understanding of DocView does not lead me to believe it can do such a thing (its more for multiple views of various forms of the same basic types of data). Is there a way to get this to work without resorting to complex hacks?
\\ Rock
|
|
|
|
|
No, with MDI you can define multiple document types as well as multiple views, so you can have significantly different ways of showing the same data, or of showing different data. This is really the strength of the doc/view architecture, the fact you can use one representation of your programs data and link to it with differing ways of showing the contents of the document.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Yes, but what I mean is that I dont need all the functionality of a view. just a simple window. (think the VB IDE without and documents in the main window. just control windows...)
docking controls would work as well, however they would have to have full support for controls and all the good stuff.
\\ Rock
|
|
|
|
|
In that case, I guess you can just create a window and write your own 'views' of the data as you choose to store it. However, your first question seemed to be if MDI could handle what you want, and it can.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Why can't I do a copy'n'paste from the variables window or quickview? I want to copy the value out and paste it somewhere. How did they screw such a simple thing up? Does anyone know of a way to get at that data?
|
|
|
|
|
You can use the watch window.
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
Hi,
I want to format a flot into a string rounded to three digits.
I thought the code, should work.
double dtest = 10.329;
char buffer[255];
wsprintf(buffer,"%10.2f",dtest);
MessageBox(buffer);
Cheers
Rich
|
|
|
|
|
wsprintf(buffer,"%.3f",dtest);
will round it to three digits past the decimal point.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Unfortunately, wsprintf (part of Win32 API) doesn't accept %f, %g or %e. sprintf from stdio.h will do the job - it recognizes escape sequences for floating point.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
You can also use the standard library "stringstream" class to format a std::string, like this :
double dTest = 10.329
std::stringstream ss;
ss << setiosflags( ios::fixed ) << setprecision(3) << dTest;
cout << ss.str();
std::stringstream ss;
ss << setiosflags( ios::fixed ) << setprecision(2) << dTest;
cout << ss.str();
std::stringstream ss;
ss << setiosflags( ios::fixed ) << setprecision(1) << dTest;
cout << ss.str();
This looks like more code/work for such a simple example, but often this ends up saving you code if you then have to use the 'string' in other functions.
The standard library stringstream also has the advantage that you can extend it in two ways:
(a) writing your own manipulators (for example, you can write a 'percent' manipulator that converts a value into a percentage as it is written to the output;
(b) you can write inserters/extractors for user defined types, so that you can use the same syntax to write your own types as you do for the 'built in' types like double.
-----------------------
The sermon on the mount...
Man 1 : Hear that? Blessed are the greek.
Man 2 : The greek?
Man 1 : Well apparently, he's going to inherit the earth.
Man 2 : Did anyone catch his name?
|
|
|
|
|
Dear sir,
I met a strange probelm when I am trying to program my first
MFC extended DLl. That is, I need to use STL in my DLL and
I define some date type such as:
typedef CArray<char,char> CStatusArray;
typedef CArray<int,int> CIndexArray;
But When I compile the file, I got
error C2143: syntax error : missing ';' before '<'
error C2143: syntax error : missing ';' before '<'
warning C4091: 'typedef ' : ignored on left of 'int' when no variable is declared
I know this is related to the DLL programming itself since the error is not
incurred in my MFC exe project. But I am new to DLL programming. So I am posting this to get your help. Thank you very much and any suggestion is welcome.
Best regards,
Cheng LEI
|
|
|
|