|
Hi there,
Do you mean you want to list the groups of the user running your program?
I think the process is (sorry I don't have any example code):
ImpersonateSelf() - to generate an access token for the current process
OpenThreadToken() - to open the access token
GetTokenInformation() specifying TokenPrimaryGroup or TokenGroup as one of the parameters - to get a data structure with group information
Then walk the structure from this last function, looking for the group SID or SIDs.
Finally, to convert a SID to an actual text group name, use:
LookupAccountSid()
Hope this is a pointer in the right direction !
Thanks,
Neil Humphreys.
|
|
|
|
|
|
|
Hi,
I am looking for some neat code to process HTTP Post request content data - i.e. tidy up all those '+'s and '%'s, and split the POST content string into variable name / variable value pairs. I could try this myself, but I do hate reinventing wheels ... can anyone suggest some code to do this ?
Thanks,
Neil Humphreys.
|
|
|
|
|
|
Thanks for the reply.
Your article is a web client, which writes POST requests (presumably). However, I am after web server code, which reads POST requests.
Thanks,
Neil Humphreys.
|
|
|
|
|
Sorry, I should have ready your post more closely before replying. Meanwhile, will this[^] collection of classes help?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
VC++.net : I have a problem, maybe someone can help me.
I try tu make a DLL to use with a client (Cocreate ME10).
I created a Regular DLL with MFC statically linked.
Then i created a CDialog with a CComboBox and a CListbox what i like
to fill with Items from a Database.
In the CDialog Class i created a Control variabel to the CCombobox:
CComboBox m_ctlCbNames;
To make work my modeless Dialog i use :
BOOL WINAPI FilterDllMsg(LPMSG lpMsg)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
TRY
{
return AfxGetThread()->PreTranslateMessage(lpMsg);
}
END_TRY
return FALSE;
}
If i load the DLL in my Client application the Dialog appears without
any Problems.
But if i try to add a string to the Combobox control variabel :
m_ctlCbNames.AddString(_T("Test"));
or
m_ctlCbNames.SetCurSel(0);
then i get the following Error when i call my function in the DLL from
my client program :
Debug Assertion Failed !
...vs70builds\...\afxwin2.inl
Line757
alfred.furer@skynet.be
|
|
|
|
|
I made a very nice duplicate file finding utility for myself a few months ago.
Now I just wanna share it with you guys (altough I am not very sure who would ever require such a tool ! Anyone ?)
However, I just want to add some more features to the basic framework.
The basic engine just creates a hash table of filenames which are kind of open chained using linked list of filenames which have the same MD5/SHA/etc digest (that is, are binary equal)
It currently finds out any duplicate file(s) in/on your directory/drive and deletes all but the file with the most recent timestamp.
That's all I wanted, but I understand that it's the least somebody who seriously wants to use such tool would want !
So please, let me know who might want it, and what feature(s) should I add to it....
Given enough takers, I might write up a nice article to go along with the source code.
In the meanwhile, keep the feature requests rolling in...
Regards
Subhobroto Sinha
http://www.geocities.com/subhobrotosinha
|
|
|
|
|
Hello Freinds,
I want to transfere one structure from client to server. structure contains one String and INT data, INT is the length of that string.
I am trying send(); function of CSocket to transfere the structure but I am getting some garbage at server end and missing my strings address.
Can anyone pl's help me.
I have dought that the function I am using may not be currect.
Thanks.
Dinesh.
|
|
|
|
|
why don't you directly transfered the string to the server!,as recv winsock api returnd with total length of data recieved.
something like this way, i am giving win32 based code
Client End:
char szString="Codeproject";
UINT nszLen=strlen(szString)+1;
send(hSendingSocket,szString,nszLen,0);
Server End
char szString[1024];
int nTotalBufferLen=1023;
int nRecv=recv(hRecvingSocket,szString,nTotalBufferLen,0);
szString[nRecv]=NULL;
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Dinesh, I recommend using CSocketFile and CArchive . They work beautifully!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks Ravi,
I will try this option.
Dinesh.
|
|
|
|
|
Hi friend,
Maybe the problem is that, if you are using TCP/IP protocol, the structure is divided as multiple packets on the network, so you should first send the size of the structure (string + int), then use recv() and check that the number of bytes received are equal to the size of the structure before using the structure, or USE UDP/IP.
something like this:
<br />
int nRecv=0;<br />
<br />
while(nRecv<SizeOfExpectedData)<br />
nRecv+=recv(....);
//now i am sure i received the whole message, not just few packets
//now use the structure
Mohammad Gdeisat
|
|
|
|
|
Hi Mohammad,
Thanks for the help, I will try this option.
Regards,
Dinesh.
|
|
|
|
|
Hi All,
Has anyone of u developed a class which can Transfer a File across LAN.
I have a client Server Application which can Send and Receive messages between them. Now i want to implement the File Transfer.
Looking forward to ur valuable Suggestions..
Thanks.
|
|
|
|
|
|
Hi
have you tried to use the API function defined in Winsock2.h:
BOOL TransmitFile( <br />
SOCKET hSocket,
HANDLE hFile,
DWORD nNumberOfBytesToWrite,
DWORD nNumberOfBytesPerSend,
LPOVERLAPPED lpOverlapped,
LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
DWORD dwFlags <br />
);
it will work faster than any implemented function or class, because it works in kernel mode rather than user mode.
Regards,
Mohammad Gdeisat
|
|
|
|
|
Mohammad A Gdeisat wrote:
BOOL TransmitFile(
Hello Mohammad , i never use the TransmitFile api, i just want to know TransmitFile is use to transmit file, from which api i will recv that File.
thanks
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
hi,
I really have not used this function, but as a sense, i think that the other end should use recv() with a connected socket on appropriate IP and port number.
anyway, this is all i know about it. you can still search for examples on TransmitFile
Regards,
Mohammad Gdeisat
|
|
|
|
|
Hello there,
I'm using Visual C++ 6 with Platform SDK and trying to create a imaging program. The program is simple, where i the user can draw lines on a TIFF image.
I'm using GDI+ for this purpose, but having one problem. The problem is that GDI+ just cannot draw on gray(8-bit)/black & white TIFF images or BMP for that matter. I dont know why. A simple test code is given below,
void CGDIPlusDlg::OnButton8() <br />
{<br />
CDC *pDC=this->GetDC();<br />
HDC hdc=pDC->GetSafeHdc();<br />
<br />
Image img(L"c:\\mspaint.tif");<br />
RectF r(0, 0, 100, 100);<br />
<br />
Graphics gr(hdc);<br />
RectF destRect(0, 0, 100, 100);<br />
<br />
gr.DrawImage(&img,destRect);<br />
<br />
Pen blackPen(Color(255, 0, 0, 0), 3);<br />
<br />
PointF point1(0, 0);<br />
PointF point2(100.0f, 100.0f);<br />
<br />
Graphics gr2(&img);<br />
gr2.DrawLine(&blackPen,point1,point2);<br />
<br />
RectF destRect2(100, 0, 100, 100);<br />
gr.DrawImage(&img,destRect2);<br />
}
The image is created using MSPaint. Create a 100x100 image, draw something, and save as TIF. Save again by changing the image depth to black & white from the Image->Attributes menu.
The program supposed to draw a diagonal line across the image, but it doest for the black&white version of tif.
So, my problem is how to overcome this? Or, how can i programmatically convert a BW TIFF to color and work on it using GDI+?
Oh yeah, can anyone try if this code works fine in C# or managed C++?
Thanks,
Usman
|
|
|
|
|
I have inherited a class from CFileDialog.
OnTypeChange has been overridden with the purpose of changing the direcory when the user changes the filter list.
How do I actually change the current directory?
|
|
|
|
|
|
What is the event message when the user clicks the x in the system menu.
Background:
I have disabled OnCancel() and OnOK() so that in my dialog-based app the esc and return keys don't close the app.
I have the OnFileExit (when user selects file exit) method calling EndDialog(IDOK) directly. What function is called when the user clicks on the x?
Long and short of it is I dont want keyboard commands (other than alt navigation) to close the app.
|
|
|
|
|
JKallen wrote:
What function is called when the user clicks on the x?
Have you looked at OnClose() ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|