|
Using windows address book, its possible to search active directory for a group or user, right click on it and show the properties.
Can anyone point me in the right direction for this, or possibly give me a clue so I can work it out myself?
Regards
Martin
|
|
|
|
|
I have no idea if this is the right direction, but hopefully it's a possible clue...
Active Directory Domain Services[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for your suggestion, and sorry for writing a completly useless message to describe what I'm trying to do. No-one in the world could figure out what I meant by that, having read back my original message.. It has been a long week!
I am actually trying to programmatically open the properties dialog of a security group or user.. the same dialog which would be displayed by following the steps I descibed before. That is..
Windows Address Book, Edit, Find people, typing in either a user name or a group, right clicking on it and choosing properties.
I am interested in any advice in at the very least locating which dll might be responsible for displaying this dialog.
And if anyone actually has a way of programatically showing this box given maybe an ads path, etc, that would be perfect
Regards
Martin
|
|
|
|
|
hi, i'm a beginner in both MFC and multithreading.
i created a dialog and in my CMy61xxTestDlg.h, i declared:
UINT __cdecl Start(LPVOID pParam);
// CMy61xxTestDlg dialog
class CMy61xxTestDlg : public CDialog
{......
and in my cpp file, i have
hDrv=0;
CWinThread* pThread=AfxBeginThread(Start,(UINT)hDrv,THREAD_PRIORITY_BELOW_NORMAL);
i got error like:
error C2665: 'AfxBeginThread' : none of the 2 overloads could convert all the argument types
.....\afxwin.h(4202): could be 'CWinThread *AfxBeginThread(AFX_THREADPROC,LPVOID,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)'
.....\afxwin.h(4205): or 'CWinThread *AfxBeginThread(CRuntimeClass *,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)'
while trying to match the argument list '(UINT (__cdecl *)(LPVOID), UINT, int)'
could anyone help me with this?
thx!!!
|
|
|
|
|
Two possibilities I see...
1) Start is a non-static member function
2) hDrv should be cast to a LPVOID, not a UINT
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hmm...isn't a start a global function?
|
|
|
|
|
If yes then ignore #1
I meant those were two possible reasons for the error based on what I could see.
I put #1 just in case you had it declared inside a class.
Did fixing the cast work then?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
yes! it worked, now i only got a warning C4312: 'type cast' : conversion from 'int' to 'LPVOID' of greater size
I hope this warning doesn't affect anything.
Thanks!
|
|
|
|
|
You get a warning if you do it like this?
CWinThread* pThread=AfxBeginThread(Start,(LPVOID)hDrv,THREAD_PRIORITY_BELOW_NORMAL);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
yes, the warning is warning C4312: 'type cast' : conversion from 'int' to 'LPVOID' of greater size
i think it's because hDrv was declared as int
|
|
|
|
|
Ohh it's a 64-bit compatibility warning
You can use the LONG_PTR type instead of int or disable the warning if you want to.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
ok...thanks!
and 1 more question regarding start() function,
i need to use the function and variable in the my CXXXDlg class, what's the syntax for that?
say what if i want to use the m_CListBox.AddString function, m_ClistBox is the CListBox object declared in the CXXXDlg class
-- modified at 17:08 Friday 27th July, 2007
|
|
|
|
|
Typically you'd pass a pointer to the class object to the thread.
In the thread proc, cast the LPVOID back to a pointer to the object.
In your case, a pointer to the dialog class object that creates the thread is probably appropriate.
The thread proc can be a static member of the class.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How would you implement a critical section between two or more windows in a single thread, i.e. if one winproc tries to access it, it halts in place till its available, while other windows in thread continue to function and continue to recieve messages. I know CriticalSections work for threads, not windows - I was thinking of something implemented with GetMessage, PeekMessage or whatever. Maybe this is impossible.
|
|
|
|
|
If you only have one thread there's no way to halt that thread and have anything else happen in your windows or window proc(s) (aside from asynchronous
callbacks, of course, but those are separate threads).
With a single thread, while a windowproc is handling a message, all other window procs are halted.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: If you only have one thread there's no way to halt that thread and have anything else happen in your windows or window proc(s) (aside from asynchronous
callbacks, of course, but those are separate threads).
With a single thread, while a windowproc is handling a message, all other window procs are halted.
Well, if a resource is unavailable, why couldn't a WinProc start a GetMessage-Translate-Dispatch loop right there until a special message was sent indicating the resource was available, at which point the WinProc would halt the GetMessage Loop and continue as normal. I'm not understanding why this doesn't work.
|
|
|
|
|
Because that "GetMessage-Translate-Dispatch loop" is running on the same thread you start it on. Everything occurs serially until there's another thread.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am experimenting in OpenGL and want to switch between full screen mode and windowed mode. I have code that does this, but I think ALT + ENTER is a standard key combination for this function so I want to add it in my code. I tried processing WM_KEYDOWN messages, but I'm not sure what key code to look for. I am not even sure if I am processing the right message.
Any suggestions?
|
|
|
|
|
For WM_KEYDOWN, something like this
if (VK_RETURN == wParam)
{
// enter
if (0 > ::GetKeyState(VK_MENU))
{
// alt-enter
}
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark, but it does not work consistently. The first time I press the combination it works, but after that it does not. I also use F11 and that works flawlessly.
I tried printing wParam and lParam to a file to see what is generated and it does not even show the codes for the WM_KEYDOWN events which make me wonder if it is being processed under a different message. Any Ideas?
Code snippets as follows...
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
...
case WM_KEYDOWN:
...
OnKeyDown(wParam, lParam);
break;
...
}
...
}
...
void OnKeyDown(int pKeyCode, DWORD pFlags) {
...
switch (pKeyCode) {
case 122:
...
DestroyWin();
CreateWin();
break;
case VK_RETURN:
if (GetKeyState(VK_MENU)) {
...
DestroyWin();
CreateWin();
}
break;
}
}
|
|
|
|
|
The keyboard messages go to the window with keyboard focus. If your WndProc is the only window proc
for all your windows, you should get all of them, except ones that go to windows of classes that aren't
yours (e.g. un-subclassed controls). Is focus going to another window?
I'm not sure how WM_KEYDOWN/VK_F11 could work flawlessly but you don't receive WM_KEYDOWN/VK_RETURN.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I only defined one WndProc() and created only one window. However, I am not experienced enough to tell if windows were defined somewhere else without my knowledge. Its a basic application skeleton with no controls yet.
I tested again and realised that the sysmenu (the one to the top left of the screen that is attached to the window's icon) activates when I hold down the alt key. Maybe this is responsible? Interestingly "CTL + ENTER", "SHIFT + ENTER" and "ENTER" work, which is not the behaviour I was expecting.
|
|
|
|
|
Try using WM_SYSKEYDOWN instead of WM_KEYDOWN for ALT key combinations.
Better yet, try this for ALT-ENTER:
case WM_SYSCOMMAND:
if (SC_KEYMENU == (wParam & 0xFFF0))
{
// alt - enter
}
else
{
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I need to develop an application that records sound amplitude and plot in on a graph with a function of time, using a microphone. Is the best approach to do this using DirectSound. If so is there any sample code that is available for this, or some kind of tutorial.
Thanks in Advance.
|
|
|
|
|
Either DirectSound or the Windows Multimedia APIs will work. If you choose DirectSound then download the latest
DirectSound SDK and you'll find sample apps to get you started, along with documentation. The "CaptureSound Sample"
is a good start
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|