|
Use WMI to get what you're looking for. DMI is in a protected low-memory area of the bios and Windows won't let you get at it without writing a device driver to the best of my knowledge.
|
|
|
|
|
I have no idea why. When I create a new SDI or MDI MFC-Application, compile the wizard generated code, open the aboutbox -> crash
It also crashes even if I want to display a simple messagebox.
Would be nice if someone could help me.
|
|
|
|
|
It's hard to help debug without examples of code.
Kuphryn
|
|
|
|
|
It even crashes with the wizard-generated code.
New project. SDI and disabled ActiveX the rest as default. Compile and try to open the aboutbox
I know that he crashs at:
CAboutDlg aboutdlg;
aboutdlb.doModal(); <-- crashes in this function.
I also checked some "learn c++"-example apps and they also crashed when I opened the aboutbox.
I don't understand why it works in dialogapps and not in SDI.
|
|
|
|
|
Try to debug it and check what the debugger stops at when the crash happens. VC6? Have you installed the service packs? What system do you run?
Regards,
BB
|
|
|
|
|
I'm running WinXP and VC.Net
The closest point I could trace the crash is in dlgcore.cpp
in the function CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,CWnd* pParentWnd, HINSTANCE hInst)
at the end of the TRY-part
// create modeless dialog
AfxHookWindowCreate(this);
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate, <- here it crashes
pParentWnd->GetSafeHwnd(), AfxDlgProc);
I don't understand why this function works when the mainwindow opens but crashes when another window is openen like the aboutbox, a dialogbox or just a simple messagebox.
Is there another way to open dialogboxes? Or am I the only one with this problem?
|
|
|
|
|
1. Is hInst an appropriate module handle?
2. Is lpDialogTemplate valid?
3. Is parent non-NULL and also valid? (!!!)
If so, send me a sample project pls.
mail@BartoszBien.com
Regards,
BB
|
|
|
|
|
Im working on a dialog based application. I need use of the arrows keys, but when I add handlers for the keydown events, they are already being handled, so when I use the arrow keys, it only changes the focus to the next button in hte dialog. How do I overide the use of the arrow keys?
Dean and Roy Suck...
Kevin Shaffer
Student of Computer Science
University of Kansas
kshaff03@msn.com
|
|
|
|
|
|
Override CYourDialog::PreTranslateMessage .
Regards,
BB
|
|
|
|
|
Is there a way to open the WinSta0 (default window station) of a specific Terminal Services session?
Specifically, my problem revolves around drawing a System Tray icon in the correct tray whenever a user switches sessions (i.e. in WinXP using Fast User Switching). If I just use the currently open window station, the tray icon does not get drawn. Since there is no way to tell the Shell_NotifyIcon which session to draw in, I need to open the window station of the correct session and have my process use that station instead.
Any ideas?
thanks!
|
|
|
|
|
My brain is hurting on this one....
When I make a call to WTSQuerySessionInformation to retrieve the current WindowStation name, how do i declare the LPTSTR variable (ppBuffer) that I need to pass?
I've tried a few different ways, but I either get a GPF, garbage, or nothing being returned.
Does anyone have a sample of this call in action?
thanks
|
|
|
|
|
LPTSTR pBuffer;
WTSQuerySessionInformation(..., &pBuffer, ....);
//... Do your stuff
WTSFreeMemory(pBuffer);
|
|
|
|
|
Excellent! That worked perfectly.
Thanks again
|
|
|
|
|
I am trying to let a media player control play back a movie continuously unless stopped by user, however, after 23 minutes, the application got a "stack overflow" error.
Anybody can help on this by giving me some ideas on this and related issues? - "stack overflow" and how the MFC/C++ deal with this?
Thanks
JW
DJ
|
|
|
|
|
|
NT/2k/XP have a 1MB stack limit, though I believe it can be extended. However, I can't conceive of a reason to do so. The only reason you would hit this limit are doing huge allocations on the stack with alloca() or other means or you have a recursive function. I'll place bets on the latter.
Note, this is an SEH exception (vs. C++ exception) which you can catch and handle to help direct you to the offending code.
|
|
|
|
|
I will be trying to catch and handle the exception.
But, for this case, it is not anything codes wrong, I just wanted to use a Media Player Control to play back a movie continuously, or for ever unless stopped. The applicaiton could run about 22 munitues before the expection popped up.
For applying Windows Controls, seems I have no way to find out how the Control deal with the Stack. Any more suggestions?
THanks
JW
DJ
|
|
|
|
|
I will be trying to catch and handle the exception.
But, for this case, it is not anything codes wrong, I did not allocate huge blocks on the Stack, nor using recursive functions.
I just wanted to use a Media Player Control to play back a movie continuously, or for ever unless stopped. The applicaiton could run about 22 munitues before the expection popped up.
For applying Windows Controls, seems I have no way to find out how the Control deal with the Stack. Any more suggestions?
THanks
JW
DJ
|
|
|
|
|
The only reference I could find on the web is that the older control has an unchecked strcpy in it which can overright the stack. This is a third way to overflow the stack: create an artificial recursive function, but it's rare since it usually throws other types of exceptions (though I've had it happen to me.)
Could their also be a callback not being handled/exited correctly (it's not these controls have the greatest of documentation for their esoteric aspects)?
|
|
|
|
|
The exact message for the exception is :
Unhandled exception in VTS_01_ALL.exe(MSDXM.ocx):0xC00000FD: Stack Overflow.
DJ
|
|
|
|
|
CreateProcessAsUser driving me crazy
I need to have my program launch another program (test.exe) as another user (dummyuser). My code works until I get to the point of actually launching the test.exe program. At that point I get a 0x522 error - A required privilege is not held by the client.
If I log in as dummyuser, the I can run the test.exe program without problem. So, I believe the user has the permissions it needs
I've also tried an example from MSDN, and two from bulletin boards. All have the same problem.
My code relies on default values for some of the gory details, like winstation and desktop. The sample code I tried implemented them in detail with the same result. So, I don't think that's the problem.
I can't understand the difference between what my program does and what happens if I login in as dummyuser.
Here's my latest code:
code:--------------------------------------------------------------------------------
HANDLE h;
if( !LogonUser("dummyuser","dummydomain","dummypassword" ,LOGON32_LOGON_INTERACTIVE,LOGON32_PROVIDER_DEFAUL
T, &h))
{
DWORD dwErr = GetLastError();
return FALSE;
}
char * buffer = (char *) malloc(256);
DWORD size = 256;
if (GetUserName(buffer,&size))
{
TRACE0( buffer); /// This shows my original user name
TRACE0("\r\n");
}
if (!ImpersonateLoggedOnUser(h))
{
DWORD dwErr = GetLastError();
return FALSE;
}
size = 256;
if (GetUserName(buffer,&size))
{
TRACE0( buffer); /// This shows current user is dummyuser
TRACE0("\r\n");
}
STARTUPINFO st;
memset(&st,0,sizeof(st);
st.cb = sizeof(st);
//"\\Odyctx00\dDesktop\odyssey17.exe"
PROCESS_INFORMATION pi;
if (!CreateProcessAsUser(h,"C:\\test.exe" ,"",
NULL,NULL,FALSE,0,NULL,NULL,&st, &pi))
{
DWORD dwErr = GetLastError(); /// dwErr = 0x522
return FALSE;
}
--------------------------------------------------------------------------------
Thanks for any help or advice on this one. Its been driving me nuts.
|
|
|
|
|
I have two threads that need to insert new items to the same tree control on win nt.
If the windows tree control thread safe or should I synchronize the insert operation ?
Actually it would be easier to ask it like this.
Is ::InsertItem api that is used to insert new items thread safe ?
Does windows synchronize the operation ?
Thanks,
Orcun Colak
|
|
|
|
|
If you are using MFC, the objects are not thread-safe at the object level, only at the class level.
|
|
|
|
|
If you use SendMessage or PostMessage the control is thread-safe, because Windows guarantees that message handling is thread-safe. The MFC objects that wrap controls (like CTreeCtrl ) do not work across thread boundaries.
Software Zen: delete this;
|
|
|
|