|
DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
CRect rcItem(lpDrawItemStruct->rcItem);
int nItem = lpDrawItemStruct->itemID;
....
}
NG
|
|
|
|
|
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
It even doesn't enter the message handler.
|
|
|
|
|
Override CComboBox::DrawItem .
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Custom draw is a feature supported only by the common controls. For the standard builtin Windows controls, you have to implement owner draw, which is a bit more involved.
Software Zen: delete this;
|
|
|
|
|
Hi all,
Can we find programmatically what the FileType(whether it's PC or UNIX) of a text file? Is there any API available?
Please suggest.
Thanks,
Mani
|
|
|
|
|
text files are identical on all operating systems..... UNIX , WINDOWS, LINUX
NG
|
|
|
|
|
Anonymous wrote:
Can we find programmatically what the FileType(whether it's PC or UNIX) of a text file?
AFAIK, txt file is same for every operating system!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
|
As a rule, PC text files use carriage return / line feed pairs (\r\n, or 0x0D 0x0A) to delimit lines, while UNIX machines use line feed only (\n 0x0A).
One approach would be to read the file as binary, and search for \r\n pairs. If you don't find them, try treating it as a UNIX file.
Software Zen: delete this;
|
|
|
|
|
I agree - this is the approach I have used in the past! Brute force and pig ignorance works every time.
I've seen some text files which did line feed / carriage return instead of CR / LF - this confused the hell out of Microsoft Word (Word 97?)! I think they came from a PC which used OS/2 operating system.
|
|
|
|
|
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/[^]
|
|
|
|