|
Ya, that's it what I was asking for. But just I want to know is there any other way to differentiate the two files. And, any API present to check carriage return or line feed (in VC++)?
Thanks you all for your time.
|
|
|
|
|
Anonymous wrote:
But just I want to know is there any other way to differentiate the two files. And, any API present to check carriage return or line feed (in VC++)?
As far as I know, there isn't an API function for this. The code to do it should be pretty simple.
Software Zen: delete this;
|
|
|
|
|
I want to import a VB interface in my VC++ programming for my image thinning project. How to do so and how to link the interface objects with the coding?
My VB form consists of a menu toolbar, command button,a picture box and a text box. I want to open a 50x50 TIFF image file using the menu item File->Open File and displays the image in the picture box. How to get the file name from the interface and load the image onto the interface?
Then I need to click the command button to convert the image to binary image(0 for white and 1 for black).(I have the coding for binary conversion but I don't know how to link them with the command button and accessing the image in the picture box.
Later, i need to display the binary image that I saved in a binary file in the text box in the interface. How to read and write a file through the interface? How to display the content of the file being read?
Hopefully, anybody who are experienced in this can guide me from the scratch in details. Is there any source where can I get examples of source codes and related tutorials? I've browse through books but they only give the howto info not the real full source codes on the howto.
Some books give info on how to how to create an MFC application, but I still don't get it on how to link the interface items with the existing coding. Need simple and fast help here.
thank you very much
|
|
|
|
|
Hi,
I have no much idea about the VB programming. But when you compile your VB program, it should generate a tlb file, which you can import into your C++ program using #import preprocessor.
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
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.
|
|
|
|