|
At the end of CreateTrigger() right before Release() is called, have you checked with IScheduledWorkItem::GetNextRunTime() to see if a next-run time actually exists? It may just be a problem with the Scheduled Task applet not displaying it correctly.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I am new to mfc. I have created a dialog "mydlg" and want to display it in a Splitted main Frame. How can I create a simple splitted frame?
Thanks in advance
Olgun
|
|
|
|
|
How can I create a simple splitted frame?
if u want to create splitted frame
at the beginning of MFC application wizard select SDI option
and after that at step 5 of 6
select the Base class CView
and create virtual function OnCreateClient() for the class CMainFrame
and intilalize boolean variable at the class and give it false value at hte constructor
after u created it delete all the code of OnCreateClient() function and write this instead
if ( !m_mainSplitter.CreateStatic( this, 1, 2 ) )<br />
{<br />
MessageBox( "Error setting up m_mainSplitter", "ERROR", MB_OK | MB_ICONERROR );<br />
return false;<br />
}<br />
if ( !m_mainSplitter.CreateView( 0,0,RUNTIME_CLASS(CLeftView),CSize(255, 0), pContext ) )<br />
{<br />
MessageBox( "Error setting up splitter view", "ERROR", MB_OK | MB_ICONERROR );<br />
return false;<br />
}<br />
if ( !m_mainSplitter.CreateView( 0, 1, RUNTIME_CLASS(CRightView),CSize(0, 0),Context ) )<br />
{<br />
MessageBox( "Error setting up splitter view", "ERROR", MB_OK | MB_ICONERROR );<br />
return false;<br />
}<br />
m_bInitSplitter = true;<br />
return true;
MFC programmer
|
|
|
|
|
m_fuad67 wrote:
if ( !m_mainSplitter.CreateStatic( this, 1, 2 ) )
You should probably indicate that m_mainSplitter is a CSplitterWnd object.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Thanks a lot for your reply.
Olgun
|
|
|
|
|
hello all ,
i have some code in MFC which i have to write it in win 32 but i couldnt find a rightway can anybody help me regarding this. My code goes like this.
in MFC code is:
typedef unsigned short mtsChar_T;
.
.
mtsChar_T* pResultText;
.
.
CString res;
for(i=0; i< 100; i++)
{
if((pResultText + i)=='\0')
break;
res =res +(pResultText+i);
}
AfxMessageBox(res);
Now i have to write it in win 32sdk application , iahve tried the same code by just replacing Cstring wirh string but it doesnt complile .plz help me abt this
Santosh
|
|
|
|
|
Hello,
Maybe a std::string[^] or a std::stringstream[^] can be of some help..
If not, you have to use strings of TCHARs (see the tchar.h header). You also have to use a lot of C string functions.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Can you please elaborate more on this Bob?
|
|
|
|
|
Hello,
See the following code examples and see the difference between the CRT and the STL:
double dValue = 99.9;
std::stringstream sstr;
sstr << _T("This is some string with a double: ") << dValue << std::endl;
double dValue = 99.9;
TCHAR szBuf[1024] = {0};
_sntprintf(szBuf, 1023, _T("This is some string with a double: %f", dValue);
Some differences of the STL compared to the CRT are:
<list> You don't have to use buffer magic, the STL does it for you
You don't have to use range checking as much as with the CRT
The syntax looks more clean
I remember now a nice CString replacement written by another CPian: CStdString[^]. You can use this class instead of the MFC CString without too much hassle.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Thanks Bob, it will really help me .
|
|
|
|
|
Note: The define UNICODE has no effect on standared streams or strings. Therefore, the _T() does not realy apply unless you do one of the following:
---------------------------------------------
#ifdef UNICODE
std::wstringstream sstr;sstr << _T("This is some string with a double: ") << dValue << std::endl;
#else
std::stringstream sstr;sstr << _T("This is some string with a double: ") << dValue << std::endl;
#endif
---------------------------------------------
#ifdef UNICODE
std::wstringstream sstr;sstr << L"This is some string with a double: " << dValue << std::endl;
#else
std::stringstream sstr;sstr << "This is some string with a double: " << dValue << std::endl;
#endif
---------------------------------------------
std::basic_stringstream<TCHAR> sstr;sstr << _T("This is some string with a double: ") << dValue << std::endl;
---------------------------------------------
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi
I have a program with MFC that include Two panes
left pane for TreView and Right pane for List View
and there is icon at toolbar show me Dialog
after inserting data at dialog the TreeView must do refresh for data that came from database
how could i exchange data between the TreeView and Dialog(not FormView)??
MFC programmer
|
|
|
|
|
if u r reading the database in treeview, U can send a user defined message to the treeview from dialog to refresh it by reading the updated database .
Cool Ju
Dont forget to vote
|
|
|
|
|
U can send a user defined message to the treeview from dialog
this code i wrote at LeftView.cpp(TreeView):
#define WM_REFRESHTREE (WM_APP)<br />
<br />
BEGIN_MESSAGE_MAP(CLeftView, CTreeView)<br />
ON_MESSAGE(WM_REFRESHTREE,AddData) <br />
END_MESSAGE_MAP()<br />
<br />
<br />
<br />
void CLeftView::AddData()<br />
{<br />
if(db.IsOpen()==false)<br />
db.Open();<br />
db.MoveFirst();<br />
GetTreeCtrl().DeleteAllItems();<br />
while(db.IsEOF()==false)<br />
{<br />
GetTreeCtrl().InsertItem(db.m_name);<br />
db.MoveNext();<br />
}<br />
}
from MyDlg.cpp (Dialog):
void CMyDlg::OnButton1() <br />
{<br />
CLeftView *obj;<br />
obj->PostMessage(WM_REFRESHTREE);<br />
}
there is error appeared after writing code so it can't work true
so could i continue my work?
MFC programmer
|
|
|
|
|
It will definetly work...
Dont define ur message as application message (WM_APP), make it WM_USER + ..(some number). define it in both dialog as well as view header files..
Can u list out the errors..
Cool Ju
Dont forget to vote
|
|
|
|
|
Hi
i have done as u said
but there is error still appeared
and the error message told me at the memory instruction
and u must know that i have put the code of my defined windows message at the TreeView implementation file
and I posted the message from the dialog button code
I need qick solve for this problem
MFC programmer
|
|
|
|
|
I doubt the function declaration. A crash is expected when you send a message to a window that doesnt handle it. See below MSDN quote:
User Defined Windows Messages
User-defined messages may be included in a message map by using the ON_MESSAGE macro. This macro accepts a message number and a member function of the form:
// inside the class declaration
afx_msg LRESULT OnMyMessage(WPARAM wParam, LPARAM lParam);
For example:
#define WM_MYMESSAGE (WM_USER + 100)
BEGIN_MESSAGE_MAP(CMyWnd, CMyParentWndClass)
ON_MESSAGE(WM_MYMESSAGE, OnMyMessage)
END_MESSAGE_MAP()
WPARAM and LPARAM are required in the function declaration even though you dont use it.
Satish
|
|
|
|
|
i tried many ways and the same error
so i have uploaded the project that inculdes:
ODBC database and the connection registration where attached
if u want to test the probelm
click on the back button at the toolbar then try to test
http://www.websamba.com/mohammed_fuad[^]
and after any one solved the probelm u can send me the new code at
m_fuad67@hotmail.com
plz help me quick
MFC programmer
|
|
|
|
|
Satishkumar.B wrote:
A crash is expected when you send a message to a window that doesnt handle it.
Huh? A crash should never be expected, especially if a window receives a message that it does not handle. If a window receives a message that it does not handle, DefWindowProc() or DefDlgProc() just sends it on.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Cool Ju wrote:
Dont define ur message as application message (WM_APP), make it WM_USER
Not recommended. While older books and tutorials used WM_USER , these symbols caused problems by conflicting with messages that Microsoft was using. Use WM_APP instead.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
m_fuad67 wrote:
how could i exchange data between the TreeView and Dialog(not FormView)??
I presume some method in the tree view class is in charge of displaying the dialog. Correct? If so, then you'll want something like:
void CMyTreeView::OnButtonClick()
{
CMyDialog dlg;
if (dlg.DoModal() == IDOK)
{
}
} Make sense?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Dear all
there is no true solution
no one can solve this problem?????? ohhhh nooooo
|
|
|
|
|
m_fuad67 wrote:
there is no true solution
no one can solve this problem...
I guess I'll have to go back and change all of my working code to longer work. I've done it so many times, it might take a while, but if you say there is no solution, well...
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi
i tried it so many times and many ways with other applications
but the problem concentrated between left pane (TreeView) and the dialog (not FormView)
plz any one could help me
i'm at big trouble
MFC programmer
|
|
|
|
|
I thought the code snippet I provided was sufficient. As it is apparently not, please show the code you are using when the button is clicked to display the dialog box.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|