|
I'm looking for a way to bring up the security dialog (as in file + properties) when I create a file or entry in the registry. I want to give the user a possibility to change the permission (who and what kind of access) of a file/registry entry. Is it possible?
Thanks/Regards
Magnus
|
|
|
|
|
I want to build the function which shows me the on NT work stations .Whether user or adminstrator.
I have build the applications which shows me user and server name.
|
|
|
|
|
i write the following code, but i can't remove the help/OK/Cancel button in the Property Sheet, and i also caanot
resize the PSP why ???
#include "menu.h"
BOOL CALLBACK DlgProc_0(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK DlgProc_1(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam,LPARAM lParam);
void MakeProp(HWND hWnd);
//
// Main
//
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
HWND hWnd = GetActiveWindow();
MakeProp(hWnd);
return 0;
}
void MakeProp(HWND hWnd)
{
HINSTANCE hInst;
PROPSHEETPAGE psp;
PROPSHEETHEADER psh;
HPROPSHEETPAGE hpsp[2];
hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
psp.dwSize = sizeof(PROPSHEETPAGE);
psp.dwFlags = PSP_DEFAULT;
psp.hInstance = hInst;
psp.pszTemplate = "DLG0";
psp.pfnDlgProc = (DLGPROC)DlgProc_0;
hpsp[0] = CreatePropertySheetPage(&psp);
psp.pszTemplate = "DLG1";
psp.pfnDlgProc = (DLGPROC)DlgProc_1;
hpsp[1] = CreatePropertySheetPage(&psp);
memset(&psh, 0, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_USEICONID|PSH_NOAPPLYNOW;
psh.hInstance = hInst;
psh.hwndParent = hWnd;
psh.pszIcon = NULL;
//psh.nPages = sizeof (psp) / sizeof (PROPSHEETPAGE);
psh.nPages = 2;
psh.phpage = hpsp;
psh.pszCaption = "Multiplex";
HWND hPropSheet = (HWND)PropertySheet(&psh);
ShowWindow(GetDlgItem(hPropSheet,IDHELP),SW_HIDE);
ShowWindow(GetDlgItem(hPropSheet,IDOK),SW_HIDE);
ShowWindow(GetDlgItem(hPropSheet,IDCANCEL),SW_HIDE);
MoveWindow(hPropSheet,100,100,320,200,TRUE);
return;
}
//
// DLG0
//
BOOL CALLBACK DlgProc_0(HWND hDlg0, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
return TRUE;
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
return TRUE;
case IDCANCEL:
EndDialog(hDlg0,IDCANCEL);
return TRUE;
case IDC_EDIT0:
if (HIWORD(wParam) == EN_CHANGE)
{
PropSheet_Changed(GetParent(hDlg0),hDlg0);
}
}
return TRUE;
break;
case WM_CLOSE:
EndDialog(hDlg0, WM_CLOSE);
return TRUE;
break;
}
return FALSE;
}
//
// DLG1
//
BOOL CALLBACK DlgProc_1(HWND hDlg1, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
return TRUE;
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
return TRUE;
case IDCANCEL:
EndDialog(hDlg1, IDCANCEL);
return TRUE;
case IDC_EDIT1:
if (HIWORD(wParam) == EN_CHANGE)
{
PropSheet_Changed(GetParent(hDlg1), hDlg1);
}
}
return TRUE;
break;
case WM_CLOSE:
EndDialog(hDlg1, WM_CLOSE);
return TRUE;
break;
}
return FALSE;
}
|
|
|
|
|
You are creating a modal property sheet, so PropertySheet() doesn't return until you close the sheet.
Add PSH_MODELESS to the PROPSHEETHEADER::dwFlags member to make the sheet modeless.
|
|
|
|
|
To remove Help and Apply buttons you can use PSH_NOAPPLYNOW and PSH_HASHELP flags for PROPSHEETHEADER.dwFlags.
"If any of the initial property sheet pages enable a Help button, PSH_HASHELP will be set automatically. If none of the initial pages enable a Help button, you must explicitly set PSH_HASHELP if you want to have Help buttons on any pages that might be added later."
The size of Property sheet is set by the size of the property pages. You can't change it.
"When a property sheet is created, it is sized to fit its initial collection of pages. In order to maintain compatibility with previous versions of the Common Controls, property sheets and wizards do not automatically resize themselves when pages are subsequently added or removed. With Common Controls version 5.80 and later, applications should use the PropSheet_RecalcPageSizes macro after adding or removing pages with PropSheet_AddPage, PropSheet_InsertPage, PropSheet_RemovePage, or their equivalent messages. It ensures that the property sheet is properly sized for its current collection of pages. If this macro or the equivalent message is not used, some property sheet pages may be truncated or too large"
|
|
|
|
|
How can I get the returnvalue of the message handler function?
|
|
|
|
|
In the project I am currently working on, I need to be able to terminate a variety of processes from my main application. I am currently using TerminateProcess(..) to handle this task, but I have run across an issue with the command prompt.
If the command prompt is running, and having started no application, then TerminateProcess(..) works fine.
If the command prompt has been used to start another application, such as FTP or edit, the the call to TerminateProcess(..) returns a non-negative value, but the command prompt does not exit until the application it is running has exited.
Does anyone know how to programatically force a command prompt to exit regardless of what application it may be running? Any help is greatly appreciated.
|
|
|
|
|
Hello...
I can't find CCheckLixtBox as a Base class on Class Wizard
Do I have to make the files manually?
Thanks
JC
|
|
|
|
|
There sure is not much information about CCheckListBox. Perhaps you should submit it to Microsoft as a deficiency; if it is, then you could get an answer from them.
|
|
|
|
|
I want to convert a Date&Time string, for example, "08:30:25 Sep-25-00", to a DATE data type without the help of MFC. Could anyone tell me how to do that in COM way or Win32 API way?
Thanks,
Tony
|
|
|
|
|
Hi all,
how can i use the unicode/ansi conversion macros like T2A( ) in an c-file.
The macros are defined in the afxpriv.h, but if i include this headerfile i get
the error that my file has no 'cpp' extension.
-> #error MFC requires C++ compilation (use a .cpp suffix)
Can anybody help with a solution or a workaround?
TIA, Chris
|
|
|
|
|
The "work abound" is to change the extension of your file from .c to .cpp. Then if you want the functions
in your new .cpp to be callable from other .c file functions, wrap your functions like this:
#ifdef __cplusplus
extern "C" {
#endif
int foo();
#ifdef __cplusplus
}
#endif
|
|
|
|
|
Hi,
I made a simple MFC app with webbrowser cotrol..
With this, I opened a local html file with vbscript in it..
The script follows:
' This procedure is a brief sample showing
' how to automate PowerPoint from Outlook.
' Get a reference to the PowerPoint Application object.
Set appPowerPoint = CreateObject("PowerPoint.Application")
' Display the application.
appPowerPoint.Visible = TRUE
' Open a sample presentation.
appPowerPoint.presentations.Open("test.ppt")
MsgBox "At this point PowerPoint is open and displays a document. The following statements will close the document and then close PowerPoint."
' Close the presentation.
appPowerPoint.ActivePresentation.Close
' Quit PowerPoint.
appPowerPoint.Quit
' Close the object variable.
Set appPowerPoint = Nothing
And there occurs an error...
It means on the next line of --Set appPowerPoint = CreateObject("PowerPoint.Application")--
Next line is blank...and the message means like..
-->you missed ")" ( I can't remember exactle what it was..)
What I wonder is..
1. Can I use Office automation like vb in clien vbscript??
2. If #1 possible...plz show me some code...
Thanks for reading..
Any suggestion??
Regardz
-Ryan
|
|
|
|
|
Hi!
I have a problem with colors in my C++ MFC application.
The dialog window looks for what colors windows have in the registry and uses these colors to color the dialog. Thats the system colors that are located in the registry under the key: "MyComputer\HKEY_CURRENT_USER\Control Panel\Colors". These are the so called system colors, the colors the system sets for your dialog (if you don't draw it yourself). What I want to do is, I'd like my dialog window to look for it's own colors in the same kind of way, but at another location, wich I would have define. Maybe,"MyComputer\HKEY_CURRENT_USER\Software\MyProgram\Colors" where I can set the dialog window colors myself. To do this, I have to change where in the registry my dialog window looks for it's colors. Adding the necissary keys and colors is no biggie, but how do I redirect where\how the program looks for these colors?
If you don't know how to do this, could you help me with how the overriding of the OnPaint function should look like for any of the following things: A slider, ComboBox, the menu, the dialog window and boarder.
Thx, most thankfull for help. =)
/Fredrik
|
|
|
|
|
How do I find out what are the browers installed on my system ?
Is there any key in the registry which contains a list of the browsers or do I have to find out individually ?
Thanx,
Santhosh Kumar S
|
|
|
|
|
Hi everyone,
I have a project that is MFC based and I would like to know how I can display the value of an COleVariant variable in a messagebox?
For example, I have the following:
COleVariant var;
var then contains some data. I retrieved from a database with GetFieldValue() function. which is done with a CDaoDatabase connection.
How do I display whatever that is in var in the MFC application to see what is inside it?
If anyone knows, Please let me know.
Thanks in Advance!
Steve
|
|
|
|
|
Does anyone have a macro or function for converting a 24-bit RGB-color to a 16-bit (5.6.5) color?
Thanks in advance!
Erik
|
|
|
|
|
( (GetRValue(cr) >> 3) << 11 ) |
( (GetGValue(cr) >> 2) << 5 ) |
(GetBValue(cr) >> 3)
|
|
|
|
|
Thanks a lot!
What about 16-bit 1.5.5.5 translation?
Thanks again.
|
|
|
|
|
Has anybody managed to do these (like in the MS Development Environment program). I.e users can tear off tabs and/or re-arrange them.
Or, are there any existing libraries, etc, that can do this.
Thanks in advance,
James
|
|
|
|
|
As the title says, I have some code that implements tear-off tabs, very similar to the MDE IDE in faact (down to the pixel). The problem is that it isn't fineshed. The major drawbacks at the moment are:
1] Un-Docking one tab from a tabbed window undocks them all.
2] Re-Docking does not ALWAYS work (will crash sometimes).
3] Requires the BCGControlBar library (72 or later) (see this site for the download detailes - it is free).
On the other hand, the tabs/docking dialogs DO:
1] Allow rearranging by dragging the tab left and/or right.
3] Allow hosting of any CWnd derived class.
All this said, I would be willing to let you (or anybody else) have a look at the code and see if you can make anything out of it. Who knows, maybe you (or anybody else) will solve the problems *HINT* .
If you are interested, email me at:
dwulff@battleaxe-software.co.uk
Yours,
David
|
|
|
|
|
|
Hi,
In one of my programs, i am using system-wide keyboard hooks. However, i have some problems:
1)Sometimes, my program is not notified about the keypress event. For example when i press 'i' key while using ACCESS, my program is not notified.
2)Sometimes, the program gets two notifies instead of one. For example, when i press a key on MSDN, the program thinks that i pressed the same key two times.
The source code of .dll is the following:
<br />
#define ID_CMD_KEYPRESSED WM_USER+200<br />
HWND ghWndMain;
static HHOOK hHook;
static BOOL bHookInstalled;
<br />
HINSTANCE ghDLLInst; <br />
SYSTEMHOOK_API LRESULT CALLBACK KeyboardProc(<br />
int code,
WPARAM wParam,
LPARAM lParam)
{<br />
if (code>=0) <br />
{<br />
if (HIWORD(lParam) & 0x8000) <br />
{<br />
HWND h=::FindWindow(NULL,"WinScheduler");<br />
PostMessage(h, ID_CMD_KEYPRESSED , wParam, lParam);<br />
}<br />
} <br />
return (int)CallNextHookEx(hHook, code, wParam, lParam); <br />
}<br />
SYSTEMHOOK_API int WINAPI InstallHook (HWND hWnd, BOOL bCode )<br />
{ <br />
int nReturn = 1;<br />
ghWndMain = hWnd;
<br />
if (bCode == bHookInstalled) <br />
return 0; <br />
<br />
if (bCode) <br />
{ <br />
hHook=(HHOOK)SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyboardProc,ghDLLInst,0); <br />
if (!hHook) <br />
return 0; <br />
bHookInstalled = TRUE; <br />
} <br />
else <br />
{ <br />
nReturn = UnhookWindowsHookEx(hHook); <br />
bHookInstalled = FALSE; <br />
} <br />
return nReturn; <br />
}<br />
If anyone knows what the problem is, please help me.
Secondly i want to ask a question about sending keystrokes:
I use
void keybd_event( <br />
BYTE bVk,
BYTE bScan,
DWORD dwFlags,
DWORD dwExtraInfo
); to send keystrokes to other applications. However, i cannot send some special characters like .,!'^+%&()=. How can i send these characters to other applications.
Thank you for your helps!
Mustafa Demirhan
|
|
|
|
|
Hello,
I'm trying to stretch a bitmap that is in memory using StretchBlt();. Here is what I'm doing and it isn't working:
HBITMAP hBmp = dibSect.GetSafeHandle();
CDC MemDC, srcMemDC;
CBitmap Bitmap;
if(!srcMemDC.CreateCompatibleDC(NULL)) return -1;
if(!MemDC.CreateCompatibleDC(NULL)) return -1; if(hBmp != NULL) Bitmap.Attach(hBmp); else return -1;
MemDC.SelectObject(hBmp);
MemDC.SetStretchBltMode(COLORONCOLOR);
if(MemDC.StretchBlt(0, 0, 32, 32, &srcMemDC, 0, 0, bmiHeader.biWidth, bmiHeader.biHeight, SRCCOPY) == 0) return -1;
Pos = m_ImageList->Add(MemDC.GetCurrentBitmap(), RGB(0,0,0) );
MemDC.DeleteDC();
srcMemDC.DeleteDC();
|
|
|
|
|
hBmp should be selected into srcMemDC.
Destination bitmap missing.
|
|
|
|
|