|
The errors for "IDD_DIALOG1 " and "IDD_TEST_FORM " sound like you need to #include "resource.h" before you #include "TestModule.h" .
I would guess you also need to #include the header for your document class before you #include "TestView.h" , since the other errors sound they're complaining about that.
Software Zen: delete this;
|
|
|
|
|
Thank you Gary. It fixed all my compilation problems.
Running the application where we feed the data from one window and display in another window having list view control - I notice that data is correctly passed on for display in view class. However, I tried to create a list view control pointer like this:
CListCTRL* pList = (CListCTRL *) GetDlgItem (IDC_List1);
which in turn gives me runtime error in winocc.cpp that debug assertion failed at line 94:
Line 94 in winocc.cpp is
ASSERT(::IsWindow(m_hWnd));
If you know how to fix this problem or have any tips, I would surely appreciate.
Bruce
|
|
|
|
|
The member variable m_hWnd is the window handle for your list control. If the window handle isn't valid, it usually means that either the control doesn't exist (in which case GetDlgItem() would return NULL ), or the control hasn't been created yet.
As a rule, you need to be somewhat careful using a cast "CListCtrl *pList = (CListCtrl *)GetDlgItem(IDC_List1) " like you're doing. MFC support for the basic Windows controls (static, edit, and so on) are simple wrappers where the wrappers just send messages using the window handle. The MFC object itself doesn't add much. The common controls, on the other hand, are more complicated, and the MFC object may carry around more than the window handle. You are better off using something like this:
CListCtrl List;
List.SubclassDlgItem(IDC_List1,this); This permanently attaches the list control in your dialog resource with the ID IDC_List1 to a member variable List .
Software Zen: delete this;
|
|
|
|
|
Thanks Gary for the tips. Your insight into MFC is commendable.
I tried using your solution however, it does not solve my problem and gives debug assertion failed in winocc.cpp. After exploring the code, in debug mode I realize that Windows handle shows "unused=???"
The following code would summarize the function hierarchy:
void CTest::OnBnClickedButton1()
{
dm dm1;
dm1.Add(t1,c1,ts1,cv1);
}
void dm::Add(LPCTSTR tn,LPCTSTR cn,LPCTSTR ts,LPCTSTR cv)
{
CTestView ctv;
ctv.addData(t1,c1,ts1,cv1);
}
void CTestView::AddData(LPCTSTR tn,LPCTSTR cn,LPCTSTR ts,LPCTSTR cv)
{
int i=0,j=0;
int flag = 0;
j=rowcount-1;
//pointer to the listview control
CListCtrl* pList = (CListCtrl*) GetDlgItem(IDC_LIST1); // THIS ONE DOES NOT WORK
pList->InsertItem(0,ts);
}
Let me try visualizing this. Function1 in separate form1 calls button click which in turn calls function2 and function3 from within function2 is called to display the data in listview in separate form2. What I believe I don't get is the windows' handle being held with function1 call and not released to the function3 (listview control window calling function).
Any clues to fix this?
|
|
|
|
|
In your function dm::Add , you are creating a local variable ctv of type CTestView . This local copy is uninitialized. Its window hasn't been created, and therefore any child windows (including the list control you are really trying to access) haven't been created either. I'm guessing what you really want is to call the addData function for an existing CTestView .
You should have a pointer somewhere to your existing CTestView . If you are using the document/view architecture, you can get the active view from the frame window (your class derived from CFrameWnd ), or you can enumerate all of the views using your document class (see the member functions GetFirstViewPosition and GetNextView ).
Software Zen: delete this;
|
|
|
|
|
I am attempting to override the default interrupt handler for my keyboard.
Does anyone have a class that does such a thing using inline assembly?
I have assembly code that does this but i fail to be able to convert it to inline assembly, (i am new to assembly).
Smelly Cheese....
|
|
|
|
|
|
Hello all,
I developed a program with CRectTracker for a computer with touch panel. But the eight handles are very
hard to click or select with touch pen. Who can tell me how to expand the handles size?
Thanks a lot in advance.
Try to do better every day...
|
|
|
|
|
I had a similar problem with a touch screen application of mine. I ended up not using CRectTracker , and implementing my own.
Software Zen: delete this;
|
|
|
|
|
I have solved this issue.
It's very easy.
For CRectTracker there is a member variable m_nHandleSize. We can set it to the size we want.
Maybe your issue is different from mine.
Thanks for your reply.
|
|
|
|
|
how to Pop up "view wireless Network dialog" of windows XP by Code?
Any tip is welcome!
thank you !
Everyday we make things better.
|
|
|
|
|
Recently,I developed a software which will interact with excel.
So I create a simple Single Document/View project CMyReport,and in start function
BOOL CMyRportApp::InitIntance()
{
...
AfxOleInit();
...
return true;
}
and then in exit function
int CMyRportApp::ExitInstance()
{
::OleUninitialize();
return __super::ExitInstance();
}
then i calle m_oApplication.CreateDispatch("Excel.Application"),
m_oApplication is a member varible of CMainFrame of type CApplication,
CApplication is created from excel typelib.
When the application everything is ok,but when i close the application,a alert
mesessge box is poped up.
the code where arouse the alert is showed as follow:
CCmdTarget::~CCmdTarget()
{
#ifndef _AFX_NO_OLE_SUPPORT
if (m_xDispatch.m_vtbl != 0)
((COleDispatchImpl*)&m_xDispatch)->Disconnect();
ASSERT(m_dwRef <= 1);
#endif
#ifdef _AFXDLL
m_pModuleState = NULL;
#endif
}
"ASSERT(m_dwRef<=1)"is the problem,debug it and found m_dwRef is 2.
~CCmdTarget() is the base class destructor of class COleMessageFilter.
Thanks a lot to who can give me some pieces of advice.
If you want to be a great programmer,then never stop learning
|
|
|
|
|
I want to acess msconfig programmatically using all versions of win os and how can write registry entry in it
|
|
|
|
|
msconfig does not exist in windows NT or later!
Don't try it, just do it!
|
|
|
|
|
OK, I agree not work in nt but what about other in win os
In my college a password form comes before the win 9x and also in xp/2000 and until and unless you feed a password normal booting didn't continue , I just want do similar ly but i didnot know how to enter in boot.ini in msconfig
programmatically.
|
|
|
|
|
I want to acess msconfig programmatically using vb6 in all versions of win os and how can write registry entry in it
|
|
|
|
|
I,want to hide any file or folders programmatically and also restricting user to open particular file and folder
in win9x,nt/2000/xp
|
|
|
|
|
Nice that you want to, but (access restriction) it's not possible in win9x ... why don't you start reading about all the things you are asking here before wasting our time?
Don't try it, just do it!
|
|
|
|
|
Hey, Alex I have seen s/w that locks file and folder and prompts for password , how can i make a similar prog and through calling which api.
|
|
|
|
|
I have created a console C++ application that collects system information, including NFO file as follows
*****************************************************************************
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "\"C:\\Program Files\\Common Files\\Microsoft Shared\\MSInfo\\MSInfo32.exe \"";
ShExecInfo.lpParameters = "/nfo c:\\SystemInformation.nfo";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
***************************************************************************
The code above works, the problem is that there is no indication that the application still running during creation of the (*.nof) file which could be 1-1.5 mins. I tried a messageBox before the code is executed, but it will the same difference.
Any ideas how to display some sort of message/status bar to monitor progress?
|
|
|
|
|
Normally you can't create a progress bar for that because the msinfo32.exe does all the work for you and does not provide a callback or notify system.
Don't try it, just do it!
|
|
|
|
|
Instead of
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
you can wait for a specific amount of time:
do{ <br />
dwWaitResult = WaitForSingleObject(ShExecInfo.hProcess,INFINITE);<br />
switch( dwWaitResult ){<br />
case WAIT_TIMEOUT:<br />
break;<br />
case WAIT_OBJECT_0:<br />
break;<br />
case WAIT_FAILED:<br />
break;<br />
}<br />
}while( WAIT_TIMEOUT == dwWaitResult );
I truly CRINGE every time I see an INFINITE wait, anyhow.
|
|
|
|
|
hi,guy
Sometimes the big font(120 DPI) will cause the interface to look so bad when we expect software to be run under small font(96DPI) conditions.
This problem has troubled me for a long time.
Do you have any solution or advice to me.
Thank you for help me!
Best Regards,
KHLin
|
|
|
|
|
You will need to layout your application so that it looks acceptable at either desktop font size. If the current layout is too crowded, you should rethink how you are doing things.
Another option is to dynamically resize the controls in your application. Take a look at the articles in the 'dialog' section here on Code Project for some ideas.
Software Zen: delete this;
|
|
|
|
|
Can you not use Unicode strings in status bars?? The lParam of the SB_SETTEXT message is a LPSTR (not LPTSTR)...
|
|
|
|