|
this was my first try
after this i tried to
CMyDlg dlg;
dlg.DoModal() ... failed
dlg.Create(...) (derieved from cwnd...) but failed...
i also tried to overwrite methods like domodal ... initdialog, ....
and last but not least....the template thing
but nothing of them worked...
|
|
|
|
|
flaffy wrote:
sorry for this newbie question
Its OK. We all had to start somewhere. At least you aren't asking how to write a network packet sniffer
two days after opening your "learn C++" book...
In answer to your question, YES.
Unless you are a masochist, you will use the Resource Editor to create the actual resource for the
dialog (dialog size, title, child controls and their IDs). You can make this up by opening your
RC file as text and typing, but that is only for obscure needs.
Once you have a dialog resource, just make a .H file for the definition, and a .cpp file for
the implementation. You can take CAboutDlg in your project as a simple example. Include them
in your project, and away you go.
Once you've got used to not using ClassWizard, you won't go back. Its WAY too limited for anything
except trivial dialogs.
Iain.
|
|
|
|
|
i also tried this a "dummy" dialog
but after i edit the dialog my way ... visual studio dont want to be my friend anymore
... the question about the packet sniffer will be created in the off topic
|
|
|
|
|
How to find a file in a folder whatever the type is by last modified type.
ex: i want to find *.txt with last modified today
AND
How to delete all file in a folder without delete the folder it self ?
Thank for helping
|
|
|
|
|
Krisna Adityawan wrote:
How to find a file in a folder whatever the type is by last modified type.
ex: i want to find *.txt with last modified today
Are you wanting the newest .TXT file in a given folder? How about this pseudocode:
set lastmod to 0
for each .txt file in folder
if file's last mod date > lastmod
set lastmod = file's last mod date
save name of file
end
next
Krisna Adityawan wrote:
How to delete all file in a folder without delete the folder it self ?
SHFileOperation() should do it.
|
|
|
|
|
Hi all,
I am writing a program that requires deleting a file stored in the disk programmatically .I am wondering if we can do that?
Could somebody help me on this.
Regards.
|
|
|
|
|
|
Thanks a lot Jens,
I solved my problem.
|
|
|
|
|
You also have SHFileOperation() at your disposal.
|
|
|
|
|
Hi davi ,
Thanks a lot for guidance.
Regards.
|
|
|
|
|
You could also try CFile::Remove()
|
|
|
|
|
Or, the CRT function remove().
onwards and upwards...
|
|
|
|
|
Hi,
I need to parse ASP pages before they are rendered by a webserver and find the positions for the ASP scripts within the page. Looking for the "<%" and "%>" -tags is not a good solution since it could be something else than ASP(ei. could be in comments, could be HTML text etc.)
Anyone know a good way how to find out what really is ASP in a page?
Thanks
Fred
|
|
|
|
|
how do I know what privilage level the current user is on? like is he a member of administrative group or user group or some thing else?
|
|
|
|
|
NetLocalGroupGetMembers() & NetLocalGroupEnum() maybe what you wants.
Mazy
No sig. available now.
|
|
|
|
|
Thanks, but is there any article on this site about this issue????
|
|
|
|
|
Here is a quick and dirty method to check whether the user *could* write to specific key
in HKLM I used for a setup program that did different levels of setup depending on the
authority of the user:
char buf [MAX_PATH];
{
OSVERSIONINFO osVer;
osVer.dwOSVersionInfoSize = sizeof (osVer);
GetVersionEx (&osVer);
bIsNT = 1 && (osVer.dwPlatformId & VER_PLATFORM_WIN32_NT);
}
bIsAdministrator = FALSE;
if (bIsNT)
{
TRUSTEE Trustee;
ACCESS_MASK AccessMask;
::BuildTrusteeWithName (&Trustee, "CURRENT_USER");
PSECURITY_DESCRIPTOR pSecDesc= NULL;
PACL pAcl = NULL;
if (::GetNamedSecurityInfo (
"MACHINE\\SYSTEM\\CurrentControlSet\\Services",
SE_REGISTRY_KEY,
DACL_SECURITY_INFORMATION,
NULL,
NULL,
&pAcl,
NULL,
&pSecDesc) == ERROR_SUCCESS)
{
if (::GetEffectiveRightsFromAcl (pAcl, &Trustee, &AccessMask) == ERROR_SUCCESS)
{
if (AccessMask & STANDARD_RIGHTS_REQUIRED)
bIsAdministrator = TRUE;
}
::LocalFree (pSecDesc);
}
if (!GetSystemDirectory (buf, MAX_PATH))
bIsAdministrator = FALSE;
else
{
::lstrcat (buf, "\\drivers");
sPathSystem = buf;
}
if (bIsAdministrator && ::GetNamedSecurityInfo (
buf,
SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION,
NULL,
NULL,
&pAcl,
NULL,
&pSecDesc) == ERROR_SUCCESS)
{
if (::GetEffectiveRightsFromAcl (pAcl, &Trustee, &AccessMask) == ERROR_SUCCESS)
{
if (AccessMask & STANDARD_RIGHTS_REQUIRED)
bIsAdministrator = TRUE;
}
::LocalFree (pSecDesc);
} else
bIsAdministrator = FALSE;
}
This may give you a headstart, or at least things to search for in the Platform SDK.
Iain.
|
|
|
|
|
Thanks. You have really solved the problem
|
|
|
|
|
What I have done is something like this.
Is it the right way to do this? Please commnet.
<br />
BOOL isCurrentUserAdministrator()<br />
{<br />
<br />
DWORD dwLevel = 1;<br />
LPUSER_INFO_1 pBuf = NULL;<br />
NET_API_STATUS nStatus;<br />
DWORD nSize = 20;<br />
<br />
LPWSTR lpUsername = new unsigned short[nSize];<br />
<br />
if(!::GetUserName( lpUsername, &nSize))
return false;<br />
<br />
<br />
nStatus = NetUserGetInfo(NULL, lpUsername, dwLevel, (LPBYTE *)&pBuf);
<br />
if(nStatus == NERR_Success)
{<br />
if( pBuf->usri1_priv == USER_PRIV_ADMIN)<br />
{<br />
NetApiBufferFree(pBuf);<br />
return true;<br />
}<br />
else<br />
{<br />
NetApiBufferFree(pBuf);<br />
return false;<br />
}<br />
}<br />
<br />
return false;<br />
}<br />
<br />
|
|
|
|
|
Looks good to me. You are specifically getting a user "level", which is what your question asked.
My solution answered "can a user do 'this'?", which is a subtly different one. Sometimes users
are members of groups which have specific access to something.
Which one you use depends on the detail of why you want to know, so that is an answer best left
to your application needs.
Iain.
|
|
|
|
|
Hi all,
How a process (exe file) will be able to know path where it is residing and from where it is loaded and running?
Is there any API available?????????
Thanks for help
|
|
|
|
|
GetModuleFileName() ?
Mazy
No sig. available now.
|
|
|
|
|
|
I used the class which is derived from CControl bar
in control bar.i used the formview as a view class,form view contains other controls ,but when i resize the dock it get flicker
can any one tell me the Soln for this
thanx
|
|
|
|
|
Does anyone has some idea about setting icon(120*40) to SDI Application left corner of the title???
thanks in advance
Adi
|
|
|
|