Click here to Skip to main content
15,920,828 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralWinsock WSANETWORKEVENTS Pin
mweiss20-Sep-03 9:26
mweiss20-Sep-03 9:26 
GeneralPop-up menu artifact Pin
Luis Mejia20-Sep-03 9:07
Luis Mejia20-Sep-03 9:07 
GeneralRegistry path from handle Pin
User 988520-Sep-03 7:55
User 988520-Sep-03 7:55 
GeneralRe: Registry path from handle Pin
David Crow20-Sep-03 17:01
David Crow20-Sep-03 17:01 
GeneralRe: Registry path from handle Pin
Jason Henderson20-Sep-03 17:54
Jason Henderson20-Sep-03 17:54 
GeneralProblem with Rich Edit Control Pin
raheela20-Sep-03 7:54
raheela20-Sep-03 7:54 
GeneralRe: Problem with Rich Edit Control Pin
Mike Dimmick20-Sep-03 12:54
Mike Dimmick20-Sep-03 12:54 
Generalproblem while using activeX control in regular dll using shared MFC DLL Pin
bhalchan20-Sep-03 5:57
bhalchan20-Sep-03 5:57 
Hello ,
I have created Regualr dll file using shared MFC dll . In dll file I have
defined one function which is called by pascal/vb/vc++ program .The
program works fine as expected .The function displays the simple dialog box
with "OK" & "CANCEL" button .
But when I add the ActiveX control to DLL file , even without adding any member for activeX control , the program fails .I have just put the control box using control pallete in dialog editor as we add normal button .
What is the problem with ActiveX control . What are the settings I need
to do in order to use ActiveX control in the DLL project .

U can check the proplem by simply creating the project as below :

Steps which I followed are explained below :
1. Create DLL project using MFC AppWizard(DLL) , give the name as "sample" .
2. On the second step , keep all default setting .i.e "Regular DLL using shared MFC DLL"
Note the the option for "Automation" & "Winows Socket " are kept as unchecked .
2. Say ok , the application frame work is generated .

Now u can simply insert one dialog , with dialog ID as "IDD_DIALOG1" .
Don't add anything to the dialog .Using the claas wizard , add the class
for dialog , give the name as "Cmydialog" & base class class is "CDialog".
Don't add any control or variable to the dialog . Just leave it as it is .
Then in the sample.cpp file of ur project add the code as shown below.
include the file "mydialog.h" .
The logic in the calldlg function is self explainatory. It just shows message box
with the value passed by the calling function . Then it creates the the dialog &
just display it .


CSampleApp theApp;

BOOL CSampleApp::InitInstance()
{
AfxOleInitModule();
AfxEnableControlContainer();
return CWinApp::InitInstance();
}


void _stdcall calldlg(int x)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
int j;
j=x;
CString str;
str.Format("The value is %d ",j);
MessageBox(0,str,"title",0);
static Cmydialog pt;
static int flag= 0;

if(flag==0)
{
pt.Create(IDD_DIALOG1,AfxGetMainWnd());
flag=1;
}
pt.ShowWindow(SW_SHOW);
}
In the "sample.h" file add the declaration function for InitInstance() since we have
overriden it in the sample.cpp file .



Then add the "calldlg" i.e name of the function in the "sample.def" define file .
Compile it . The sample.dll file is created without any error .

Now just to check it , create client application using MFC . Create simple dialog
based application name "Testsample".
Add one button with id "IDC_TEST" & in the handler of that button call the
function "calldlg" in the dll file . The code is shown below :
void CTestsampleDlg::OnTest()
{
// TODO: Add your control notification handler code here


int p=2;
HMODULE hMod1;
PF pf1={0};
hMod1 = LoadLibrary("c:\\sample\\debug\\sample.dll");
pf1 = (PF)GetProcAddress(hMod1,"calldlg");
pf1(p);

}


just add the following in Testsampledlg.cpp in the very beginning only

typedef void (_stdcall * PF)(int);


Now compile the project & run it . It works without any problem .


Now just open the dll project , add the Microsoft Flex Grid Control with
"Project|add to the project|controls & componants" . Say insert ,
The Flex Grid control is added to the control pallete .The required classes
are also added to the project .
Now just put the flex grid control on ur dialog i.e IDD_DIALOG1 in our case .
Don't add any thing to the grid control as well as to the dialog .
Just compile it . It compiles without any error .

Now try to test it . U will see the Assertion error
What is the problem here with the activeX control now .
Please try it .

thanks & regards ,
Bhalchandra
Generalpassing data structures Pin
Sirrius20-Sep-03 5:09
Sirrius20-Sep-03 5:09 
GeneralRe: passing data structures Pin
Mike Dimmick20-Sep-03 12:59
Mike Dimmick20-Sep-03 12:59 
GeneralRe: passing data structures Pin
David Crow20-Sep-03 17:13
David Crow20-Sep-03 17:13 
GeneralRe: passing data structures Pin
Sirrius20-Sep-03 17:34
Sirrius20-Sep-03 17:34 
GeneralFile shredder Pin
alex.barylski20-Sep-03 4:58
alex.barylski20-Sep-03 4:58 
GeneralRe: File shredder Pin
JWood20-Sep-03 5:51
JWood20-Sep-03 5:51 
GeneralRe: File shredder Pin
Neville Franks20-Sep-03 12:24
Neville Franks20-Sep-03 12:24 
GeneralRe: File shredder Pin
alex.barylski21-Sep-03 20:29
alex.barylski21-Sep-03 20:29 
GeneralRe: File shredder Pin
ZoogieZork20-Sep-03 12:42
ZoogieZork20-Sep-03 12:42 
GeneralRe: File shredder Pin
alex.barylski21-Sep-03 20:31
alex.barylski21-Sep-03 20:31 
Generalswitch help Pin
coda_x20-Sep-03 1:28
coda_x20-Sep-03 1:28 
GeneralRe: switch help Pin
Rickard Andersson2020-Sep-03 2:11
Rickard Andersson2020-Sep-03 2:11 
GeneralRe: switch help Pin
Michael Dunn20-Sep-03 4:36
sitebuilderMichael Dunn20-Sep-03 4:36 
GeneralMigration from VisualAge C++ for windows to Visual Studio 6.0 - MFC 6.0. Pin
Md Saleem Navalur20-Sep-03 1:23
Md Saleem Navalur20-Sep-03 1:23 
GeneralRe: Migration from VisualAge C++ for windows to Visual Studio 6.0 - MFC 6.0. Pin
Gary R. Wheeler20-Sep-03 3:13
Gary R. Wheeler20-Sep-03 3:13 
GeneralAvoid Flickering in MFC Pin
cberam20-Sep-03 0:23
cberam20-Sep-03 0:23 
GeneralRe: Avoid Flickering in MFC Pin
LunaticFringe20-Sep-03 1:45
LunaticFringe20-Sep-03 1:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.