|
Yes, I got it... Thank you very much.
- NS -
|
|
|
|
|
How to use DeviceIOControl to read,wrire ... sector . My teacher asks me for imitating absread,abswite... of Boland C by DeviceIOControl of Visual C .
Thank you a lot
imagic
-- modified at 20:12 Sunday 11th December, 2005
|
|
|
|
|
Hello.
You don't need DeviceIOControl to do that.
Just use ordinary functions, like CreateFile, ReadFile, WriteFile, CloseFile and SetFilePointer.
As this is a school-project, I won't give you too much information, but I can tell you this:
1.
The least bit of information you can handle (read, write and seek to) is a disk sector!
A disk sector is (normally) 512 bytes.
2.
You open a volume (unit) by using the name "\\.\<x>:" where <x> is the drive in question.
\\.\A: Opens drive A (floppy drive).
\\.\C: Opens drive C (volume).
3.
All information is available at MSDN (msdn.microsoft.com).
Good luck. The assignment should be fairly easy to accomplish.
Kakan
-- modified at 6:21 Monday 12th December, 2005
|
|
|
|
|
Hi
I have written a Reliable Multicast Protocol, which all works fine except that the protocol processing thread and the Media timer used will sometimes stop for up to 400mS which causes a prolem. I have changed thread priorities and Virtual Locked memory to prevent paging delays. I would realy like some suggestions as to the best implementation for this project, should it be written as a standalone process?
TIA
Richard
|
|
|
|
|
What are you using the media timer for ?
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hi
The media timer is used for process timouts/RTT packet time stamping etc. I had initialy used TimerQueueTimers but found them to be not very acurate at high resolutions.
|
|
|
|
|
RKRobinson wrote: The media timer is used for process timouts/RTT packet time stamping etc.
So you are just using it to get an accurate 'current time' stamp.
I was wondering if you were using it as part of a loop.
I'm sure you realize Win is a preemptive OS - the kernel schedules when threads run.
Any priority boost you specify is taken as a suggestion by the kernel.
There is no real way to guarantee time for a thread.
Currently, the most scalable/responsive I/O systems are built around IOCP (I/O completion ports).
Len Holgate, and others, have written comprehensive articles about IOCP here: http://www.codeproject.com/internet/[^].
...cmk
Save the whales - collect the whole set
|
|
|
|
|
im sorry im really new to the windows media format sdk...
by looking at the WMSyncReader sample that came with the sdk
i have learned how to set up the WMSyncReader and everything
but i still have this question
it seems that WMSyncReader::GetNextSample() uses an INSSBuffer interface
to store audio data when i invoke it.
How can i take the data from an INSSBuffer into, say, a byte array?
Also, how do you get the audio format of the stream? Maybe WMProfile? or WMStreamConfig?
any answers are highly appreciated
thanks!
|
|
|
|
|
When I wrote:
<code>typedef CMap<CString,CString, int, int > MyType;
MyType myType;
</code>
I got the following error:
error C2440: 'type cast' : cannot convert from 'CString' to 'DWORD_PTR'
do you know why ?
Thanks in advance
Udi Raz
-- modified at 11:03 Sunday 11th December, 2005
|
|
|
|
|
Your declaration is invalid, probably because you have tried to use the <> signs without ticking the 'Ignore HTML tags in this message'.
I Dream of Absolute Zero
|
|
|
|
|
OK, Thanks, fixed it..
Udi Raz
|
|
|
|
|
This is just a guess, but I think the message means it cannot convert your CString class to a unique hash key. If you try:
<br />
CMap<CString*, CString*&, int, int&><br />
Then that compiles. You just have to remember to delete your allocated references. It probably uses the object's address as the hash key.
Personally, would use the stl's map class.
I Dream of Absolute Zero
|
|
|
|
|
you need to use CMap<cstring,lpctstr,int,int> MyType;
|
|
|
|
|
I think the second parameter needs to be a CString*. However, you'd do better to use std::map, CMap is hideous.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
If you look at the definition of CMap, you'll see the following:
<br />
CMap<KEY, ARG_KEY, VALUE, ARG_VALUE><br />
The KEY and VALUE are the data types you're mapping. In your case, KEY = CString and VALUE = int.
The ARG_ types are the types used in argument passing within CMap. The code that calculates the hash used for lookups is found in the GetAssocAt function of the CMap template:
<br />
CMap<KEY, ARG_KEY, VALUE, ARG_VALUE>::GetAssocAt(ARG_KEY key, UINT& nHashBucket, UINT& nHashValue) const<br />
The exact line of code that calcuates the hash is here:
<br />
nHashValue = HashKey<ARG_KEY>(key);<br />
With your map declaration, the line translates to:
<br />
nHashValue = HashKey<CString>(key);<br />
If you search for HashKey in the Visual Studio folder, you'll see that Microsoft has defined a handful of HashKey functions for various data types:
<br />
UINT HashKey(WORD key) const;<br />
UINT HashKey(void* key) const;<br />
UINT HashKey(void* key) const;<br />
UINT HashKey(WORD key) const;<br />
UINT HashKey(LPCTSTR key) const;<br />
UINT HashKey(LPCTSTR key) const;<br />
UINT HashKey(LPCTSTR key) const;<br />
<br />
etc...<br />
<br />
You'll also notice that there isn't a HashKey defined for CString. This is why you're getting the 'cannot convert' error. The compiler does not know how to convert from a CString to a DWORD_PTR, which is the default implementation of HashKey.
In the case of CString, there are two ways to solve the problem:
1) Define your own custom HashKey routine for CString, as described in the article http://support.microsoft.com/default.aspx?scid=kb;en-us;158541
2) The simple solution - use LPCTSTR (which has a HashKey provided by Microsoft, and has a casting operator defined in the CString class) as your argument key in your CMap declaration:
<br />
CMap<CString, LPCTSTR, int, int> myMap;<br />
Bernie (Boom Boom) Geoffrion worked Atlanta Flames games in the 1970s with the splendid Jiggs McDonald. One night, Geoffrion said, "Jiggs, there are only three things to hockey: shooting and skating." McDonald said, "Right, Boomer. And what's the third?" The exasperated Geoffrion replied," Jiggs, that's the three. Shooting. And. Skating."
|
|
|
|
|
udiraz wrote: typedef CMap<cstring,cstring, int,="" int=""> MyType;
MyType myType;
thats why i prefer STL:: MAP
"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
|
|
|
|
|
Hi all
The problem is :
I have a big project written under unix and split in different directories with a makefile in each one.
The files are both compilable with gcc and visual c++ converter.
But there is no project for visual c++.
The problem is to build a visual c++ project using the hundred of makefiles
By hand it is very tricky
Before trying to build a tool myself i would lake to know if there is some thing like that
a sort of mak2dsp or mak2sln .... to import may makefiles under visual c++ environnment
with recursion in all my subdirectories
Send your answer please
thx
j
|
|
|
|
|
hoops
read
"The files are both compilable with gcc and visual c++ compiler"
j
|
|
|
|
|
visual studio 2005 pro comes with a makefile reader
IM PROUD TO BE A GMAIL;
|
|
|
|
|
i dont have visual studio 2005 pro
j
|
|
|
|
|
Hi,
My application has a list control into which i populate some files ,since at a time only five files can be seen(due to the height of the listcontrol) the user will scroll it down using the down arrow but when he does that the elements look distorted ,wat could be the problem.
Thanx in Advance
FarPointer
|
|
|
|
|
Hi,
I need to create a CListCtrl icon style with buttons instead of the icons. Does anyone know how to do this? I have looked for articles on this, but can't seem to find anything.
Any help appreciated,
Royce
|
|
|
|
|
I really do not understand why would you need a button in a CListCtrl. I haven't seen anything like that, however this[^] or this[^] may help you.
Regards,
Rajesh R. Subramanian.
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Rajesh,
Thanks for your help. However, both of these articles (and all of the others that I have seen) address custom drawing in a report or list style CListCtrl, but not in an icon style control. I need to the behavior of the icon style, but with buttons instead of the icons. My application needs to allow a co-pilot or flight engineer to push a button with a gloved finger. Each button, when pushed will invoke functionality specific to the button. The bitmap button works well for this purpose as I need to change the button's appearance, i.e., bitmap, text, background color, etc., depending on the aircraft selected. (I have tried to put a screen shot here to show you, but couldn't get the GIF to show up.)
Royce
|
|
|
|
|
Now I want to display a gif picture using CPictureEx, and I encapsulate the class into Acitve control. when the view is changed, I use follow code to redraw the picture :
if (pImg->m_spAdviseSink)
{
pImg->m_spAdviseSink->OnViewChange(1, -1);
}
and the render function is:
m_arrFrames[m_nCurrFrame].m_pPicture->Render(m_hMemDC,
m_arrFrames[m_nCurrFrame].m_frameOffset.cx,
m_arrFrames[m_nCurrFrame].m_frameOffset.cy,
m_arrFrames[m_nCurrFrame].m_frameSize.cx,
m_arrFrames[m_nCurrFrame].m_frameSize.cy,
0, hmHeight, hmWidth, -hmHeight, NULL);
but now if I scroll the scroll bar to half of the picture, essentially the richedit would display half of the picture ,but now it display entire picture.
|
|
|
|
|