|
Hi Team,
I have create modeless dialog, which contain Edit Box, and put it in Excel.
The problem is every time I enter a text to my edit, the text disappear in Edit Box instead it show in a active cell in Excel.
Does someone has any suggestion?
Below is a code snipped
<pre lang="c++">BOOL CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_COMMAND:
break;
case WM_GETDLGCODE:
return TRUE;
case WM_SETFOCUS:
return TRUE;
case WM_KILLFOCUS:
return TRUE;
default:
return FALSE;
}
return TRUE;
}
void CWPFInDialog::CreateMyDialog(HWND a_hwnd)
{
m_dialogHwnd = CreateDialog(g_hinstDLL, MAKEINTRESOURCE(IDD_DIALOGHOST), a_hwnd, ToolDlgProc);
if(m_dialogHwnd == NULL)
{
ShowWindow(m_dialogHwnd, SW_SHOW);
}
}
Thanks,
PS
|
|
|
|
|
if(m_dialogHwnd == NULL)
{
ShowWindow(m_dialogHwnd, SW_SHOW);
}
Are you sure about this?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Sorry for the typo
It should be
if(m_dialogHwnd != NULL)
{
ShowWindow(m_dialogHwnd, SW_SHOW);
}
|
|
|
|
|
Given the amount of code you have shown it's anyone's guess what may be happening. However, I did notice that your return value for the WM_GETDLGCODE[^] message is not one of the valid options.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
This is full class definition of creating dialog.
This class is an export class.
header file
#pragma once
#include "WPFInDialogDefs.h"
#include "WPFWrapper.h"
class WPFINDIALOG_API CWPFInDialog {
public:
CWPFInDialog(void);
void CreateMyDialog(HWND a_hwnd);
private:
HWND m_dialogHwnd;
CWPFWrapper m_wrapper;
};
cpp file
#include "stdafx.h"
#include "WPFInDialog.h"
#include "resource.h"
extern HINSTANCE g_hinstDLL;
CWPFInDialog::CWPFInDialog()
{
}
BOOL CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_COMMAND:
break;
default:
return FALSE;
}
return TRUE;
}
void CWPFInDialog::CreateMyDialog(HWND a_hwnd)
{
m_dialogHwnd = CreateDialog(g_hinstDLL, MAKEINTRESOURCE(IDD_DIALOGHOST), a_hwnd, ToolDlgProc);
if(m_dialogHwnd != NULL)
{
ShowWindow(m_dialogHwnd, SW_SHOW);
}
}
To create the the dialog, I just
CWPFInDialog* l_atsWrapper = new CWPFInDialog();
l_atsWrapper->CreateMyDialog(l_hwndExcel);
l_hwndExcel is an excel handle
to get the excel handle I call
CComPtr<Excel::_Application> l_excelApp;
HRESULT l_hr = g_excelMgrSingleton.GetExcelApplication(&l_excelApp);
HWND l_hwndExcel;
l_hr = l_excelApp->get_Hwnd((long*)&l_hwndExcel);
no clean up for l_atsWrapper
|
|
|
|
|
You may need to contact the provider of this class, or check its documentation. I can find no information about it.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Richard MacCutchan wrote: However, I did notice that your return value for the WM_GETDLGCODE[^] message is not one of the valid options. While DLGC_WANTARROWS is a valid return code, I'm not sure it makes sense in this context.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|