|
thank you for your code. i'll try it tomorrow. it's now very late at my time zone.
benedikt
|
|
|
|
|
thank you for your description. i tried it with the following code, but something doesn't work. i get no error message but there must be an error! maybe you find time to check my code. thanx
CString cstrStandardpfad = "C:\\User\\";
CString cstrOrdnername = "";
CString cstrPfad = "";
int nCounter = 1;
SHARE_INFO_502 shareInfo;
PSECURITY_DESCRIPTOR security;
EXPLICIT_ACCESS actrlEntrys[2];
PACL pACL = NULL;
char* pcNetname = new char[MAX_PATH];
char* pcPath = new char[MAX_PATH];
//acl entry erstellen
ZeroMemory(&actrlEntrys, 2 * sizeof(EXPLICIT_ACCESS));
actrlEntrys[0].grfAccessMode = GRANT_ACCESS;
actrlEntrys[0].grfAccessPermissions = FILE_ADD_SUBDIRECTORY|FILE_ADD_FILE|FILE_DELETE_CHILD|
FILE_LIST_DIRECTORY|FILE_TRAVERSE;
actrlEntrys[0].grfInheritance = CONTAINER_INHERIT_ACE;
actrlEntrys[0].Trustee.pMultipleTrustee = NULL;
actrlEntrys[0].Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
actrlEntrys[0].Trustee.TrusteeForm = TRUSTEE_IS_NAME;
actrlEntrys[0].Trustee.TrusteeType = TRUSTEE_IS_GROUP;
actrlEntrys[0].Trustee.ptstrName = "Administratoren";
actrlEntrys[1].grfAccessMode = GRANT_ACCESS;
actrlEntrys[1].grfAccessPermissions = FILE_ADD_FILE|FILE_DELETE_CHILD|
FILE_LIST_DIRECTORY|FILE_TRAVERSE;
actrlEntrys[1].grfInheritance = CONTAINER_INHERIT_ACE;
actrlEntrys[1].Trustee.pMultipleTrustee = NULL;
actrlEntrys[1].Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
actrlEntrys[1].Trustee.TrusteeForm = TRUSTEE_IS_NAME;
actrlEntrys[1].Trustee.TrusteeType = TRUSTEE_IS_USER;
while(nCounter<20)
{
//ordnername + pfad ermitteln
cstrOrdnername = m_pGrid->GetItemText(nCounter,1);
cstrPfad = cstrStandardpfad+cstrOrdnername;
pcPath = (char*)(LPCSTR)(cstrPfad);
pcNetname = (char*)(LPCSTR)(cstrOrdnername);
//ace entry modifizieren
actrlEntrys[1].Trustee.ptstrName = pcNetname;
//access list generieren
SetEntriesInAcl(2,actrlEntrys,NULL,&pACL);
// security descriptor initialisieren
security = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR,
SECURITY_DESCRIPTOR_MIN_LENGTH);
if (security == NULL) {
AfxMessageBox("Fehler beim Erstellen vom Security Descriptor!");
}
if (!InitializeSecurityDescriptor(security, SECURITY_DESCRIPTOR_REVISION)) {
AfxMessageBox("Fehler beim Initialisieren des security descriptors!");
}
// die acl dem security descriptor hinzufügen
if (!SetSecurityDescriptorDacl(security,
TRUE, // fDaclPresent flag
pACL,
FALSE)) // not a default DACL
{
AfxMessageBox("Irgendein Fehler bein zuweisen vom security descriptor!");
}
//Freigabe für gleichnamigen benutzer erstellen
shareInfo.shi502_netname = pcNetname; //name der freigabe
shareInfo.shi502_type = STYPE_DISKTREE; //freigabe ist irgendein ordner
shareInfo.shi502_remark = "Das ist eine Freigabe!"; //kommentar
shareInfo.shi502_permissions = ACCESS_ALL; //zugriff zur freigabe
shareInfo.shi502_max_uses = -1; //anzahl der gleichzeitig zugreifenden user
shareInfo.shi502_current_uses = 0; //anzahl der derzeitigen user
shareInfo.shi502_path = pcPath; //pfad zum ordner
shareInfo.shi502_passwd = NULL; //passwort der freigabe
shareInfo.shi502_security_descriptor = security; //security descriptor
NET_API_STATUS res;
DWORD parm_err = 0;
//endlich freigeben
res = NetShareAdd("derhackler",502,(LPBYTE)&shareInfo,&parm_err);
if(res==0)
AfxMessageBox("ok");
else
{
if(res==ERROR_ACCESS_DENIED)
AfxMessageBox("Zugriff verweigert");
else if(res==ERROR_INVALID_LEVEL)
AfxMessageBox("der level parameter ist falsch");
else if(res==ERROR_INVALID_NAME)
AfxMessageBox("irgendwas mim file system parameter");
else if(res==ERROR_INVALID_PARAMETER)
AfxMessageBox("der parameter ist ungültig");
else if(res==NERR_DuplicateShare)
AfxMessageBox("Freigabe bereits vorhanden");
else if(res==NERR_RedirectedPath)
AfxMessageBox("Aktion ist für den Pfad ungültig");
else if(res==NERR_UnknownDevDir)
AfxMessageBox("Pfad existiert nicht");
}
TRACE("Error: %u\tparmerr=%u\n", res, parm_err);
nCounter++;
}
|
|
|
|
|
Can somebody tell me why does this error message come when i execute my visual c++ 5.0 application
|
|
|
|
|
Can somebody tell me why invalid page fault message appears in some application ( I am using visual c++ 5.0 version )
Lets share our knowledge and make this world even more beautiful.
|
|
|
|
|
Not without more information. Saying why do I get an Invalid Page Fault is like asking why I get an access violation or a general protection fault. Post the suspected code and maybe someone can help out.
|
|
|
|
|
Hi,
is anybody out there who has experience in Midi-Programming with Win32-API ( no MFC !) ?
Especially in the following things :
- timer and resolution
- callbacks for midi-input
- midi-synchronisation via MTC / SMPTE
- midi-syschronisation with parallel wave-out ( API or DirectX )
I`m still looking for a good book about Midi & Win32 Api. Not that small introduction like Petzold did in his book.
If you any good book please send an ISBN.
Greatings Mario ///
--------------------
www.klangwerker.de
rocknix@lycos.de
--------------------
|
|
|
|
|
i have bulid a com component which is functioning properly in debug mode
whereas it gives error while building the dll in release mode(Min dependancy)
error C2259: 'CComObject<class cgraphics="">' : cannot instantiate abstract class due to following members:
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" cgraphics=""> >::CreateInstance(void *,const struct _GUID &,v
oid ** )'
so please help me
|
|
|
|
|
Hi,
I have created controls in runtime.
I want to know how to do the following things in the run time:
Move the controls in the dialog
Insert or hide the scroll bar in the dialog, depending on the control's position
Increase the scroll area size, if the control is moved out of the dialog (right or bottom sides)
Decrease the scroll area size, if the control is moved on the left or top sides of the dialog
Thanks in advance
bye
Mani
|
|
|
|
|
Hi,
You might want to check the MSDN Library, SetWindowPos, and all related articles.
Good luck.
--
Alex Marbus
|
|
|
|
|
Some time ago I had found a class that allows the controls to be replaced/resized responding to the size changes made over a dialog/window...
You can try to find it at codeguru, it was called CControlPos, if you don't find it e-mail me and I'll send it to you.
It can be possible that that class don't solve your concrete problem, then you should try to use SetWindowPos() or MoveWindow() always taking a look at the differences between Client and nonclient areas of the rects that you get using GetWindowRect(), GetCliewntRect()...
If you want a dynamic scroll bar placed in your dialog you should activate it from the dialog properties, and then recalculate its size every time you make a "control-move".
I expect this helps you.
PD: excuse my english I'm just a begginer.
|
|
|
|
|
My application is a container, and It implement that, drag a item or items from a view to anther view( a item is a control ). The code of copy or cut items to anther view is finished, which is also used by the code of drag-drop --- save data to a COleDataSource and load data from COleDataObject.
The question is that, when I drag items ( copy or move ) in the save view, no error, but , when I drag items to another view in this MDI application, when I use pItem->DoVerb( OLEIVERB_SHOW, this ) in view class, error ocurs, and cause a ASSERT error, in COleFrameHook::OnDocActivate(BOOL bActive) as follows:
if (pNotifyHook != this)
{
// shouldn't be removing some other hook
ASSERT(pNotifyHook->m_pFrameWnd->m_pNotifyHook == pNotifyHook); // this line
pNotifyHook->m_pFrameWnd->m_pNotifyHook = NULL;
}
drag copy in the save view has no error, I know maybe something is not set correctly, but I donot know where. Help please, it is in hurry.
Pardon my poor english!
|
|
|
|
|
Hello,
This is bit wierd, please bear with me.
I am using the Ultimate Toolbox classes from Dundas to create a tabbed toolbar. No problem there. The toolbar is created in the 3dTabView, and the 3dTabView is created in a docked window.
However, when the docking window (window) is created it is way to big. Here's the question...
How can I resize that docking window's height only?
I've been able to resize the width, by altering the rect before creating it. But when I do the same thing with rect.bottom the window is resized way small. I did set a breakpoint to see what the rect contained and it was a huge negative number. Is this correct?
Thanks for the help...oh, and not for laughing.
Frank
"640k ought to be enough for anybody."
Bill Gates, Chairman of the Board, and CEO, Microsoft Corporation, 1981
|
|
|
|
|
Duh.
Fixed it. The Create function was using CFrameWnd::RectDefault. Once I initialized my own rect, and got rid of the rectdefault it worked.
Sorry!
Frank
|
|
|
|
|
The huge negative number sounds like an int/unsigned int problem. It's hard to know without seeing the code. Did you try SetWindowPos AFTER creation ? Did you try different values in to rect you passed in, or changing the top instead ?
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Is there a way to select a line (drawn by LineTo or points -SetPixel) say by mouse either by clicking on it or by CRectTracker .. I have found a way which is very long, and I think there is a better way, if you got an idea please help me.
Thanks for reading. Neda
|
|
|
|
|
Hi Neda, Chetovri!
1- Are you using any collection or data structures when you draw the line?
2- Are you drwaing the new lines with the C++ new operator?
If Yes to (1), then you must have some sort of collection class to collect the new instances of the lines.
If Yes to (2), then you can just return the index of your line from the collection class.
|
|
|
|
|
Does anyone have any recommendations on whether to use ODBC or OLE DB in a C++ project? What are the pros and cons of using either one? From what I've been reading, it sounded like OLE DB would allow you to access everything ODBC will, but also allow you access to other data sources as well. However, am wondering how portable OLE DB is compared to ODBC and what other issues may suggest using one access method over the other.
Comments and suggestions appreciated. Thanks.
|
|
|
|
|
In one and I have a programs navigator (a kind of database). In the other hand I have an editor.
both created by myself using visual C++6.
I have decided to implement them separately in order to be able of make them better separately too.
In one button click of the semi-database I create a process calling CreateProcess(). And calling the editor App.
This has to be implemented in a machine, and I need the insurance that the Database app. don't continue working while the editor is not closed.
I have used WaitForSingleObject(Thread_of_the_editor_process,INFINITE); but the key and mouse events are still active, and when I close the editor app. they work as if the app won't be locked.
Could you give me an idea about how to implement a solution?
Thank you in advance.
|
|
|
|
|
Is this too simple ?
BeginWaitCursor();
..........
......... Sleep(SOME_TIME_LONG); // well you know what I mean
..........
..// Do the logic
EndWaitCursor(); // remove the hourglass cursor
Cheers
Alfadhly
|
|
|
|
|
Yes I know what you mean, but this is not effective in my situation: I need to wait until another application has finished, if I work in this way I will need to sleep some time, look for the state of the thread that contains the other app. and sleep again some time if thew other app has not finished yet. and so on...
Please excuse my english, It can seem a little rude, but it's all what I can do.
And thank you a lot for your answer... (could you give me another one?)
thank you in advance.
|
|
|
|
|
Check out WaitForInputIdle(). It just might do what you want.
|
|
|
|
|
I've created an mfc application and i'd like to skin it like winamp or neoplanet. Is there a code sample?
|
|
|
|
|
|
|
Skinning is something you should deign the app to do initially, rather than try to retrofit into it. But, as others point out, there are some examples. Don't be surprised if there is way more work involved with skinning it than you originally spent on the app.
|
|
|
|