|
(Also posted on EE...)
I have an interesting problem that I believe is Win2K (Professional) specific...
I am creating a shared memory area using a named MMF. If I create the MMF with a default security descriptor (by using a NULL "SECURITY_ATTRIBUTES" pointer in the call to ::CreateFileMapping), no other processes can open the file mapping object. This occurs regardless of which user creates the file mapping object and which other user tries to open it.
When I try to specify a SECURITY_ATTRIBUTES object with a NULL DACL (so that everyone can get to the object), I get an error of "ERROR_PRIVILEGE_NOT_HELD" from the ::CreateFileMapping call. The only way I can get it to work is to give the IIS user (IWAM_<machinename>) Administrative privileges. Then, the named MMF is created, and all other processes can open it. This, of course, is an unacceptable solution.
(Does anyone know the *specific* privilege that is required to create an object with a NULL DACL? Having a custom local user with this privilege for IIS to use is acceptable.)
I never had this problem under WinNT, so I believe that it is Win2K specific.
Other information: The MMF backed by the paging-file; it is of a fixed size; syncronization is not a issue; multi-CPU system; plenty of free memory and storage; latest platform SDK and documentation.
Hoping to hear from you all...
Peace!
-=- James.
|
|
|
|
|
Hello,
Does anyone know how to impelemt Drag and Drop?
I have a window and some rectangles are draw in it.
How can i move those rectangles inside the window.
I need step by step tutorial and example pls.
tnx.
|
|
|
|
|
Nice Drag'n'drop example was published in Aug'97 issue of MSJ in the "Wicked code" column by Jeff Prosise. It's available online at:
http://msdn.microsoft.com/library/periodic/period97/wicked0897.htm
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I require some samples of a tcp/ip sender & a tcp/ip sink. I want to learn the basics of sending & receiving packets of data through tcp/ip.
Just basic code, no connection points or anything.
Thanks.
Gerry.
|
|
|
|
|
There is an example in MSDN called Chatter or something stupid like that - it's a sample client-server CSocket program to let users exchange messages.
|
|
|
|
|
Thanks I'll take alook.
I didn't want to use mfc, just two console apps, it's for a beginners class.
Thanks,
Gerry.
|
|
|
|
|
|
Hi, I'm having a problem I don't understand. I can't get printerdefaults, and DeviceCapabilities() and DocumentProperties() don't work either. At home everything works fine for my networkprinter, but at work things go wrong. After starting the app, CWinApp::m_hDevMode and CWinApp::m_hDevNames are NULL and stay NULL, suggesting there's no default printer, but there is! Other apps like Word work fine. It's a HP4050TN networkprinter connected directly to a hub and shared on a server through a HP JetDirect port. When I set another networkprinter (connected to workstation through LPT1) as the default printer CWinApp:m_hDevMode and CWinApp::m_hDevNames are properly initialized.
Does anyone have an idea what goes wrong here?
Thanks, Joep
|
|
|
|
|
I had some problems like this, but it dealt with Security Issues regarding user rights.
Gerry.
|
|
|
|
|
Hi !
It may look like a newbie question but ...
I'm implementing a Class into a MFC-extension DLL that handle re-sizable bitset.
The first idea was to use a dynamic array of bitset ( from std::bitset)
the thing is that i cannot acces bitset member and method even if i had the #include <bitset> in my code !!!
If some could help me understand this ???
Thanx all
|
|
|
|
|
> [...] from std::bitset) the thing is that i cannot acces bitset member and
> method even if i had the #include in my code !!!
Please provide an example on how you are trying to access the bitset. Besides, IIRC, the bitset does not resize itself.
Peace!
-=- James.
|
|
|
|
|
I'm facing smiliar problem which related to WM_COPYDATA. Is it possible help me to solve that, anyway, thanks first.
May I ask if I want to pass a bitmap handle (HBITMAP) from a source window to a destination window such that I can display the bitmap in the destination window. How can I deal with that?
My code to SendMessage as follows:
COPYDATASTRUCT dataStruct;
HWND rhwnd; // receiving window handle
HWND shwnd; // sending window handle
// am I wrong in below? Pls point out
dataStruct.dwData=1;
dataStruct.cbData=sizeof(HBITMAP);
dataStruct.lpData=hBitmap;
if (!(rhwnd=::FindWindow(NULL,"Message2")))
AfxMessageBox("Can't find window",MB_OK,0);
else
{
shwnd = (HWND) (this);
::SendMessage(rhwnd,WM_COPYDATA,(WPARAM) shwnd,(LPARAM) &dataStruct);
}
Thank you very much if you can help me.
|
|
|
|
|
I'm facing smiliar problem which related to WM_COPYDATA. Is it possible help me to solve that, anyway, thanks first.
May I ask if I want to pass a bitmap handle (HBITMAP) from a source window to a destination window such that I can display the bitmap in the destination window. How can I deal with that?
My code to SendMessage as follows:
COPYDATASTRUCT dataStruct;
HWND rhwnd; // receiving window handle
HWND shwnd; // sending window handle
// am I wrong in below? Pls point out
dataStruct.dwData=1;
dataStruct.cbData=sizeof(HBITMAP);
dataStruct.lpData=hBitmap;
if (!(rhwnd=::FindWindow(NULL,"Message2")))
AfxMessageBox("Can't find window",MB_OK,0);
else
{
shwnd = (HWND) (this);
::SendMessage(rhwnd,WM_COPYDATA,(WPARAM) shwnd,(LPARAM) &dataStruct);
}
Thank you very much if you can help me.
|
|
|
|
|
I sent you an email reply, but I'll summarize what I said in the email.
Create a struct containing the data you want to send to the other application, and put a (void) pointer to that struct into the lpData field of the COPYDATASTRUCT variable. You can actually send any pointer you want as long as the app know how to handle the pointer. I use the dwData field to indicate what type of struct/pointer I'm sending, and the receiving app traverses a switch statement to determine what to do with the pointer.
|
|
|
|
|
Hi John, I haven't receive your email. Can you send it again or directly go to sly@hkid.com. Thanks so much.
|
|
|
|
|
I've tried to generate a SplitterBar
under the following preconditions: SDI without Document/View Architecture
It didn't work
I used VC++ 6.0, ServicePack5
MFC Wizard
Splitter: Menu Project; Add To Project ; Components..;Visual C++; SplitterBar
Does it work on your PC?
Have you an idea why it doesen't work?
Is there any other Idea how to do it manually?
Greetings
Andrew
|
|
|
|
|
Hi,
I am having trouble keeping a child window maximized within its parent while the parent is resizing.
The child window is a class derived from cwnd and is a member variable of its parent.
The child is created with the dwStyle WS_MAXIMIZE and so starts off maximized. However when the parent is resized the child remains the same.
Is there a way of locking the child in the maximised position?
Or is there a way to direct the WM_SIZE message from the parent to the child?
I would be grateful for any help.
|
|
|
|
|
In WM_SIZE handler of the parent, use child->MoveWindow(0, 0, cx, cy). cx and cy are client size width/height passed to OnSize.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thank you, but there is a slight problem with this.
When the Child is initially created maximized it's border or frame is not shown.
However when the resizing begins, it's frame appears just inside it's parents.
Any Ideas?
|
|
|
|
|
Do you need the caption and frame for the child? If yes, use SetWindowPlacement instead of MoveWindow.
If no, just remove WS_MAXIMIZE and other caption/frame styles. WM_SIZE will work with MoveWindow.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I can't to access to global variables in my dialog project from all the classes.
If I define them in header file and call this file from all the dialogs of the project -the compailer cry that it is already defined,
So,The same,if I define it in some source files(cpp).
and if I define it only in the main source it shout that there ara undeclared variables
when I use in this global variables ???
WHAT HE WANT THAT I WILL DOING ?????????????????????????????
miki
|
|
|
|
|
when you want to use global variable from other file
you must declare with extern atribute:
main.cpp:
CMainApp theApp;
.
.
.
---------------------------------------------------------
other.cpp:
#include "where is class declared.h"
extern CMainApp theApp;
.
.
.
now you can use theApp variable in other.cpp
|
|
|
|
|
you need to redeclare them in each class with an extern in front of them.
ie. extern int i;
Scott Croston
|
|
|
|
|
Global variables tend to be considered bad programming....and, they can be hard to keep up with.
If you need something to store temporary data, say the state of a dialog or something and you want to be able to access it anywhere (Views, threads, etc.)
You might simply consider storing it in the MainFrame class. It is easy to get a pointer to the Mainframe from pretty much anywhere.
Example:
CMainFrame *pMF = (CMainFrame*)AfxGetApp()->m_pMainWnd;
BOOL bDialogState = pMF->bDlState;
Hope this helps........
|
|
|
|
|
the solution of decalring the variable in CMainFrame class is fine but what if ur application is thread oriented whaer u dont need any GUI hence one need not use the Frame class so how can one access to a global variable.
|
|
|
|