|
How can I get a message when clicked on an already selected item in the treeview control? Could anybody help me? Thanks in advance!
|
|
|
|
|
Use a combination of OnMouseDown/Up(), CTreeCtrl::GetSelectedItem(), and CTreeCtrl::GetItemRect().
John
|
|
|
|
|
You can also handle the NM_CLICK notification. Call GetMessagePos to get the mouse coordinates for the message.
|
|
|
|
|
Hi All,
I have a weird situation with me.
I have a hook dll which is hooking message of a process P1.
Now there is another process P2 which actually sets the hook. This P2 is a console application
Whenever a new dialog box pops up in P1, hook dll captures the handle of this new dialog. Now I want to send this handle to a thread created from process P2. How do I? Shared data will work here but in that case process P2 will have to read from dll but I want that whenever a new dialog box pops up in process P1 at that time hook dll should intimate about the same to the thread in process P1. If its a user interface thread then I can do it by posting some WM_USER message. But can I have user interface thread from a console application? (My process P1 is a console application).
Or can I intimate a worker thread in process P1 from hook dll running in context of P2 process.
--------------
Vaibhav...
|
|
|
|
|
I am already thinking your best bet is going to be to set an event that the console will be waiting upon. Put the data from the hook / retrieve the data into the console application from a memory mapped file.
Or else create a named pipe, use a mailslot, etc.
|
|
|
|
|
Hi All,
I would like to know that is it possible to create User Interface Thread from a console application?
I tried doing that but when I am calling obMyDlg.DoModal() from the InitInstance() of my class which is derived from CWinThread thread ends with exit code zero.
Any hints?
--------------
Vaibhav...
|
|
|
|
|
Help!! I really weak in programming and never learn visual c++ before.
I need to write a program to send message using console application.
My program need to send a message to a destination (type the destination IP address).
|
|
|
|
|
|
what is net send? can give me example?
|
|
|
|
|
Hi,
I'm trying to work out how to get the directory name of where my executable is installed. Is this information provided automatically by my installer in the registry somewhere or do I have to manually set this for my installer (I am just using the "Setup Project" from Visual Studio 2003)?
I can get the working directory, but when I have a file association and double-click on that file obviously the working directory gets set to the parent folder of the file and not of my executable.
Thanks in advance.
|
|
|
|
|
|
Does anyone knows how to use SortItems with my ClistCtrl for each column.
I have three column. I need to sort.
I tried what is written in msdn for sortitem but it didnt work (I wrote the exact code)
/\|-||\/|/\|)
|
|
|
|
|
Right Click on the List Control and check "sort" property
V
|
|
|
|
|
I am trying to decide which non-MFC CString implementation (ie. just standard C++) is the best (ie. fast, stable/bug free, plenty of functionality). I have found the following classes on CP, but cannot decide which one to use....
http://www.codeproject.com/string/stdstring.asp
http://www.codeproject.com/string/yasr.asp
I am verging towards stdstring.asp but would appreciate any feedback and suggestions as to why one is better than another, including any suggestions for others I have not listed.
|
|
|
|
|
IMO you are far better served to use STL. It has a bit of a steep learning curve, especially if you aren't into templates but you will be well rewarded. And of course STL does much more than just strings and is portable.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Neville Franks wrote:
It has a bit of a steep learning curve
Well, if he just wants to use std::string, there's not much of a learning curve involved I guess. Should be fairly simple.
|
|
|
|
|
<br />
int main(int argc, char* argv[])<br />
{<br />
long start=0,length=0;<br />
char *pByte=(char*)malloc(sizeof(char)*10);<br />
if(pByte==NULL)<br />
return -1;<br />
memset(pByte,1,10);<br />
ofstream fout("test.bmp",ios::out);<br />
if(!fout)<br />
{<br />
return -1;<br />
}<br />
fout.write(pByte,10);<br />
free(pByte);<br />
fout.close();<br />
return 0;<br />
}<br />
I debug this program with boundscheker,the bc report that there are 160 bytes memory leak which at
<br />
if ( (p = (_PVFV *) _realloc_crt(__onexitbegin,<br />
_msize_crt(__onexitbegin) +<br />
ONEXITTBLINCR * sizeof(_PVFV))) == NULL )
these code was copy from "..\Microsoft Visual Studio\VC98\CRT\SRC\onexit.c"
I do not know where I am wrong at.
please anybody help me!
Don't look at me in that way!
|
|
|
|
|
Well, once possible leak is after if(!fout) - At that point in your program you exit, without freeing pByte
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
the program goes well.
and the fout always has correct value!
if I use fopen,fclose.
the BoundsChecker report nothing
example:
<br />
char buff[]="11111";<br />
FILE* pFile=fopen("www.txt","w+");<br />
if(!pFile)<br />
return;<br />
fwrite(buff,1,5,pFile);<br />
fclose(pFile);<br />
Don't look at me in that way!
|
|
|
|
|
Maybe closing the file handle first will flush the buffer and you will be okay
fout.write(pByte,10);
fout.close(); // <- call this before freeing memory
free(pByte);
|
|
|
|
|
the meory leak as before!
<br />
char *buff=new char[7];<br />
strcpy(buff,"123456");<br />
ofstream fout("test.txt",ios::out);<br />
fout.write(buff,6);<br />
fout.close();<br />
delete[] buff;<br />
I hope it's boundschecker wrong!
Don't look at me in that way!
|
|
|
|
|
HI,
I have a procedure inside a package. I am trying to execute it using the call syntax. But while trying to prepare the statement i get an Syntax Error or Access Violation error with a SQL state of 37000. I try executing other procedures from the same package it executes properly. Dunno why this is giving a problem. Any suggestions.
Regards,
Mihir Shroff
|
|
|
|
|
provide the code snippet
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
HSTMT hStatement = NULL;
m_strSQLState = "";
m_strErrorString ="";
m_lNativeError = 0;
if( !m_pConnection )
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"No Database connection exists");
return FALSE;
}
if(strSQL == "")
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"Not a valid SQL statment");
return FALSE;
}
if (bDisplaySQL)
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"[ActionQuery] SQL Statement is:" + strSQL);
}
RETCODE rCode;
HDBC hDbc = m_pConnection->m_hODBC;
HENV hEnv = m_pConnection->m_hEnv;
//Allocate the statement
rCode = ::SQLAllocStmt(hDbc,&hStatement);
if(rCode != SQL_SUCCESS)
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"SQLAllocStmt Error");
CheckSQLError(hStatement);
return FALSE;
}
rCode = ::SQLSetStmtOption(hStatement,SQL_CONCURRENCY,SQL_CONCUR_VALUES);
if( (rCode != SQL_SUCCESS) && (rCode !=SQL_SUCCESS_WITH_INFO) )
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"SQLSetStmtOption Error:");
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"[Warning]Lock during action query may not be available");
CheckSQLError(m_hStatement);
}
//Prepare the allocated statement
rCode = ::SQLPrepare(hStatement,(unsigned char*)LPCTSTR(strSQL),strSQL.GetLength() );
if(rCode != SQL_SUCCESS)
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"SQLPrepare Error:");
CheckSQLError(hStatement);
::SQLFreeStmt(hStatement,SQL_DROP);
return FALSE;
}
//Execute the prepared SQL statement
rCode = ::SQLExecute(hStatement);
if((rCode != SQL_SUCCESS) && (rCode != SQL_SUCCESS_WITH_INFO))
{
if (CDatabaseManager::m_nLogLevel > 0)
DumpInfo(CDatabaseManager::m_pLog,"SQLExecute Error");
CheckSQLError(hStatement);
::SQLFreeStmt(hStatement,SQL_DROP);
return FALSE;
}
::SQLFreeStmt(hStatement,SQL_DROP);
return TRUE;
and strSQL = "{call MTMS_TCMD.FMForLoad(82,'ETR Data not available!')}";
Regards,
Mihir Shroff
|
|
|
|
|
Hello guys,
I'm writing a simple demo application that have to display two DB tables data refreshed every X seconds.
To do so, I'm using two MS DataGrid Controls in a Dialog Box... it works perfectly, but I'd like to add different row colors depending on a column value (ie: the table PROCESS displays different process statuses and for terminated process I would display a green line, for failed processes a red one and so on...).
Someone has alredy done so, or has someone a good tip for me?
Thanx,
Fabio
|
|
|
|