AfxMessageBox() will use 'm_pszAppName' as the title name. The best way is to use MessageBox(). If you want to use resource as input message, here's an example: int MyMessageBox(UINT nIDPrompt,LPCTSTR lpszTitle, UINT nType) { HMODULE hThisApp; DWORD dwLen,dwBufSize; int nResult; hThisApp=AfxGetInstanceHandle(); _TCHAR *lpszText=NULL; dwBufSize=0; do { delete [] lpszText; dwBufSize+=256; lpszText=new _TCHAR[dwBufSize]; dwLen=LoadString(hThisApp,nIDPrompt,lpszText,dwBufSize); } while((0!=dwLen)&&(dwLen+sizeof(_TCHAR)==dwBufSize)); nResult=MessageBox(GetActiveWindow(),lpszText,lpszTitle,nType|MB_TASKMODAL); delete [] lpszText; return nResult; } Best Regards, K Wan
khehwan
Posts
-
AfxMessageBox() -
Access Disk Sector for non-admin userThanks for pointed out my mistake and confusion. Basically, what does the service do in this problem? Can the service use 'CreateFile' to access the disk sector for non-admin user? Since the security context for file system root (eg: 'c:','d:') will be lost every time we restart the computer, how do we solve this problem? More hints and guides for me? Thanks!
-
Access Disk Sector for non-admin userHi, Currently, I need to do read/write on disk sector under Win2000/XP. I found out that the statement below is only valid for administrator. hDisk=CreateFile("\\\\.\\C:", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL); ... For non-admin user, the above statement will always return hDisk=INVALID_HANDLE_VALUE. My question is how can we solve this problem? Can we assign access right or privilege in our program in order to access disk sector? or do we need to develop VXD to solve this problem? Hope that some of you can give me some hints. Thanks in advance! Best Regards, K Wan