|
I'm just using the standard one from system::data in visual studio.
thx.
Kim
|
|
|
|
|
I created a tabbed dialog (with 2 tabs) without property sheets. I created a menu on the main dialog that I want to associate with one of the tabs of the tabbed dialog. I want to convert temperature on the embedded dialog to a celsius value when selecting the option from the menu.
I have an error when using the SendMessage function. The commented statements are different ways I have attempted to send a message but they are incorrect. A pointer references each embedded dialog.
Following this function are excerpts from my code (main dialog file, embedded dialog file).
Does anyone have any suggestions?
void CMotionAnalyzerDlg::OnTemperatureCelsius()
{
/* linking error ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));*/
//m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0);
/* errorC2664: caanot convert parameter 1 from _3DSEmbeddedDialog* to UINT */
//SendMessage(m_dPointer[0], WM_MENU_CELSIUS);
/* errorC2664: caanot convert parameter 1 from HWND to UINT */
//SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS);
}
---------------------------------------------------------------------------------------
//MAIN DIALOG HEADER FILE
class CMotionAnalyzerDlg : public CDialog
{
public:
...
MoteDataDlg moteDataDlg; //mote data dialog object (embedded)
DatabaseDlg databaseDlg; //database dialog object (embedded)
void ShowEmbeddedDialog(int number); //shows the proper embedded dialog
CTabCtrl dialogTabCtrl; //Create instance of the child window class;
tab control for embedded dialogs
...
protected:
// Generated message map functions
...
afx_msg void OnTemperatureCelsius();
DECLARE_MESSAGE_MAP()
private:
CRect embeddedDialogRect; //structure to hold the position of child windows
_3DSEmbeddedDialog *m_dPointer[2]; //Create and assign pointers to each window
...
};
-----------------------------------------------------------------------------------------
//MAIN DIALOG .CPP FILE
BEGIN_MESSAGE_MAP(CMotionAnalyzerDlg, CDialog)
...
ON_COMMAND(ID_TEMPERATURE_CELSIUS, OnTemperatureCelsius)
END_MESSAGE_MAP()
BOOL CMotionAnalyzerDlg::OnInitDialog()
{
...
//Create all embedded dialogs for the main window class
moteDataDlg.Create(IDD_MOTE_DATA_DIALOG, this);
databaseDlg.Create(IDD_DATABASE_DIALOG, this);
...
}
//Shows the proper embedded dialog
void CMotionAnalyzerDlg::ShowEmbeddedDialog(int number)
{
int windowCount = 2; //Uses two windows
if ((number >= 0) && (number < windowCount))
{
m_dPointer[0] = &moteDataDlg;
m_dPointer[1] = &databaseDlg;
// Hide every window except for the chosen one
for (int count = 0; count < windowCount; count++)
{
if (count != number)
m_dPointer[count]->HideEmbedded(); //Hide the embedded dialog
else if (count == number)
{
// Show the chosen window and set it's location
m_dPointer[count]->SetWindowPos(&wndTop, embeddedDialogRect.left,
embeddedDialogRect.top, embeddedDialogRect.right,
embeddedDialogRect.bottom, SWP_SHOWWINDOW);
dialogTabCtrl.SetCurSel(count); // Update selection tab
m_dPointer[count]->ShowEmbedded(); // Show the embedded dialog
}
}
void CMotionAnalyzerDlg::OnTemperatureCelsius()
{
//m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0);
//SendMessage(m_dPointer[0], WM_MENU_CELSIUS);
//SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS);
}
-----------------------------------------------------------------------------------------
//3DSEMBEDDEDDIALOG FILE
3DSEmbeddedDialog::_3DSEmbeddedDialog(UINT nIDTemplate, CWnd* pParent)
: CDialog(nIDTemplate, pParent)
{
display = false;
}
void _3DSEmbeddedDialog::ShowEmbedded()
{
if(!display)
{
ShowWindow(SW_SHOW);
OnEmbeddedDisplay(display = true);
}
}
void _3DSEmbeddedDialog::HideEmbedded()
{
if(display)
{
ShowWindow(SW_HIDE);
OnEmbeddedDisplay(display = false);
}
}
-------------------------------------------------------------------------------------
//MOTEDATADLG (EMBEDDED DIALOG) HEADER FILE
#define WM_MENU_CELSIUS WM_APP + 100
class MoteDataDlg : public _3DSEmbeddedDialog //public CDialog
{
...
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
...
}
---------------------------------------------------------------------------------
//MOTEDATADLG (EMBEDDED DIALOG) .CPP FILE
LRESULT MoteDataDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (message==WM_MENU_CELSIUS)
{
celsiusFlag = !celsiusFlag;
AfxBeginThread(MyThreadProc, this);
}
return 0;
}
Trevy
|
|
|
|
|
Trevy wrote: /* linking error ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));*/
//m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0);
This means that tabbed window you are talking about, is not considered as window, thats why ASSERT .
Trevy wrote: /* errorC2664: caanot convert parameter 1 from HWND to UINT */
//SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS);
You need to modify this to,
::SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS,0,0);
But, again it should be valid window..
p.s. Its better to divide problem in small sub problem. Nobody like to read such huge code, like me( posted without using <pre> tags).
|
|
|
|
|
How to disable a button which have a icon on it.
When i disable button the icon is disappered.
|
|
|
|
|
janpoo wrote: How to disable a button which have a icon on it.
You need to use EnaleWindow(FALSE) . Its has nothing do with icon on it.
janpoo wrote: When i disable button the icon is disappered.
Can you show code ? After disabling button, icon should gray out.
|
|
|
|
|
Am use this for load icon on button:
m_MyCon.SetIcon(IDI_MYCON_NO);
Disable that with :
m_MyCon.EnableWindow(FALSE);
|
|
|
|
|
janpoo wrote: IDI_MYCON_NO
I guess, IDI_MYCON_NO of type HICON and initialize with call to LoadIcon .
janpoo wrote: Disable that with :
m_MyCon.EnableWindow(FALSE);
Code seems perfectly fine to me. Icon on button will gray out, after disabling it. Are you considering it as disappearing ?
Otherwise, its difficult to guess what happening at your end from this information.
|
|
|
|
|
|
What is IDI_MYCON_NO ? Is it handle?
|
|
|
|
|
I loaded bitmap on button.but it doesnt show like a normal button.It look like just image.i cant recognize the click.
so that am go with icon.I have load icon on button.It look like normal button.but when i disable the button ,icon disappeared.
which way is better for this.plz help me.
|
|
|
|
|
When You disable a button Icon and bitmap are same you see a gray image but can you explain about this button what does accomplish this button ?
|
|
|
|
|
janpoo wrote: When i disable button the icon is disappered.
have a look at CBitmapButton in MSDN!
|
|
|
|
|
Hi
In my application I want to start the application by dragging an associated data file and dropping onto the application or by file association. I retrieve the file name from the m_lpCmdLine variable which contains the file name with the complete path. I set a CString variable "strCWD" to equal the m_lpCmdLine but the File.Open command bombs to my error capture routine for "Nonexistant file". However, when I manually set strCWD to the same path and file contained in m_lpCmdLine, it opens correctly with the drag/drop routine. Does anyone know what is up with this?
Getting desperate...
code snippit (Sidebar: Can someone instruct me as to how to keep the code snippit format, i.e., tabs and spacings? Mine seem to be totally removed no matter how I format it.
// The main window has been initialized, so show and update it.
int nCmdShow = m_nCmdShow;
((CMainFrame*)m_pMainWnd)->InitialShowWindow(nCmdShow);
// Parse command line for standard shell commands, DDE, file open
// CCommandLineInfo cmdInfo;
// ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
// if (!ProcessShellCommand(cmdInfo))
// return FALSE;
CFile File;
if (m_lpCmdLine[0] != '\0')
{
// drag & drop file to open
OnFileNew();
}
else
{
// create a new (empty) document
OnFileNew();
}
return TRUE;
}
void CFESIZER32App::OnFileNew()
{
UINT nStrLen = 0;
UINT nStrCount = 0;
char lpszCmdStr[_MAX_PATH];
CString strFilename;
CFile File;
CError Error;
if (m_lpCmdLine[0] != '\0')
{
strcpy(lpszCmdStr, m_pszHelpFilePath);
nStrLen = strlen(lpszCmdStr);
while (lpszCmdStr[nStrLen] != '\\')
{
lpszCmdStr[nStrLen] = 0;
--nStrLen;
}
g_strProgramPath = lpszCmdStr;
SetCurrentDirectory(lpszCmdStr);
strFilename = m_lpCmdLine;
// strFilename = "C:\\Documents and Settings\\My Documents\\My Application Data\\My File.fil";
}
else
{
strcpy(lpszCmdStr, m_pszHelpFilePath);
nStrLen = strlen(lpszCmdStr);
while (lpszCmdStr[nStrLen] != '\\')
{
lpszCmdStr[nStrLen] = 0;
--nStrLen;
}
g_strProgramPath = lpszCmdStr;
strFilename = g_strProgramPath + "Project" + ".fil";
}
// file exists -> open it
MessageBox(0, strFilename, "Debug Message #1", MB_OK);
if (File.Open(strFilename, CFile::modeRead))
{
File.Close();
theApp.OpenDocumentFile(strFilename);
}
// file does not exist -> create it
else if (File.Open(strFilename, CFile::modeCreate | CFile::modeWrite))
{
File.Write(&Project, sizeof(class CProjectData));
File.Close();
strFilename = g_strProgramPath + "\\Project" + ".idx";
if (File.Open(strFilename, CFile::modeCreate | CFile::modeWrite))
{
File.Close();
strFilename = g_strProgramPath + "\\Project" + ".fdb";
if (File.Open(strFilename, CFile::modeCreate | CFile::modeWrite))
{
File.Close();
}
theApp.OpenDocumentFile(strFilename);
}
}
}
|
|
|
|
|
Jim_Csoft wrote: strFilename = g_strProgramPath + "Project" + ".fil";
Does this causing the creation of invalid path ? I mean to say does g_strProgramPath is ended with "\\" , as your code is appending file name in front of that.
|
|
|
|
|
Prasad
You're looking at the standard open with application opening file. Back up to the drag and drop opening. The section labled as...
// FILE ASSOCIATION OR DRAG & DROP OPEN APPLICATION STARTUP
is the code section that executes on file association or drag & drop. I compile using the m_lpCmdLine setting the path, the program displays the proper path, but refuses to open, i.e., possible invalid path. However, using the // MANUAL STRING setting strCWD to the exact path, program works! Go figure. Does m_lpCmdLine require using the ParseCommandLine(cmdinfo) to extract the file path properly? Why doesn't the string contained in m_lpCmdLine represent a valid file path usable by the CFile File.Open(strCWD) command?
Thanks for responding!
|
|
|
|
|
What does the control "list control" do? Could somebody make an example that explain how to use it?
|
|
|
|
|
IT_DOER wrote: What does the control "list control" do? Could somebody make an example that explain how to use it?
Click me[^]
Owner drawn
Jesus Loves
|
|
|
|
|
It's been a very long time. Where are you these days? Too busy with work?
I'm Rajesh (formerly nic-named brahmma) at codeproject.
|
|
|
|
|
|
Did you see List in MFC control section on the codeproject?
|
|
|
|
|
|
Update: My previous message referred to CRectTracer which, of course, I regret to say was a TYPO!! Please ignore the previous message. Here comes the corrected version:
Could some-one discuss the subject topic in some detail; i.e.the use of CRectTracker, but withhout OLE. Please note I have already searched the internet.
I have successfully "barebone"-d (i.e. "analysed") MSDN's TRACKER example (also the Blocks32 example) but I need more material (description or tutorial) on how to use subject class members. All one can find in the MSDN class library is a minimal content.
TIA.
|
|
|
|
|
twice ?
i don't think this is necessary. delete one of your questions please, and in the future, please se the Modify link
|
|
|
|
|
toxcct wrote: wice ?
i don't think this is necessary. delete one of your questions please, and in the future, please se the Modify link
thats usual for newbies as they need answer as fast as possible.. as there boss is standing just over them
|
|
|
|
|
Could some-one discuss the subject topic in some detail; i.e.the use of CRectTracer, but withhout OLE. Please note I have already searched the internet.
I have successfully "barebone"-d (i.e. "analysed") MSDN's TRACER example (also the Blocks32 example) but I need more material (description or tutorial) on how to use subject class members. All one can find in the MSDN class library is a minimal content.
TIA.
|
|
|
|