|
Actually, I think you have a lot of confusion. As I said before, you need to spend more time learning the basics of the language before you worry about creating DLLs. Do you fully understand the difference between DLL (and LIB) and EXE?
|
|
|
|
|
Well, I think you're starting with a basic misunderstanding of what a DLL is.
Ask yourself why you're creating a DLL?
And read up about them. This is a decent place to start:
Regular DLL Tutor For Beginners[^]
and
http://www.codeproject.com/KB/DLL/[^]
Good luck,
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
raju_Code wrote: i have problem with how to generate dll of this exe
Visual Studio 's Application Wizard can create the DLL skeleton for you: Just choose Win32 Application and then (in the newli appeared window) Application Settings , finally choose DLL .
raju_Code wrote: and how to test that dll
Build an application that consumes it.
raju_Code wrote: i have faced lots of problem this command line arguments
What problems?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: What problems?
Just look at his main() code.
|
|
|
|
|
Richard MacCutchan wrote: Just look at his main() code.
Oh, code. Wasn't that ASCII-art ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
#include "stdafx.h"
#include <iostream>
#include <windows.h>
void MyFunc(int argc,char**argv);
void MyFunc(int argc,char** argv)
{
std::cout<<argv[1] << "\n" <<argv[2] <<std::endl;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
int argc;
char** argv;
argv = (char**) malloc(3*sizeof(char));
argv[1] = (char*)malloc(sizeof(char)*20);
argv[1] = "Hello";
argv[2] = (char*)malloc(sizeof(char)*20);
argv[2] = "Cpp";
MyFunc(5,argv);
return TRUE;
}
This is dll creation successfully sir,
but i test that dll its throwing
Unhandled exception at 0x00000000 in Test.exe: 0xC0000005: Access violation reading location 0x00000000.
this is my testing dll code sir
#include "stdafx.h"
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
typedef void (*MYFUN)();
MYFUN pFun;
HMODULE hmod;
hmod = ::LoadLibrary(L"DLLcomExe.dll");
pFun = (MYFUN)GetProcAddress(hmod,"DllMain");
(pFun)();
return 0;
}
Raju !!!
|
|
|
|
|
Your code is still wrong, forget about DLL's, it is only confusing you, and is not serving any useful purpose.
|
|
|
|
|
#include "stdafx.h"
#include <iostream>
#include <windows.h>
extern "C" __declspec(dllexport) void MyFunc(char**argv);
void MyFunc(char** argv)
{
std::cout<<argv[1] << "\n" <<argv[2] <<std::endl;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
int argc;
char** argv;
argv = (char**) malloc(3*sizeof(char));
argv[1] = (char*)malloc(sizeof(char)*20);
argv[1] = "Maples";
argv[2] = (char*)malloc(sizeof(char)*20);
argv[2] = "esm";
MyFunc(argv);
return TRUE;
}
#include "stdafx.h"
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
typedef void (*MYFUN)(char**);
MYFUN pFun;
HMODULE hmod;
hmod = ::LoadLibrary(L"DLLcomExe.dll");
pFun = (MYFUN)GetProcAddress(hmod,"MyFunc");
int argc;
char** argv;
argv = (char**) malloc(3*sizeof(char));
argv[1] = (char*)malloc(sizeof(char)*20);
argv[1] = "Hello";
argv[2] = (char*)malloc(sizeof(char)*20);
argv[2] = "cpp";
(pFun)(argv);
return 0;
}
this is working ..but its print 3 times
Raju !!!
|
|
|
|
|
It may be working (partly) but there is still too much wrong with your code. As I keep saying to you "learn the language" first. You obviously still do not understand malloc() or pointers. Get yourself a C++ book or an online tutorial and do some studying.
|
|
|
|
|
Why the hell do you want to make a dll out of your exe ? It seems you have no idea what a dll is (as others have already said). So, first explain why you want to convert your exe in a dll. I think your problem resides there.
|
|
|
|
|
But, let's be honest guys: there is progress in his work...
|
|
|
|
|
Rozis wrote: there is progress in his work.
Yes, it now prints something three times; unfortunately, twice when it's not supposed to.
|
|
|
|
|
I implemented a multi document interface in MFC, when closing the child frame, a pop-up window asking whether to save the changes to the document appears. it's annoying to click No in this dialog to close the child frame completely.
HOw can I stop this pop-up dialog when closing child frame and by default not saving changes made to the document?
|
|
|
|
|
The save dialog is being displayed because it has detected that the document has changed.
You can call SetModified(FALSE) for your document prior to attempting to close, and that should stop the pop-up.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Thanks a lot! I have used many SetModifiedFlag(TRUE) in doc class member functions which leads to the problem!
|
|
|
|
|
how do i write a function that generates random numbers of type double between two bounds with a uninform probability density to calculate the mean and the standard deviation of a distribution of real numbers
can someone help me with codes please
|
|
|
|
|
double getRand(double dMin, double dMax)
{
return dMin + ( rand() / (RAND_MAX + 1.0) * (dMax-dMin) );
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Assuming the bounds are uMax and uMin
double uResult = (uMax-uMin)*( (double) (rand()%100))*0.01 +uMin;
Easy Profiler : Now open source !
http://www.codeproject.com/KB/cpp/easyprofiler.aspx
|
|
|
|
|
hi thanks for the codes but i have more problems because i am now studying the c++ programming language
|
|
|
|
|
Archer justice wrote: but i have more problems because i am now studying the c++ programming language
Well, studying the language should sooner make you a fantastic problem-solver...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thanks Pallini for the encouragement
but unfortunately i have an assignment to summit on histograms, chi square and gaussian random numbers and i don't know what to do because i have been struggling since last week but to no avail
|
|
|
|
|
So you need gaussian (not uniform) random numbers?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
all of them together with the code of chi square
|
|
|
|
|
My dialog is resizable with a list control, and the list control's rect is the whole of dialog's client rect, call CListCtrl::SetBkImage to enable background. My question is how to autofit(stretch) background with the dialog when resizing? Thanks.
|
|
|
|
|
What if your try call ::SetBkImage again when the OnSize member is triggered ?
Easy Profiler : Now open source !
http://www.codeproject.com/KB/cpp/easyprofiler.aspx
|
|
|
|