|
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
|
|
|
|
|
void CMyDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if (IsWindow(m_ListCtrl.m_hWnd))
{
CRect rect;
GetClientRect(rect);
m_ListCtrl.MoveWindow(rect);
m_ListCtrl.SetBkImage(::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BKIMAGE)));
}
}
problem still unresolved, autofit(stretch) no effect! Thanks!
|
|
|
|
|
I am using following piece of code to update excel using dde . I am updating the g_count
as my excel connect it cell get updated with value = 10 ; But I am not able to send string
value i.e. "xyzabcd" etc to the excel cell ,so how can I send string to the excel sheet
using dde
int g_count = 10;
short xltableData[100];
// tdtTable record...
xltableData[0] = 0x0010; // tdtTable
xltableData[1] = 4; // 2 short ints following
xltableData[2] = 1; // # rows
xltableData[3] = 1; // # cols
// tdtInt record...
xltableData[4] = 0x0006;
xltableData[5] = 2;
xltableData[6] = (short)g_count;
DdeCreateDataHandle(g_idInst, (UCHAR*)xltableData, 2*7, 0, g_hszItemName, fmt, 0);
Trioum
|
|
|
|
|
|
I try lot but could not success. can you suggest be some piece of code to pass the binary string .can you replace my code for string
Trioum
|
|
|
|