D
Dan The Man
Hi All,
I'm trying to create an ActiveX Control that will allow the user to select
any size file, copy it to a share, then link to it in my infopath form.
I have been successful in creating an Open File Dialog Box inside an Active
X control. However, when I click a button to Open the Dialog Box, it
disappears behind the Infopath Form instead of staying on top. I believe it
is due to my not linking the Infopath Form to the OPENFILENAME structure.
"How do I link an Infopath Form to an ActiveX Component Open File Dialog?".
How do I get the Infopath Form hwndOwner information?
Would I have to add another variable to my Component? And if so, what would
I need to set that value to inside my C# Managed Code?
Thanks in advance
Dan
Here is the code:
OPENFILENAME ofn;
char szFileName[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL; // This is where the problem is!!!
ofn.lpstrFilter = "All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "exe";
ofn.lpstrTitle = "Attach File";
if(GetOpenFileName(&ofn))
{
// Do something usefull with the filename stored in szFileName
::MessageBox(NULL, szFileName, "Go go go",0);
}
I'm trying to create an ActiveX Control that will allow the user to select
any size file, copy it to a share, then link to it in my infopath form.
I have been successful in creating an Open File Dialog Box inside an Active
X control. However, when I click a button to Open the Dialog Box, it
disappears behind the Infopath Form instead of staying on top. I believe it
is due to my not linking the Infopath Form to the OPENFILENAME structure.
"How do I link an Infopath Form to an ActiveX Component Open File Dialog?".
How do I get the Infopath Form hwndOwner information?
Would I have to add another variable to my Component? And if so, what would
I need to set that value to inside my C# Managed Code?
Thanks in advance
Dan
Here is the code:
OPENFILENAME ofn;
char szFileName[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL; // This is where the problem is!!!
ofn.lpstrFilter = "All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "exe";
ofn.lpstrTitle = "Attach File";
if(GetOpenFileName(&ofn))
{
// Do something usefull with the filename stored in szFileName
::MessageBox(NULL, szFileName, "Go go go",0);
}