|
hi..i have a project, designing a pci driver using C++..where should i start?can some one give me an idea?which C++ is suitable for designing pci driver?...can someone help me? i really appreciate it a lot..
|
|
|
|
|
I assume you are working on windows and not linux.
nmelah wrote:
which C++ is suitable for designing pci driver
MS Visual C++ 5.0 or greater.
nmelah wrote:
where should i start?
Obtain the microsoft DDK.
John
|
|
|
|
|
If this is not a personal project, try to acquire Compuware's DriverStudio 3.0. This provides a C++ framework for writing WDM/Legacy drivers. This along with VC++ 6 (SP5) should give you a jump start.
|
|
|
|
|
|
;PHello all,
I am using CTreeCtrl and when creating items and I am storing a LPSTR into the lParam of the TVITEM struct. When I need to clear the contents I need to free the memory allocated but to get the pointers I need to traverse all items in the tree ctrl but could not find any easy way to do it. Can anyone guide me? Will the method that i write be recursive or can i write a non recursive function?
I need to get each item data in the tree and then free the memory and then I can call DeleteAllItems on the tree.
Thank you
Memory Leaks are very dangerous.;P
|
|
|
|
|
|
Micheal, If the treeitem contains child notes that has allocated memory for lparam, will i get notification for each childitem when i delete its parent item.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
|
Wow, Thanx again micheal, this method replaced my (quite complex) recurrsive way of deleteing the child items
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
Thank you very much Mike works very well. I have read your articles on this site and find them very good. I admire you. Thanks once again.
But one more question I am using a ActiveX control and allocating it on the heap. I create it by calling Create(). When i free the memory the GDI object handles and USER object shown in process viewer decreases but not to the count it was before I do the creation operation If i try to call DestroyWindow() it gives assertion error. Why is it so? What should i do to decrease the GDI object and USER object count as it increases with usage time.
|
|
|
|
|
The most common mistake is forgetting to select pens/bitmaps/etc. out of a device context. For ex. if you do this (pseudo-MFC code here, since I'm in a hurry )
CPen p (RGB(255,0,0));
dc.SelectObject(p);
dc.MoveTo(0,0);
dc.LineTo(100,100);
p.DeleteObject(); the pen will not be deleted because it's still the active pen in a DC.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
You cannot truly appreciate Dilbert unless you've read it in the original Klingon.
|
|
|
|
|
Hi guys,
is there a way to have CButton defaulted as push button types (BS_PUSHBUTTON, BS_PUSHLIKE), when create/drop them in layout window? I couldn't seem to set it in property window, am I missing something?
Thanks
|
|
|
|
|
dereive a class from CButton as CMyButton. override the create method and pass the flags as required, then use ur button where ever cbutton is used. this way you can minimise the no of parameters passed to create a CButton.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
Thanks for the reply, Mr. Prakash.
As my app only has two buttons needed to be push button type, I thought I could quickly "set" them in the OnInitDialog(), like following
m_StaButton.SetButtonStyle(BS_PUSHLIKE, TRUE);
m_StoButton.SetButtonStyle(BS_PUSHLIKE, TRUE);
m_StaButton and m_StoButton are DDX controls to the buttons on the dialog. As you'd expect, they don't seem to work. I am not sure if I understand why..
|
|
|
|
|
I tried searching for BS_PUSHLIKE button style, dont know wheather it exists??? but the code seems quite rite nothing wrong in it.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
So to my understanding, I can set the button's style and it will change dynamically in my dialog, without having to destroy and re-create the button like this
CRect buttRect;
m_StaButton.GetWindowRect(&buttRect);
m_StaButton.ScreenToClient(&buttRect);
m_StaButton.DestroyWindow();
m_StaButton.Create("Start Print", WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE, buttRect, this, IDC_STARTPRINT);
maybe the method from my previous post work, I just didn't realise what BS_PUSHLIKE should look like...I will try other styles..
Thanks again
|
|
|
|
|
Yes, ( i am not sure, never tried it) your button style can be changed by setting the style....
although this method of destroying and recreating will also work.
Hey after all this is a programming language, you can do the same thing in different ways, but the best way is the effcient way.
regards,
prakash
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
How does one find out if items right clicked
is a file class or folder class?
Thank You
Bo Hunter
|
|
|
|
|
Hi Hunter,
Hope this will help you.
WIN32_FIND_DATA wFindData;
ZeroMemory(&wFindData,sizeof(WIN32_FIND_DATA));
hResult = SHGetDataFromIDList(pShellFolder,pPIDL,SHGDFIL_FINDDATA,&wFindData,sizeof(WIN32_FIND_DATA));
In this, pShellFolder is the Address of parent folder and pPIDL is the PIDL corrosponding to the selected item.
if (wFindData.dwFileAttributes && FILE_ATTRIBUTE_DIRECTORY) {
// It is a directory!.
}
else {
// It is a file!.
}
Regards
Dinesh
|
|
|
|
|
I have an exporting function in a dll and have to use a
<vector> pointer as parameter.
"
extern "C" __declspec( dllexport ) unsigned int func
(vector<int>* const vIndex)
{
for(int i=0; i<n; i++)
="" vindex-="">push_back(i);
}
"
calling application will call the function as follow:
"
....
vector<int> vIndex;
unsigned int iResult = func(&vIndex);
....
"
I am using Vstudio.net 2003
If I use MFC in a shared dll and Runtime library
with /MDd option on both DLL and calling application,
everything is fine. If I use MFC in a static library and
Runtime library with /MTd option on both DLL and calling
application, there's a problem in the vector destructor,
desctructor could not deallocate the memory.
Could someone help me? This is an emergency!!!
Thank you.
|
|
|
|
|
You've hit upon the problem and solution yourself.
If the dlls in an application are linked against the static C runtime, then any allocation/deallocation will occur in a different heap for each module. If one module tries to deallocate memory that was allocated on a different module, the heap will know nothing about it, and crash when you try and do it.
There are two main alternatives:
1. Use a shared heap, via the DLL C runtime, rather than the static one, and for MFC, this will mean using the shared MFC rather than the static ones.
2. Always ensure that any memory allocated is always deallocated in the same module. This forces you to be extremely careful with the STL, so that probably isn't a viable solution for you.
|
|
|
|
|
How to read and edit the id3 tag for a wma file?
There are functions in the windows media SDK to do it but this involves linking in to a pretty big library for what is a simple operation.
Does anyone know how to do this simply?
|
|
|
|
|
Are they really ID3 tags ? If so, heaps of code exists to do it.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
ye, but almost all the id3 tags info is for MP3 files,not for wma file. The structure is different. And maybe I haven't found the right space for wma files. If you knew some info, could you tell me? I want the info for wma files. Thanks a lot.
|
|
|
|
|
If the structure is different, then it's not an id3 tag, is it ?
I have no idea how they are encoded then.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|