|
Thank you for your replay.
My scenario is:
When message WM_HOTKEY is received, I repeatedly checks keyboard state until no key is pressed. If my program is in the foreground, GetKeyState() cannot work well. Now I has to create a worker thread to check it.
Now I has another question:
GetKeyState() should return a SHORT value which is a 16-bit integer, and only the low byte is significant. If the specific key is pressed, it returns "FF81" or "FF80". Are you sure the above code segment can work well?
|
|
|
|
|
sorry, i can't help with your first question.
2nd Q:
from MSDN:
GetKeyState:
Return Values
The return value specifies the status of the specified virtual key, as follows:
* If the high-order bit is 1, the key is down; otherwise, it is up.
* If the low-order bit is 1, the key is toggled. A key, such as the CAPS LOCK key, is toggled if it is turned on. The key is off and untoggled if the low-order bit is 0. A toggle key's indicator light (if any) on the keyboard will be on when the key is toggled, and off when the key is untoggled.
-c
ABSURDITY:
A statement or belief manifestly inconsistent with one's own opinion.
|
|
|
|
|
i need to implement some search and filtering capabilites in my application.the problem is that i have to call dialog from my CRecordView class.that's OK but how to give informations for CListCtrl which is on dialog-from CRecordView
|
|
|
|
|
Remember that the list control is not created till the dialog is almost shown on screen. Most people try to access member control variables after they instantiate their dialog wrapper class. I suggest that you pass all the strings to a string array and then populate the list control in the initdialog function of the dialog using those strings in the array.
Regards
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
thanks man.i would give almost anythyng to foun out how can You possible know all those things?can You tell me where can i download (for free by all means) material (ebooks,html files,...) about MCSD 70-016 certificate?do You think that i can learn something smart from them?Also i need to ask is there any chance to study online MFC programming (again-for free) and where?code on this site is sometimes just too complex for me and i want to follow some guide to get stuck in with it graduatelly.i want to learn how to develop windows applications with MFC so bad!!! thanks for everything
|
|
|
|
|
Hello
What IOCTL codes are available to access to parallel port from an application?
I am trying to read/write from the parallel port with the file access functions but I must be missing something and it doesn´t work.
I don´t have C++ nor the SDK nor the DDk. I only have access to MSDN online help.
Thanks
Good luck
http://www.geocities.com/nafiton
|
|
|
|
|
I remember something about using "COM1" as the path name for CreateFile when wanting to access the serial COM1 port.
I guess you just have to specify the name of the port then.
"It could have been worse, it could have been ME!"
|
|
|
|
|
Hi,
im trying to set the current working directory before going in to a file dialog and then reseting it to its original value after the dialog has closed:
TCHAR strCurrentDirectory[MAX_PATH];
GetCurrentDirectory(MAX_PATH, strCurrentDirectory);
CFileDialog fileDlg(TRUE, ".dot;.doc", NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR, "Microsoft Word Templates (*.dot; *.doc)|*.dot;*.doc|HTML Templates (*.htm; *.html)|*.htm; *.html|All files (*.*)|*.*||\0", NULL);
fileDlg.m_ofn.lpstrInitialDir = "c:\\projects\\temp";
if(fileDlg.DoModal() == IDOK)
{
// Do something
}
SetCurrentDirectory(strCurrentDirectory);
But this doesnt work as next time i go in to a different file dialog the current directory is set as c:\projects\temp.
Has anyone had to cope with a similar problem before and if so how did they get around it?
Cheers,
Andy.
|
|
|
|
|
Since you have used OFN_NOCHANGEDIR, you really don't need to use Get/SetCurrentDirectory at all.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi Probably you are using Windows 2000.
In this OS the last opened directories thru the
application is set in the registry and the
File Dialog reads thru that.
|
|
|
|
|
hi, yes i am using windows 2000. do you know where the registry entry is stored so that i can modify that myself.
Cheers,
Andy.
|
|
|
|
|
HKCU\Microsoft\Windows\Currentversion\explorer\comDlg32\OpenSaveMRU
Its got sub keys for well known extensions and generic keys for
those not registered, see if u can crack and let me know if u do.
|
|
|
|
|
I use a dialog based application with MFC.
The dialog also has a menu attached to it.
I use a view modal dialog boxes for settings and stuff.
Opening is not a problem but when I try to close this modal dialog the complete application closes. This happens when closing with either IDOK of IDCANCEL buttons.
The problem is that this only happens in Release mode. But without throwing an exeption of some kind.
When "debugging" the release version an exeption in msvcrt.dll at address 0x0000005 is thrown. But I have no clue why this happens.
In earlier versions of the program (without menu but with lots of other extra stuff) this problem did not occur.
Anyone got a clue to this problem?
Thanks
|
|
|
|
|
There is an article here by Joe Newcomer where he explains how to debug a release build. I suggest that you read that.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi,
I use a stored procedure for write to a Database.
When I execute the Stored Procedure, this Stored Procedure acknoledge with a int value if all are OK.
I would like to know how can I do for reading this value.
The value must be extract from the "Status".
You find my sample code:
//Initialize the connection with the Database RTLSQL1 ARCHIVES_NUM
//COM initialization
CoInitialize (NULL);
_ConnectionPtr m_pConn2("ADODB.Connection");
_ParameterPtr pParam2,pParam3;
try
{
//Check if I can create a instance for a connection into a db
HRESULT hr = m_pConn2.CreateInstance (__uuidof (Connection));
if (FAILED (hr))
{
// Automat_LOG_WITH_TIME(_T("DB : Can't create intance of Connection"));
}
else
{
// Automat_LOG_WITH_TIME(_T("DB : I can create intance of Connection"));
}
CString strFileName = "JA001206";
//Check if I can Open a session in the RTLSQL1 ARCHIVES_TVI
if (FAILED (m_pConn2->Open("provider=sqloledb.1;database=ARCHIVES_TVI;server=1.1.1.1;uid=Automat;pwd=Automat;network=dbmssocn","","",adConnectUnspecified)))
{
// Automat_LOG_WITH_TIME(_T("DB : Can't open datasource "));
// Automat_Send_SMS(_T("DB : Can't open datasource "),_T(""));
}
else
{
//Automat_LOG_WITH_TIME(_T("DB : I can open datasource "));
CString sT;
sT.Format("%d",1);
_variant_t varLiReturn;
int liReturn = -99;
_CommandPtr pCmd2("ADODB.Command");
pCmd2->ActiveConnection = m_pConn2;
//Store procedure for the DATABASE
pCmd2->CommandText = "StartFileNumV3";
pParam2 = pCmd2->CreateParameter ( _bstr_t ("FileName"), adVarChar,
adParamInput, strFileName.GetLength (), (_bstr_t) strFileName);
pCmd2->Parameters->Append ( pParam2);
pParam2 = pCmd2->CreateParameter ( _bstr_t ("AutomatNr"), adInteger,
adParamInput, sizeof(int), _variant_t (sT));
pCmd2->Parameters->Append ( pParam2);
pParam2 = pCmd2->CreateParameter(_T("Status"),adInteger,adParamOutput,sizeof(int),varLiReturn);
pCmd2->Parameters->Append ( pParam2);
_RecordsetPtr pRecordset;
pRecordset.CreateInstance(__uuidof(Recordset));
pRecordset = pCmd2->Execute(NULL, NULL, adCmdStoredProc);
//******************
//!!!!!!!! I don't know if it is correct to receive the return value
varLiReturn = pCmd2->Parameters->Item[_T("Status")]->Value;
Sleep(100); //ms
//Automat_LOG_WITH_TIME(_T("DB : The Store Procedure have been execute with success (StartFileNum)"));
//Close the DATABASE
if ( (m_pConn2->State & adStateOpen) == adStateOpen)
{
m_pConn2->Close();
// Automat_LOG_WITH_TIME(_T("DB : I can close datasource RTLSQL1 ARCHIVES_TVI"));
}
else
{
// Automat_LOG_WITH_TIME(_T("DB : I can't close datasource RTLSQL1 ARCHIVES_TVI"));
}
}
}
catch ( _com_error &e )
{
_bstr_t bstrSource (e.Source());
_bstr_t bstrDescription (e.Description());
CString sErrorDB;
sErrorDB.Format("DB : ERROR !!!!!\r\nException thrown for classes generated by #import\r\nCode = %08lx\r\nCode meaning = %s\r\nSource = %s\r\nDescription = %s\r\n", e.Error (), e.ErrorMessage (), (LPCTSTR) bstrSource, (LPCTSTR) bstrDescription);
// Automat_LOG_WITH_TIME(sErrorDB);
MessageBox (sErrorDB, bstrDescription,MB_OK);
}
catch (...)
{
TRACE ( "*** Unhandled Exception ***" );
}
Sleep(100); //ms
CoUninitialize();
youssef
|
|
|
|
|
I can't be arsed to read your code. But heres a snippet from some of my code that does what you want:
try {
_CommandPtr pCommand;
_ParameterPtr pRetVal;
pCommand.CreateInstance(__uuidof(Command));
pCommand->ActiveConnection = m_pConn;
pCommand->CommandText = "p_YourProc";
pCommand->CommandType = adCmdStoredProc;
pRetVal = pCommand->CreateParameter ( _bstr_t ("RETURN_VALUE"), adInteger, adParamReturnValue, 0);
pCommand->Parameters->Append(pRetVal);
pCommand->Parameters->Append ( pCommand->CreateParameter( _bstr_t ("YourParamIn"),adInteger,adParamInput,0 ,_variant_t(lTicketId)));
pCommand->Execute(NULL, NULL, adCmdStoredProc);
lSuccess = (DWORD) pRetVal->GetValue();
} catch (_com_error e)
{
}
Signature space for rent. Apply Within.
|
|
|
|
|
Hi, thank for the answer but I can't receive the return value.
lSuccess is allways null.
best Regards
youssef
|
|
|
|
|
paste the source of your stored procedure.
STL is a religeon. Enquiries to Reverend Christian Grauss
|
|
|
|
|
Use My class CADODatabase, You have the CADOCommand and CADOParameter Class...
For other side, if you want to return a value by the parameter, you mus tu use the following sintax in the stored prodedure
Create Procedure MyProc
@Param1 Integer,
@ParamRet varchar(100) output
AS
...
Select @ParamRect = "Hello World"
Go
Regards
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
Carlos Antollini wrote:
Select @ParamRect = "Hello World"
should be :
Select @ParamRect = 'Hello World'
SQL server is picky about that.
But he wanted a procedure's return value, not to return a value. Theres a difference(!)
STL is a religeon. Enquiries to Reverend Christian Grauss
|
|
|
|
|
If he wants to get the value returned by the stored procedure must to use the adParamReturnValue value.....
Check here
Best Regards
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
My original reply shows him how to do just that!!!
STL is a religeon. Enquiries to Reverend Christian Grauss
|
|
|
|
|
|
STL is a religeon. Enquiries to Reverend Christian Grauss
|
|
|
|
|
Hi!!!
Can anyone tell me the meaning of phrase "thread pool".
Actually i read certain articles on Server based applications at CP. Many people suggest that allocating one thread per user is a bad approach. People suggest that there are two other options one is I/O completion ports and the other is "thread pool"
Here i am unable to understand the meaning of "thread pool". As far as my vocabulary is concerned, the meaning of word pool is "standing water".
Please tell me the meaning of "thread pool"
|
|
|
|