|
If this is a SQL Server app, I would suggest looking at the TSQL function IS_MEMBER ({'group' | 'role' }). This provides rights / membership checking of both WindowsNT groups and SQL Server Roles.
Otherwise, you can use the NetGroupXXX functions, but your app needs to be running under certain priviledges and this is a pain.
onwards and upwards...
|
|
|
|
|
|
|
Anyone know if there is some API for the zip features in XP?
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
_Magnus_ wrote:
Anyone know if there is some API for the zip features in XP?
I don't think so. There are several articles here at CP re. zip/unzip and you can also look at Crypto++ which has this.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I don't quite understand how a buffer works.
I have a PCI card that uses reflective memory
Reflective memory is memory that is connected through a daisy chain on fiber optics, when one PC writes to the memory on the PCI card then the rest of the computers on the daisy chain can read what was written in realtime or as close as you can get to it.
I hope that makes sense.
I am able to choose at what offset I want to start writing data to the PCI cards memory.
ex. offset 0x40 from the beginning of the cards memory.
Then on another PC I can go read the data at that offset 0x40.
The data structure that I have created is that needs to be written to memory is:
The data is continious.
<br />
<br />
struct TSimHeader<br />
{<br />
int SimWriteFlag; <br />
int DisplayReadFlag; <br />
int SignalCount; <br />
int SimStatus;<br />
long TimeStamp;<br />
};<br />
<br />
struct TSimSignal<br />
{<br />
double Min[45]; <br />
double Max[45]; <br />
double Value[45]; <br />
char *Name[45];<br />
char *Unit[45];<br />
};<br />
The functions that read and write the data use a buffer to write and read from (char or int or double or long buf[1024])
How can I put these 2 structures in this buffer so that on the otherside when I read in the data I am able to parse it back out of the structure?
Thanks,
sj
|
|
|
|
|
How about creating a structure
struct TSimBlock<br />
{<br />
TSimHeader header;<br />
TSimSignal signal;<br />
}<br />
then a variable
<br />
TSimBlock *BlockPtr;<br />
then set TBlockPtr to point to the data in the card on the other side and read it for eaxmple by
<br />
i = BlockPtr->header.SimWriteFlag;<br />
Hope I've got all the indirection right, haven't run the code myself.
Elaine
The tigress is here
|
|
|
|
|
Makes sense. I just created a type exactly like the struct that was written.
I then casted the data to the struct type on the other side.
I am then able to read the data just as I was writing it.
Thanks,
For showing me the way.
Sj
|
|
|
|
|
Hello,
I am trying to colorize specific rows of my list control. For this I use the OnCustomDraw member function of CListCtrl to select the color before Windows draws the item. This works very nice, except that the icon's background isn't drawn correctly.
See this screenshot:
http://home.tiscali.de/reichl/temp.jpg[^]
As you can see, the row is highlighted correctly, but the icon's background remains white.
How can I draw the icon's background?
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Did you try drawing the background in OnCustomDraw() during the CDDS_ITEMPREPAINT notification? If that doesn't work, try an earlier notification, such as CDDS_ITEMPOSTERASE or even CDDS_ITEMPREERASE (not recommended, but it might work).
Or is the problem that Windows is drawing the white background no matter what you do? If that's the case, the best thing to do would probably be to get the control to draw in a memory DC and change the colour yourself, although that would probably require full owner-draw.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I tried preerase and posterase, but both don't work. The background remains white. Seems as I really have to draw it myself
Anyway, thanks for your help
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
OK, I just happened to look at Michael Dunn's article on list view custom draw (http://www.codeproject.com/listctrl/lvcustomdraw.asp[^]) and he does this by redrawing the icon in CDDS_ITEMPOSTPAINT and returning CDRF_SKIPDEFAULT. It flickers a bit, but not too much.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Ok, I'll try this.
Thanks
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
You could specify an overlay mask which would colorize the background as you wish.
onwards and upwards...
|
|
|
|
|
Hi,
Still learning and playing with MFC...
Is there a way that I can set the number of columns in a list box? Also, if this is possible how do you put column headings in a list box?
Thanks in advance.
|
|
|
|
|
Have a look at CListCtrl instead. There are some good samples here http://www.codeproject.com/listctrl/[^]
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
There are two types of function to extract a text in the list item in CListCtrl.
One is
CString GetItemText( int nItem, int nSubItem ),
and the other is
int GetItemText( int nItem, int nSubItem, LPTSTR lpszText, int nLen ).
In case of using the first function,
it looks like it can only extract 256 bytes,
even the text is over 256 bytes.
It is OK for second function.
I don't know why the length is limited for CString.
Any idea to resolve this problem with CString?
Should I use second function?
Thanks.
|
|
|
|
|
Perhaps the first function uses the second with a length value of 256 ?
Probably easiest to write your own function which is equivalent to the first but with a larger length limit.
Elaine
The tigress is here
|
|
|
|
|
OK, that's no problem but what happened to CString, is it bug or not?
Thanks.
|
|
|
|
|
Its not a bug in CString, its the function that returns CString. They have to call the original function and in the course of that add the length parameter. And thinking that 256 chars would have been enough....
If you look at the library code there will be a GetBuffer(256) statement with the length also set to 256. Make sure these match in your code or you could get an overflow.
Elaine
The tigress is here
|
|
|
|
|
What are you using to verify the length of the CString object? Have you stepped into CListCtrl::GetItemText() to watch how it is behaving?
|
|
|
|
|
I just used GetLength() to check the length of the returned CString object.
The return value is 256.
The length of the text in the CListCtrl is surely over 256 bytes.
The second function can extract whole text when the last parameter nLen
is large enought to hold whole text.
Thanks.
|
|
|
|
|
Ok, but did you step through the MFC code?
|
|
|
|
|
With your advice, I looked at the MFC code.
The function was defined as follows.
CString CListCtrl::GetItemText(int nItem, int nSubItem) const
{
ASSERT(::IsWindow(m_hWnd));
LVITEM lvi;
memset(&lvi, 0, sizeof(LVITEM));
lvi.iSubItem = nSubItem;
CString str;
int nLen = 128;
int nRes;
do
{
nLen *= 2;
lvi.cchTextMax = nLen;
lvi.pszText = str.GetBufferSetLength(nLen);
nRes = (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem,
(LPARAM)&lvi);
} while (nRes == nLen-1);
str.ReleaseBuffer();
return str;
}
At first look at, it looks like to extract whole text using do-while statement.
But in my code, nRes is 256, so do-while is applied only one time.
|
|
|
|
|
I used the following code snippet and both TRACE() calls output 300:
CString str;<br />
int len;<br />
str = "12345678901234567890123456789012345678901234567890";<br />
str += "12345678901234567890123456789012345678901234567890";<br />
str += "12345678901234567890123456789012345678901234567890";<br />
str += "12345678901234567890123456789012345678901234567890";<br />
str += "12345678901234567890123456789012345678901234567890";<br />
str += "12345678901234567890123456789012345678901234567890";<br />
len = str.GetLength();<br />
TRACE("len = %d\n", len);<br />
ctrlList.InsertItem(0, str);<br />
str.Empty();<br />
str = ctrlList.GetItemText(0, 0);<br />
len = str.GetLength();<br />
TRACE("len = %d\n", len);
|
|
|
|