|
MailtoGops wrote:
I have no much idea about the VB programming.
Obviously. A tlb is generated by a COM object. A C++ COM object could be imported into a VB UI app, but a VB UI app is not going to generate a type library.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm trying to display progress via a dialog similar to when you copy a file from one place to another, and I wouldn't mind using the shell32.dll animations. I found this and this page but I don't think either of them contains everything I need, just bits and pieces. I'll continue to look around but if anyone knows an easy class so I don't have to do much, I'd much appreciate it.
|
|
|
|
|
Hi All,
I search for a way to implement a driver removal into a tool. I know that
by default drivers registered once should resist in the system. Can someone
explain me a way to remove, deregister, etc. drivers ? Is there a manual
from microsoft or someone else available ?
How can I determine which files and entries belong to which driver ? (I did
not develope them but need to remove them). I believe that I should be able
to get this information out of the inf files but as far as I know there are
some dynamic entries e.g. in the registry and the oem*.inf files. If it is
not possible to remove the driver in a spotlessly clean way, is there a
possibility to disable drivers?
I need to know this for modem and network card device classes.
Thanks & Best Regards,
|
|
|
|
|
Try looking in the Driver Development Kit, available from Microsoft; there is a section on installing device drivers.
Software Zen: delete this;
|
|
|
|
|
I have. But it does not work.
What do I make wrong?
example code:
<br />
#include "stdafx.h"<br />
#include <stdio.h><br />
#include <windows.h><br />
#include <setupapi.h><br />
#include "cfgmgr32.h"<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
<br />
PSP_DEVICE_INTERFACE_DETAIL_DATA pspdidd;<br />
SP_DEVICE_INTERFACE_DATA spdid;<br />
SP_DEVINFO_DATA spdd;<br />
HDEVINFO hDevInfo;<br />
DWORD dwIndex, dwSize, dwType;<br />
TCHAR szProperty[256];<br />
GUID ClassGUID;<br />
TCHAR ClassName[MAX_CLASS_NAME_LEN];<br />
LPTSTR INFFile = argv[1];<br />
CString strInfClassID;<br />
BOOL isInstall = FALSE;<br />
<br />
ZeroMemory(&spdid, sizeof(spdid));<br />
spdid.cbSize = sizeof(spdid);<br />
<br />
if(!SetupDiGetINFClass(INFFile,&ClassGUID,ClassName,sizeof(ClassName),0))<br />
{<br />
printf("GetINFClass");<br />
goto cleanup_DeviceInfo;<br />
}<br />
<br />
LPOLESTR InfBuffer;<br />
<br />
StringFromCLSID( ClassGUID, &InfBuffer );<br />
strInfClassID = InfBuffer;<br />
CoTaskMemFree(InfBuffer);<br />
<br />
<br />
hDevInfo = SetupDiGetClassDevs(&ClassGUID, NULL, NULL, NULL);<br />
<br />
if(hDevInfo == INVALID_HANDLE_VALUE)<br />
{<br />
printf("SetupDiGetClassDevs nicht gefunden.\n ");<br />
goto cleanup_DeviceInfo;<br />
<br />
}<br />
<br />
spdd.cbSize = sizeof(spdd);<br />
<br />
for(dwIndex = 0; (SetupDiEnumDeviceInfo(hDevInfo,dwIndex,&spdd)); dwIndex++)<br />
{<br />
<br />
SP_DEVINFO_LIST_DETAIL_DATA devInfoListDetail;<br />
devInfoListDetail.cbSize = sizeof(devInfoListDetail);<br />
<br />
if(!SetupDiGetDeviceInfoListDetail(hDevInfo,&devInfoListDetail))<br />
{<br />
isInstall = FALSE;<br />
goto cleanup_DeviceInfo;<br />
<br />
}<br />
<br />
LPOLESTR Buffer;<br />
CString strClassID;<br />
StringFromCLSID( spdd.ClassGuid, &Buffer );<br />
strClassID = Buffer;<br />
CoTaskMemFree(Buffer);<br />
<br />
if (strInfClassID == strClassID)<br />
{<br />
printf("Test GUID ok.\n");<br />
<br />
SP_REMOVEDEVICE_PARAMS rmdParams;<br />
<br />
rmdParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);<br />
rmdParams.ClassInstallHeader.InstallFunction = DIF_REMOVE;<br />
rmdParams.Scope = DI_REMOVEDEVICE_GLOBAL;<br />
rmdParams.HwProfile = 0;<br />
<br />
if(!SetupDiSetClassInstallParams(hDevInfo,NULL,&rmdParams.ClassInstallHeader,sizeof(rmdParams)) ||<br />
!SetupDiCallClassInstaller(DIF_REMOVE,hDevInfo,NULL)) <br />
{<br />
printf("Driver not remove.");<br />
}<br />
else<br />
{<br />
printf("Driver remove.");<br />
<br />
}<br />
<br />
}<br />
else<br />
{<br />
printf("Test GUID not ok.\n");<br />
}<br />
<br />
<br />
}<br />
<br />
cleanup_DeviceInfo:<br />
<br />
SetupDiDestroyDeviceInfoList(hDevInfo);<br />
<br />
return 0;<br />
}<br />
<br />
|
|
|
|
|
I new a CItemData object for each item of CListCtrl, what is the proper place to delete them when program ends.
I tried CMyListCtrl's destructor and DestroyWindow, it doesn't work (memory leak)
|
|
|
|
|
|
Must add it before the default CListCtrl::OnDestroy.
|
|
|
|
|
If you are storing the pointer for the CItemData by using SetItemData() method then you should handle the LVN_DELETEITEM message. This message is called once for each item in the list control.
Kelly Herald
Software Developer
MPC
|
|
|
|
|
You are right, if that notification is sent for every item on control destruction, then it would be a better solution, because it would work when you ask to remove individual items from the list too.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
At the point of dealing with LVN_DELETEITEM, has the item been deleted? I can't delete the point whose value is returned by GetItemData.
|
|
|
|
|
In the LVN_DELETEITEM handler you don't use GetItemData because the LPARAM is already passed in through the NMHDR pointer. You need to cast it to a NMLISTVIEW pointer. Here is an example:
void CMyDlg::OnLvnDeleteitem(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
*pResult = 0;
MY_DATA_TYPE pData = reinterpret_cast<MY_DATA_TYPE>(pNMLV->lParam);
if (pData != NULL)
delete pData;
}
This gets called for each item in the list control whether you are just removing a single item from the list control or if the window is being destroyed. Be sure to read the MSDN for more information on this notification message.
Kelly Herald
Software Developer
MPC
|
|
|
|
|
Hello all,
I have a function - UpdateTimes() - that connected to SQL server. It will increases the Times value in my database if this value less than 5.
The code like this:
void UpdateTimes()
{
CDatabase m_Db;
CRecordset m_Rs(&m_Db);
m_Db.OpenEx(_T("DSN=MyData;UID=sa;PWD=sa"),0);
CString sSQL_Sel = "SELECT ConID,ChkTimes FROM tblList";
m_Rs.Open(CRecordset::forwardOnly, _T(sSQL_Sel));
while (!m_Rs.IsEOF())
{
short ind = 0;
CString sID;
m_Rs.GetFieldValue(ind, sID);
ind = 1;
CDBVariant varTimes;
m_Rs.GetFieldValue(ind, varTimes);
if (varID.m_iVal <= 5)
{
varID.m_iVal ++;
CString sTemp;
sTemp.Format("%d", varTimes.m_iVal);
CString sSQL_Upd = "UPDATE tblList SET [ChkTimes] = " + sTemp + " WHERE ConID like '" + sID + "'";
m_Db.ExecuteSQL(sSQL_Upd);
}
m_Rs.MoveNext();
}
m_Rs.Close();
m_Db.Close();
}
If my database has only 1 record, this code is OK. But if I have more than 2 records, it has an error message, say "Connection is busy ...".
So do you have another way to do it? Pls help me ...
Thank you very much.
|
|
|
|
|
Using ODBC with SQL Server means you need to be aware that only one record set can be used per connection. If there's one record, when you've read it, there are no more records and the connection can be reused, whereas if there are two or more, it's still busy, and you can't reuse it, but you can use a second (hint).
Alternatively, for what you're doing
"UPDATE tblList Set [ChkTimes] = [ChkTimes] + 1 WHERE [ChkTimes] <= 5"
which is much more efficient, as almost all the work is done by the server, eliminating the need to transfer data backwards and forwards.
Steve S
Developer for hire!
|
|
|
|
|
|
|
For a CWnd you could use (GetScrollBarCtrl() != NULL)
Update: it should be GetScrollBarCtrl(SB_HORZ) or GetScrollBarCtrl(SB_VERT) and it only works for CView and derived classes.
For what kind of window do you need it?
--
jlr
http://jlamas.blogspot.com/[^]
-- modified at 1:23 Monday 5th September, 2005
|
|
|
|
|
|
If you mean how to know if the number of items exceeds the amount of visible items you could use:
(GetItemCount() > GetCountPerPage())
You may also try ApproximateViewRect and compare it to the control dimensions
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I used the first method,(GetItemCount() > GetCountPerPage()),it works perfectly.
|
|
|
|
|
Hi all,
I wanna play *.rm file use MCI!! Can I do it?
If can't ,What should I use ?
Thank you so much.
do it.
|
|
|
|
|
You need realplayer to play .rm files. WMP can't do it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm supposed to make a program that does infix to postfix and prints each, as well as the value of the expression.
Here's my code: http://www.straightlyrics.com/postfix.cpp
Here's a sample data set: http://www.straightlyrics.com/data
The problem lies in where it does the 2 * 6 / 2 + 5 expression.
It outputs the postfix as 2 6 2 / 5 + *
I think it is supposed to be 2 6 2 / * 5 + but I don't know what is causing it to mess up.
By the way, for this program, order of operations are different. / has highest priority, followed by * and + which are equial, then - is last. all operations are supposed to work left to right, except -, which goes right to left.
|
|
|
|
|
Check the order of priority for the operators in your code. Based on that priority The Code is giving the result.
Nice talking to you.
|
|
|
|
|
Hello,
I am having a weird problem with a list view control (CListCtrl) in MFC. I can create it but for some reason I can't add an item to it. When I call the controls InsertItem function, it returns -1, which according to the MFC documentation means that adding the item to the list view was unsuccessful. I know this from running this code:
folderContents.Create(WS_VISIBLE|WS_CHILD|WS_BORDER|<br />
LVS_LIST|LVS_SINGLESEL,<br />
CRect(10,10,300,180), this, <br />
IDC_FOLDERCONTENTS);<br />
<br />
LV_ITEM lvItem;<br />
lvItem.mask = LVIF_TEXT|LVIF_STATE;<br />
lvItem.state = 0;<br />
lvItem.stateMask = 0;<br />
lvItem.pszText = "an item";<br />
lvItem.iItem = 0;<br />
<br />
if(folderContents.InsertItem(&lvItem) == -1)<br />
{<br />
COLORREF c = PALETTERGB(150, 90, 130);<br />
folderContents.SetBkColor(c);<br />
}
When I run the application, backgound color of the list view (named folderContents in above code) is changed. So why cant InsertItem add an item to the list view? There is no explanation in the documentation. Anybody know?
TraileR ParK LifE 4Ever
|
|
|
|