|
|
That makes it work .
Hmmm. Looking at my original code, when I was specifying "C:\Windows\System32\CScript.Exe" as the application parameter, and "//nologo DistributionBuild.wsf" as the command line, I realize I wasn't repeating the program name in the command line, e.g. "C:\Windows\System32\CScript.Exe //nologo DistributionBuild.wsf". Perhaps that was what was causing the problem. Thanks for your help.
Software Zen: delete this;
|
|
|
|
|
Hi, I need help.
I have enabled asynchronous listening on tcp and udp port.
When I receive TCP request, averything is ok, i read source IP adress
(FD_ACCEPT) and data (FD_READ).
But when UDP broadcast message comes, i cannot read IP adress, because
there is no FD_ACCEPT event. I can only read udp data.
How can i get source ip of UDP datagram?
Thanx for help.
|
|
|
|
|
I've already made it,
simply call recvfrom() instead of recv().
Thanks anyway.
O.
|
|
|
|
|
ERROR IN THIS PART OF A MFC APPLICATION!
IT SAYS..
DAMAGE:AFTER NORMAL BLOCK #90 AT 0*30101110
This prog is basically to get a particular record from a databaseprinted in the edit box.
void CProd_listDlg::OnOK()
{ UpdateData(TRUE);
// TODO: Add extra validation here
ADODB::_ConnectionPtr m_pConnection = NULL;
ADODB::_RecordsetPtr pRecordset = NULL;
VARIANT *vRecordsAffected = NULL;
char ConStr[500];
char ConStr1[100];
_bstr_t prodname;
_bstr_t id;
BOOL m_bIsConnectionOpen;
char strSelect[500];
// Create an instance of _Connection
HRESULT hr ;
hr = m_pConnection.CreateInstance(__uuidof(ADODB::Connection));
if (SUCCEEDED(hr))
{
//Open a connection where database is access database : "c:\\emailparsing\\prod_list.mdb"
ConStr[0] = '\0';
strcat(ConStr, "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=");
strcat(ConStr, "c:\\Aegis_proj\\prod_list.mdb" );
m_pConnection->Open(ConStr, "", "", 0);
//If database opened successfully then set IsConnectionOpen to TRUE
if (SUCCEEDED(hr))
{
m_bIsConnectionOpen = TRUE;
}
}
try
{
::MessageBox(NULL, m_edit1, "", MB_OK);
_bstr_t ConStr(m_edit1);
::MessageBox(NULL,ConStr,"",MB_OK);
// strProductName = m_edit1;
sprintf(strSelect,"SELECT * FROM prodlist WHERE product_name = '%s' ", (char *)ConStr);
::MessageBox(NULL,strSelect,"",MB_OK);
_bstr_t ConStr1(strSelect);
::MessageBox(NULL,ConStr1,"",MB_OK);
pRecordset = m_pConnection->Execute(ConStr1, vRecordsAffected, 1);
::MessageBox(NULL, "returning", "", MB_OK);
if (!pRecordset->GetEOFile())
{
int i = 0;
id = ((_bstr_t) pRecordset->GetFields()->GetItem("id")->GetValue());
prodname = ((_bstr_t) pRecordset->GetFields()->GetItem("product_name")->GetValue());
strcat(id,prodname);
::MessageBox(NULL, id, "", MB_OK);
m_edit2 = LPCTSTR(id);
::MessageBox(NULL, m_edit2, "", MB_OK);
UpdateData(FALSE);
i++;
}
pRecordset->Close();
}
catch (_com_error &e)
{
::MessageBox(NULL, (LPCTSTR)e.Description(), "Error!", MB_OK);
//printf("Description = '%s'\n", (char*) e.Description());
}
CDialog::OnOK();
return ;
}
void CProd_listDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
void CProd_listDlg::OnChangeEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
ranjani
|
|
|
|
|
|
it didn't workk
i get debug error!
on debugging
i noticed that
the program control doesn't go after the return statement int the end!
ranjani
|
|
|
|
|
To get any useful replies, you might consider narrowing it down quite a bit (i.e., looking at a whole wad of irrelevant code will scare off even the most seasoned troubleshooter). What sort of error is it? Is an assertion firing? Have you single-stepped through the code with the debugger? Provide some hints as to what is happening versus what is supposed to happen.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
what is supposed to happen is..
as i enter the product name..and on clicking ok..
the prog should look for the record with that particular product name and fetch that particular record..in the specified location..
then...get the record and display it in the edit box in the dialogue box..
and shud exit!
what is haeppening is..this is giving an error!after diplaying in the edit box!
ranjani
|
|
|
|
|
ranjjj wrote:
this is giving an error!after diplaying in the edit box!
And that error would be ??
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi
I m new in this fied of VC.I have to do a project of Email Server soon.I need help about this.Any tutorial or guide book or any web site which could help me in this regard.And also some source code for my help in this project.I'll be thankfull to the person who helped me for this.Thanx
Muhammad Ali
|
|
|
|
|
search in www.planetsourcecode.com
|
|
|
|
|
You're new to VC, and one of your first projects is going to be an e-mail server. That's quite an undertaking. Good luck.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi all,
How do I run an exe as a service?
Thanks
BOBY
Boby
|
|
|
|
|
|
The service is created only when i logged in as administrator .Its not working in When i logged in as a Local User.
Thanks
BOBY
boby
|
|
|
|
|
Are you sure you really have permission to write where you want to write ?
|
|
|
|
|
I want to run my application first at win2k startup,before the other application run.
|
|
|
|
|
|
If you start your app from a windows service, then it will be running even before any user logon. Here is the a tool[^] that helps you to do that.
If the other application is also a window service, then you have to modify it so that it depends on your service. When a service depends on another service, windows will load the other service first.
P.S. Your app may have problems starting from a service. Typically this is a resource issue (somthing required is not available because nobody has logged on to the machine yet). There are ways to get around this problem, but not always.
My articles and software tools
|
|
|
|
|
What is the easiest way to find and send info to any window containing a certain string?
such as, if i wanted to find any window that has a title containing "- Notepad" and send the current time and date to the bottom...
|
|
|
|
|
If you want to find one window:
HWND FindWindow(
LPCTSTR lpClassName, // class name
LPCTSTR lpWindowName // window name
);
If you want to search for all:
HWND GetNextWindow(
HWND hWnd, // handle to current window
UINT wCmd // direction
);
int GetWindowText(
HWND hWnd, // handle to window or control
LPTSTR lpString, // text buffer
int nMaxCount // maximum number of characters to copy
);
Mickey
|
|
|
|
|
You can search for a window handle or a CWnd object by using the FindWindow-function.
When the call returns, you have either a pointer to CWnd representing this window (MFC version) or the window's HWND (API version). Then you can use this HWND e.g. to change window title by using SetWindowText-function, or if you use the MFC-version, you can use the CWnd to mess around with the window just as if you would have created it yourself. Change status bar, toolbar, menu, layout, minimize, maximize etc etc
What exactly is it that you want to do with the current time and date ? Should the target window display this on it's status bar ? Or draw it somewhere else inside it ? Want to hijack a window's Device Context ? Explain. The 'Send the current time and date to the bottom' isn't very informative
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
well, basically i want to add the current time and date to the bottom of the page in all open notepad windows, save and close them.... to remember where i left off at, and what date/time i was reading it.... but this is just for knowledge.. im not going to make a nice program out of it... just experimenting :-/
|
|
|
|
|
Ahh ok.
Let's create a general outline of the solution to this problem.
1. Find the window
2. Enumerate the views of this window
3. With each view, access the underlying document
4. Get this document's CString, and append the current date and time to the end.
5. Force window to save all it's open documents/views.
For a specific, Notepad-only solution, the outline is a bit different, because Notepad doesn't have any real views: it has one HUGE edit control.
Now, some code pieces. With the MFC-way, of course
<br />
CWnd* pNotepadWin = new CWnd;<br />
<br />
HWND hwndNotepad = ::FindWindow( ClassName, NULL ) );<br />
<br />
if ( hwndNotepad )<br />
{<br />
pNotepadWin->Attach( hwndNotepad );<br />
}<br />
else<br />
{<br />
delete pNotepadWin;<br />
return FALSE;<br />
}<br />
<br />
Now we have the CWnd representation of the Notepad window.
<br />
CWnd* pNotepadEdit;<br />
<br />
pNotepadEdit = pNotepadWin->GetTopWindow();<br />
<br />
if ( !pNotepadEdit )<br />
{<br />
pNotepadWin->Detach();<br />
<br />
delete pNotepadWin;<br />
return FALSE;<br />
}<br />
<br />
bool bContinue = true;<br />
while ( bContinue )<br />
{<br />
CString strName;<br />
<br />
::GetClassName(pNotepadEdit->m_hWnd, (LPTSTR) strName, 20);<br />
<br />
if ( strName.CompareNoCase("Edit") == 0 )<br />
bContinue = false;<br />
<br />
pNotepadEdit = pNotepadEdit->GetNextWindow(GW_HWNDNEXT);<br />
<br />
if ( !pNotepadEdit )<br />
{<br />
bContinue = false;<br />
}<br />
}<br />
<br />
Phew. That was some coding. But now we have the CWnd of the edit control inside Notepad. After this, it's easy to use 'GetWindowText' and 'SetWindowText' to append the current date and time to the edit control's contents.
Perhaps I should turn this into an article
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|