|
This[^] should help
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I want to fetch data from a databse and populate a DHTML view at run time.Also, if theres is a change in value of any of the objects in database, the change should be immediately reflected in the view.How can i achieve that.
|
|
|
|
|
Not asking alot then
You have two options:
1. As you say, use DHTML to update the information in the page. This can be labourious work and imo ties the VC application too tightly to the HTML page.
2. Grab the data from the db and generate an XML string from the data, pass this XML string to a JScript function on the web page that will parse the XML data and make changes to the display accordingly.
To call a JScript function on a web page from VC use the following:
MSHTML::IHTMLDocument2Ptr spDoc(m_ctlWeb1.GetDocument());
if (spDoc)
{
IDispatchPtr spDisp(spDoc->GetScript());
if (spDisp)
{
OLECHAR FAR* szMember = L"Populate";
DISPID dispid;
HRESULT hr = spDisp->GetIDsOfNames(IID_NULL, &szMember, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
if (SUCCEEDED(hr))
{
COleVariant vtResult;
static BYTE params[] = VTS_BSTR;
COleDispatchDriver dispDriver(spDisp);
dispDriver.InvokeHelper(dispid, DISPATCH_METHOD, VT_VARIANT, (void*)&vtResult, params, strXML);
BOOL bSuccess = vtResult.boolVal;
}
}
}
So the above will call the Populate JScript function in the current page that takes 1 parameter (sent as a string)
Then in your HTML page have a function, e.g.
var oXmlDoc = new ActiveXObject("MSXML2.DOMDocument.4.0");
function Populate(strXML)
{
bSuccess = false;
if (oXmlDoc)
{
oXmlDoc.async = false;
oXmlDoc.resolveExternals = false;
if (oXmlDoc.loadXML(strXML))
{
var oNode = oXmlDoc.selectSingleNode("/update/field");
if (oNode)
{
var elField = document.getElementById("idField");
if (elField) elField.innerText = oNode.innerText;
bSuccess = true;
}
}
}
return bSuccess;
}
This way you are free to change the way the HTML looks and feels as much as you like. It's not the job of the VC app to render the information but the HTML page. You could even have several HTML pages that render the information in different ways - as long as the XML is common to all.
Hope this helps,
Andy
|
|
|
|
|
My program calls many functions and interates in many loops. To debug the program, i've placed TRACE calls all over the place, but it seems, when the program runs, not all the TRACE outputs are displayed, they are truncated. I guess there isnt enought place/memory for the debug window, how can i redirect it to a text file?
Thx.
|
|
|
|
|
Check _CrtSetReportFile
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
can anyone give me an idea about how to develop a portscandetector??
|
|
|
|
|
here is your idea
first create a socket connection using
CSocket or CAsyncSocket in mFC
or use core Socket api's
now check each port in computer.
if you socket connected to that port mean the port is open else it is not.
I Think It will Work
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
yes but what if the ports do not accept all connections
gabby
|
|
|
|
|
ok i agree with you inthis topic.
yeah it possible that if the port don't allow to connect we can't do any thing
i think i have to work on it thanks for suggestion
I Think It will Work
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
If you want to check for someone port scanning your machine you open a bunch of ports on your machine where nothing is running. If something hits several of them you know you are beind port scanned.
More complex is to listen for all packets, and decode the raw packets. Look for connection attempts, and if you see multipul connections you know you are being port scanned.
The hard part is telling the difference between acidental connections to your machine (someone who intended a different machine but typed the wrong address), and a port scan. Portscanners may run with several machines over a long time, hoping the port scan will not trip your detector instead it looks like the former.
|
|
|
|
|
Can u suggest me an algorithm to do so..
i know the basics of detection. just watching on closed ports is also a type of ports can detection but it gives lots of false positives.. i need some advances level help..
|
|
|
|
|
Not myself. Google around, I know there are open source programs that attempt to do this. Read their code. (but watch the license)
|
|
|
|
|
Hi,
I am looking for a reporting with certain abilities. I know and used Crystal Reports, but the reports are bound to a database. I would like to fill the data directly from my application. I tried Visual Reports, but i can't display a preview as a child window in my application dialog. I'd like to have an ActiveX View Component.
Can anyone give me a hint?
The tool should have:
- A Report designer to design the report
- A ActiveX Viewer component for application integration
- The data shouln't come directly from a datatabase, i need to fill the data in myself from the application.
greets,
Jason
|
|
|
|
|
Hi,
I am new in MFC.
I would like to change a dialog box into property page.
Is it possible or not?
If it is possible.So, please help me "How to change a dialog box into property page".
rajesh
|
|
|
|
|
1.Yes. but as far as I know you cannot use property page alone ,you have host your property page in Property sheet.
2. Look into MSDN for "Using Property Sheets in Your Application"
Click Here
[^]
-With Regards,
Abhi Lahare
|
|
|
|
|
i have a tool for data migration.
the tool is developed in vc++ with backend as sql server.
and i want to improve the performance of the product.
I have a datamigration tool where in i take set of records from source side and apply some data manipulation functions like substring,date functions and transfer to target. So i need to do it record by record so it hits my performance level.I have a recordset and will hold all the records of the source table how huge it would be. Can i reduce the burden anywhere in this process
Can anyone help me out on this.
thanks.
srinivasp.
|
|
|
|
|
Optimizing code is a tricky business, indeed, and your question is so nebulous so it borders on the immaterial
First of all, you must find the exact bottlenecks of the current implementation. Is it the database handling? The string handling? Something else?
A small performance gain in an often used function can give some gains. But IME, those gains are often only measured in single-number percentages - the really big performance boosts can often be found by rethinking the problem.
So, start by identifying what is taking the most time. Then it might easier to submit more specific questions!
|
|
|
|
|
Make sure that your SQL code to manipulate/save the data is written as stored procedure(s). This can have a dramatic impact if you are processing row by row and executing SQL for each row.
onwards and upwards...
|
|
|
|
|
I'm trying to create an app to perform several tasks with files, my question is:
When I found a file, then i want to open it use its suported program, how do i ???
(How to open a file with its suported program.)
any one help me please?
(sory, my English is not well)
thanks
|
|
|
|
|
<br />
ShellExecute(NULL, "Open",pathName,0,0,0);<br />
It is Illogical to define an inventor by his invention
|
|
|
|
|
for 32 bit OS
BOOL CreateProcess(
LPCTSTR lpApplicationName, // name of executable module
LPTSTR lpCommandLine, // command line string
LPSECURITY_ATTRIBUTES lpProcessAttributes, // SD
LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD
BOOL bInheritHandles, // handle inheritance option
DWORD dwCreationFlags, // creation flags
LPVOID lpEnvironment, // new environment block
LPCTSTR lpCurrentDirectory, // current directory name
LPSTARTUPINFO lpStartupInfo, // startup information
LPPROCESS_INFORMATION lpProcessInformation // process information
);
for 16 bit OS
UINT WinExec(
LPCSTR lpCmdLine, // command line
UINT uCmdShow // window style
);
gabby
|
|
|
|
|
thanks alot for your help Wadi,
Can i ask you any more...
--------------------
Ghazi Al Wadi wrote:
Hi,
Hope this helps
Retrieving the owner of a file requires:
obtain the security descriptor for the file, Use GetFileSecurity()
then using the security descriptor to get a pointer to the owner's Security Identifier (SID). GetSecurityDescriptorOwner()
Finally, you use the owner's SID to obtain the owner and domain name of the file LookupAccountSid()
------------------------
thanks, could you give me a simple example???,
i've tried but it's not resposible:
CString TheFile;
TheFile=CString(Buffer[i].FileName).Left(Buffer[i].FileNameLength / 2);
SECURITY_DESCRIPTOR sd;
DWORD sob;
GetFileSecurity(TheFile,OWNER_SECURITY_INFORMATION,&sd,sizeof(sd),&sob);
SID pOwner;
BOOL OwnerDefault;
GetSecurityDescriptorOwner(&sd,(PSID*)&pOwner,&OwnerDefault);
char AccountName[80];
char DomainName[80];
DWORD cbDomain;
DWORD cbName;
LookupAccountSid(NULL,&pOwner,(LPTSTR)AccountName,&cbName,(LPTSTR)DomainName,&cbDomain,NULL);
::AfxMessageBox(AccountName,0,0);
help me please???!!!
thanks
|
|
|
|
|
Hi,
The issue is you have to find the required buffer for each parameter. see the example below.
Simply open up an MFC Dialog project and place this code in the OnOk () function.
Browse for and select the fpasted file and clikc ok.
Cheers
<br />
void CFindOwnerDlg::OnOK() <br />
{<br />
char szFilters[]=<br />
"MyType Files (*.*)|All Files (*.*)|*.*||";<br />
<br />
CFileDialog fileDlg (TRUE, "*", "*.*",<br />
OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, szFilters, this);<br />
<br />
if( fileDlg.DoModal ()==IDOK )<br />
{<br />
ULONG uSizeSD ;
PSID pOwner = NULL ;
char szName[MAX_PATH] ;
char szDomain_name[MAX_PATH] ;
<br />
<br />
ULONG uName_len ;
ULONG domain_len;
char *sdBuf;
SID_NAME_USE deUse ;
<br />
<br />
int bSuccess = 0;<br />
szName[0] = 0;<br />
szDomain_name [0] = 0;<br />
uName_len = 0;<br />
domain_len = 0;<br />
<br />
BOOL fOwnerExists = FALSE;<br />
<br />
<br />
<br />
CString pathName = fileDlg.GetFileName ();<br />
<br />
<br />
bSuccess = GetFileSecurity( <br />
pathName, <br />
OWNER_SECURITY_INFORMATION, <br />
0, <br />
0, <br />
&uSizeSD);<br />
if (bSuccess != 0) <br />
MessageBox ("It should not happen as it should be an error "); <br />
else<br />
{<br />
sdBuf = new char [uSizeSD];<br />
<br />
bSuccess = GetFileSecurity( <br />
pathName, <br />
OWNER_SECURITY_INFORMATION, <br />
sdBuf, <br />
uSizeSD, <br />
&uSizeSD);<br />
<br />
bSuccess = GetSecurityDescriptorOwner(sdBuf, &pOwner, &fOwnerExists);<br />
<br />
<br />
bSuccess = LookupAccountSid (NULL , pOwner ,szName, &uName_len, szDomain_name, &domain_len, &deUse);<br />
bSuccess = LookupAccountSid (NULL , pOwner ,szName, &uName_len, szDomain_name, &domain_len, &deUse);<br />
<br />
if (bSuccess == 0) <br />
MessageBox ("Error ");
else<br />
{<br />
CString msg;<br />
msg = szDomain_name ;<br />
msg= msg + "\\";<br />
msg =msg + szName;<br />
MessageBox (msg);<br />
}<br />
}<br />
}<br />
<br />
<br />
<br />
<br />
}<br />
It is Illogical to define an inventor by his invention
|
|
|
|
|
Hi Ghazi Al Wadi,
You maybe misunderstand my question.
my problem is : When an other computer on my Local Area Network (LAN) connected to my computer and has pasted a file on my Shared Folder. I wanna know : who (which computer on my LAN) has pasted the file?.
Could you help me more, Wadi.
thanks
|
|
|
|
|
Hi Ghazi Al Wadi,
You maybe misunderstand my question.
my problem is : When an other computer on my Local Area Network (LAN) connected to my computer and has pasted a file on my Shared Folder. I wanna know : who (which computer on my LAN) has pasted the file?.
Could you help me more, Wadi.
thanks
|
|
|
|
|