|
Agreed with respect to split second response. However, the advantages of file-drop-off are easier implementation and security. Especially with the latter, it's much better to tell the client that security is inherent with their Windows security model as opposed to telling them that they'll have to leave a port open for our modules to talk to one another.
Cheers,
Tom Archer - Archer Consulting Group
"So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe
|
|
|
|
|
Tom Archer wrote:
the advantages of file-drop-off are easier implementation and security.
But You are atleast sharing a common folder to implement FILE-DROP-OFF feature!. this can bring trouble in long run when you implement it on site!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Tom Archer wrote:
I know this works with .NET, but have never tried it with native code
It's a bit different but not too difficult. The main difference is that the FindFirstChangeNotification() function returns a handle that can be waited on with WaitForSingleObject() or WaitForMultipleObjects(). When the handle is signalled, you call ReadDirectoryChanges() to get the changes that have been made. Generally you would run this in a separate thread and signal your main thread when a change has been made.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks for the info, Ryan. We're going to implement a sockets server, but this info is good to know.
Cheers,
Tom Archer - Archer Consulting Group
"So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe
|
|
|
|
|
Tom Archer wrote:
We're going to implement a sockets server
It's Nice to know that you are implementing Socket server!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
The file drop-off will probably be easier to implement at this stage than a sockets-based system, although it then limits communication to unidirectional - are you certain you won't need to talk back to the Unix system in the future? If so, sockets might be easier in the long term.
Another option is to setup a web server on the Unix system and connect to it from your service. That way you can use the Win32 Internet functions to make life simple, and the security is built in to the webserver already. The only problem with that is that the server generally can't signal the client when new data is available.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I met with my new team today. It's definitely gotta be sockets as the server is going to make dozens of requests within the context of a logical "conversation" and it would be seriously kludgy for us to continually interact via files (as I also have to return information regarding the work performed on Windows).
Cheers,
Tom Archer - Archer Consulting Group
"So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe
|
|
|
|
|
I use edit box in my dialog, I run my project, I type some characters to edit box and press Enter, my program close.
How can I use Enter key for my work ?
What Windows Message to use Enter key ?
Thanks in advance
|
|
|
|
|
did you well think to set your edit as MultiLine ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I need to use a single line but I want to process Enter key or the Enter key is disable.
Thanks in advance
|
|
|
|
|
hum, you mean to have a default button which is enable or disable depending on the content of your editbox ??
use EnableWindow() to Enable/disable your button
use SetDefID() to tell the dialog which button would be the default one (that would be clicked if Enter is pressed)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Right click on your Edit Box and in the properties dialog box mark the "WantReturn" and "Multiline" checkboxes.
m0n0
|
|
|
|
|
I use only a line, but I like to disable the Enter key.
|
|
|
|
|
Overload the OnOk message handler , do next :
void CYourDlg::OnOK()
{
//CDialog::OnOK();
}
the problem is that OK is set to default button and when you press Enter , automatically OnOk event handler is called.
Note that if you have only deleted the Ok button ,without doing what i wrote above , it does not solve the problem.
In this case you will have to drop any button make it "Default Button" and "Invisible", .
m0n0
|
|
|
|
|
Giorgi Moniava wrote:
n this case you will have to drop any button make it "Default Button" and "Invisible"
bad coding...
moreover, if you have to change the default button programatically (when the code executes), how will you do ? - i doublt you can like this...
use CDialog::SetDefID() instead into OnInitDialog()
CDialog::SetDefID()
this->SetDefID(IDC_BUTTON1);
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Can you tell me the better way of doing this ??
when the OK button is already deleted
m0n0
|
|
|
|
|
Giorgi Moniava wrote:
Can you tell me the better way of doing this ??
when the OK button is already deleted
already posted, re-read my message
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
the enter key functions as a button-press.
Probably the OnOk of your dialog is being called when you press enter, and the default action of OnOk is to close the dialog.
What you can do is capture the VK_RETURN event in your edit control and e.g. do nothing or translate it to VK_TAB...
You could also capture the VK_RETURN in your dialog offcourse and not have it execute the default behaviour.
Hope this gets you along,
Davy
|
|
|
|
|
Hi,
My application calls the SearchPath() API in a method which gets the version info of a file. On execution, the UNICODE debug version of the application always crashes. The error shown is 'Unhandled exception in MyAppl.exe (NTDLL.DLL): 0xC0000005: Access Violation'. The MBCS/UNICODE Release build of the application works fine and also the MBCS debug build.
<br />
DI_STATUS getFileVersionInfo(TCHAR * FileName)<br />
{<br />
TCHAR pathBuffer[MAX_PATH];<br />
struct VS_FIXEDFILEINFO <br />
{ <br />
DWORD dwSignature; <br />
DWORD dwStrucVersion; <br />
DWORD dwFileVersionMS; <br />
DWORD dwFileVersionLS; <br />
DWORD dwProductVersionMS; <br />
DWORD dwProductVersionLS; <br />
DWORD dwFileFlagsMask; <br />
DWORD dwFileFlags; <br />
DWORD dwFileOS; <br />
DWORD dwFileType; <br />
DWORD dwFileSubtype; <br />
DWORD dwFileDateMS; <br />
DWORD dwFileDateLS; <br />
} *lpFixedFileInfo; <br />
<br />
TCHAR fileInfoBuffer[2048];<br />
UINT32 VersionInfoSize;<br />
if (SearchPath(NULL, FileName, NULL, sizeof(pathBuffer), pathBuffer, NULL) > 0)<br />
{<br />
LogMsg(_T(" SearchPath: %s\n"), pathBuffer);<br />
}<br />
else<br />
{<br />
return(ERR_FILE_NOT_FOUND);<br />
}<br />
if ((VersionInfoSize = GetFileVersionInfoSize(FileName, 0)) > 0)<br />
{<br />
if (GetFileVersionInfo(FileName, NULL, VersionInfoSize, fileInfoBuffer) > 0)<br />
{<br />
VerQueryValue(fileInfoBuffer, TEXT("\\"), (LPVOID *)&lpFixedFileInfo, &VersionInfoSize);<br />
LogMsg(_T(" FileName : %s Version: %d.%d.%d.%d\n"),FileName,<br />
HIWORD(lpFixedFileInfo->dwFileVersionMS),<br />
LOWORD(lpFixedFileInfo->dwFileVersionMS),<br />
HIWORD(lpFixedFileInfo->dwFileVersionLS),<br />
LOWORD(lpFixedFileInfo->dwFileVersionLS));<br />
}<br />
else<br />
{<br />
return(DI_ERR_FILE_NOT_FOUND);<br />
}<br />
}<br />
else<br />
{<br />
return(ERR_FILE_NOT_FOUND);<br />
}<br />
return(DI_SUCCESS);<br />
}<br />
The function call is
TCHAR tmp[1024];
GetModuleFileName(NULL, tmp, sizeof(tmp));
getFileVersionInfo(tmp);
Am I missing out something here? I have Win2K OS. Please help.
Thanks,
Vini
|
|
|
|
|
Vinaya wrote:
GetModuleFileName(NULL, tmp, sizeof(tmp));
The third parameter is the number of characters, not the size of the buffer in bytes. You'll need to pass in 1024 to indicate there are 1024 characters (or sizeof(tmp)/sizeo(TCHAR) )
Vinaya wrote:
SearchPath(NULL, FileName, NULL, sizeof(pathBuffer), pathBuffer, NULL)
Ditto for the fourth parameter here.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Vinaya wrote:
if (SearchPath(NULL, FileName, NULL, sizeof(pathBuffer), pathBuffer, NULL) > 0)
Your exception is basically caused by the sizeof() input parameter of the function. This parameter required the number of characters that your string buffer holds. But the sizeof() function returns the number of bytes within the array. With a UNICODE program, each character occupies two bytes, so will therefore return twice the number required, resulting in a memory exception.
Try:
<br />
if (SearchPath(NULL, FileName, NULL, sizeof(pathBuffer)/sizeof(TCHAR), pathBuffer, NULL) > 0)
I Dream of Absolute Zero
|
|
|
|
|
Thanks a lot. That solved the problem.
Vini
|
|
|
|
|
Hi,
I've to capture the handle of the window, i knew the process id of the window, how to capture the window handle using the process id. Anyone pls provide me solution to the problem.
Thanks & Rgds
VVS
|
|
|
|
|
You could use EnumWindows .
In the EnumWindowsProc call GetWindowThreadProcessId and compare the process id with the one you have, if they match then that window belongs to the process in question.
You should be able to build up a list of all the windows that belong to the process.
|
|
|
|
|
Im using Visual c++ 6.0 with sql server 2000 database.
I create a new project with file database option and i select one of my big table.
Without writing another code when execute i have this error "Record set failed to open"
I don't understand, this is my code that was create automatically:
// articletestSet.h : interface of the CArticletestSet class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_ARTICLETESTSET_H__F9F350D0_CB82_11D9_B5A3_0001022AAD75__INCLUDED_)
#define AFX_ARTICLETESTSET_H__F9F350D0_CB82_11D9_B5A3_0001022AAD75__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CARTICLE
{
public:
CARTICLE()
{
memset( (void*)this, 0, sizeof(*this) );
};
wchar_t m_CODMAG[6];
wchar_t m_CODART[6];
wchar_t m_LIBELLE[26];
wchar_t m_libeltech[26];
wchar_t m_groupe[6];
wchar_t m_UNITE[3];
float m_QUANTITE;
float m_SEUILmag;
float m_PRIX_VENTE;
float m_PRIX_DOLLAR;
float m_prix_unitaire_dollar;
float m_pa_fc;
float m_LMH;
float m_LMB;
float m_encours;
wchar_t m_code_loca[6];
wchar_t m_shelf[16];
float m_aprix_unitaire_dollar;
wchar_t m_compte_charge[6];
ISequentialStream* m_image;
wchar_t m_code_arturi[6];
wchar_t m_NAME3[26];
wchar_t m_code_pe1[6];
wchar_t m_NAME4[26];
wchar_t m_code_pe2[6];
wchar_t m_name5[26];
wchar_t m_priorite[1];
wchar_t m_service[6];
wchar_t m_fournisseur[6];
wchar_t m_group2[6];
wchar_t m_group3[6];
wchar_t m_group4[6];
wchar_t m_deviseach[3];
wchar_t m_second_name[26];
wchar_t m_categorie[11];
wchar_t m_libcategorie[26];
BEGIN_COLUMN_MAP(CARTICLE)
COLUMN_ENTRY_TYPE(1, DBTYPE_WSTR, m_CODMAG)
COLUMN_ENTRY_TYPE(2, DBTYPE_WSTR, m_CODART)
COLUMN_ENTRY_TYPE(3, DBTYPE_WSTR, m_LIBELLE)
COLUMN_ENTRY_TYPE(4, DBTYPE_WSTR, m_libeltech)
COLUMN_ENTRY_TYPE(5, DBTYPE_WSTR, m_groupe)
COLUMN_ENTRY_TYPE(6, DBTYPE_WSTR, m_UNITE)
COLUMN_ENTRY_TYPE(7, DBTYPE_R4, m_QUANTITE)
COLUMN_ENTRY_TYPE(8, DBTYPE_R4, m_SEUILmag)
COLUMN_ENTRY_TYPE(9, DBTYPE_R4, m_PRIX_VENTE)
COLUMN_ENTRY_TYPE(10, DBTYPE_R4, m_PRIX_DOLLAR)
COLUMN_ENTRY_TYPE(11, DBTYPE_R4, m_prix_unitaire_dollar)
COLUMN_ENTRY_TYPE(12, DBTYPE_R4, m_pa_fc)
COLUMN_ENTRY_TYPE(13, DBTYPE_R4, m_LMH)
COLUMN_ENTRY_TYPE(14, DBTYPE_R4, m_LMB)
COLUMN_ENTRY_TYPE(15, DBTYPE_R4, m_encours)
COLUMN_ENTRY_TYPE(16, DBTYPE_WSTR, m_code_loca)
COLUMN_ENTRY_TYPE(17, DBTYPE_WSTR, m_shelf)
COLUMN_ENTRY_TYPE(18, DBTYPE_R4, m_aprix_unitaire_dollar)
COLUMN_ENTRY_TYPE(19, DBTYPE_WSTR, m_compte_charge)
BLOB_ENTRY(20, IID_ISequentialStream, STGM_READ, m_image)
COLUMN_ENTRY_TYPE(21, DBTYPE_WSTR, m_code_arturi)
COLUMN_ENTRY_TYPE(22, DBTYPE_WSTR, m_NAME3)
COLUMN_ENTRY_TYPE(23, DBTYPE_WSTR, m_code_pe1)
COLUMN_ENTRY_TYPE(24, DBTYPE_WSTR, m_NAME4)
COLUMN_ENTRY_TYPE(25, DBTYPE_WSTR, m_code_pe2)
COLUMN_ENTRY_TYPE(26, DBTYPE_WSTR, m_name5)
COLUMN_ENTRY_TYPE(27, DBTYPE_WSTR, m_priorite)
COLUMN_ENTRY_TYPE(28, DBTYPE_WSTR, m_service)
COLUMN_ENTRY_TYPE(29, DBTYPE_WSTR, m_fournisseur)
COLUMN_ENTRY_TYPE(30, DBTYPE_WSTR, m_group2)
COLUMN_ENTRY_TYPE(31, DBTYPE_WSTR, m_group3)
COLUMN_ENTRY_TYPE(32, DBTYPE_WSTR, m_group4)
COLUMN_ENTRY_TYPE(33, DBTYPE_WSTR, m_deviseach)
COLUMN_ENTRY_TYPE(34, DBTYPE_WSTR, m_second_name)
COLUMN_ENTRY_TYPE(35, DBTYPE_WSTR, m_categorie)
COLUMN_ENTRY_TYPE(36, DBTYPE_WSTR, m_libcategorie)
END_COLUMN_MAP()
};
class CArticletestSet : public CCommand<caccessor<carticle> >
{
public:
HRESULT Open()
{
CDataSource db;
CSession session;
HRESULT hr;
CDBPropSet dbinit(DBPROPSET_DBINIT);
dbinit.AddProperty(DBPROP_AUTH_PASSWORD, "yhwha");
dbinit.AddProperty(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, false);
dbinit.AddProperty(DBPROP_AUTH_USERID, "sa");
dbinit.AddProperty(DBPROP_INIT_CATALOG, "gesmed");
dbinit.AddProperty(DBPROP_INIT_DATASOURCE, "sem1");
dbinit.AddProperty(DBPROP_INIT_LCID, (long)1036);
dbinit.AddProperty(DBPROP_INIT_PROMPT, (short)4);
hr = db.OpenWithServiceComponents("SQLOLEDB.1", &dbinit);
if (FAILED(hr))
return hr;
hr = session.Open(db);
if (FAILED(hr))
return hr;
CDBPropSet propset(DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_CANFETCHBACKWARDS, true);
propset.AddProperty(DBPROP_IRowsetScroll, true);
propset.AddProperty(DBPROP_IRowsetChange, true);
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE );
hr = CCommand<caccessor<carticle> >::Open(session, "SELECT * FROM dbo.ARTICLE", &propset);
if (FAILED(hr))
return hr;
return MoveNext();
}
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ARTICLETESTSET_H__F9F350D0_CB82_11D9_B5A3_0001022AAD75__INCLUDED_)
I learn my self
|
|
|
|
|